Skip to content

Commit

Permalink
Distinguish between dev and test caches (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
blvrd authored Sep 14, 2023
1 parent 4b2e203 commit a25136e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/oaken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def self.load_from(directory)
class Result
def initialize(directory)
@directory = directory
@path = Pathname.new("./tmp/oaken-result.yml")
@path = Pathname.new("./tmp/oaken-result-#{Rails.env}.yml")
@runs = @path.exist? ? YAML.load(@path.read) : {}
@runs.transform_values! { Run.new(**_1) }
@runs.default_proc = ->(h, k) { h[k] = Run.new(path: k) }
Expand Down
8 changes: 8 additions & 0 deletions test/dummy/test/models/account_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "test_helper"

class AccountTest < ActiveSupport::TestCase
test "something" do
assert accounts.kaspers_donuts
end
end

16 changes: 16 additions & 0 deletions test/dummy/test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"

Oaken::Seeds.preregister ActiveRecord::Base.connection.tables.grep_v(/^ar_/)
Oaken::Seeds.load_from "db/seeds/accounts/kaspers_donuts"

class ActiveSupport::TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)

# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all

include Oaken::Seeds
end

0 comments on commit a25136e

Please sign in to comment.