Skip to content

Commit

Permalink
Rename Oaken::Data to Seeds (#39)
Browse files Browse the repository at this point in the history
We're starting to see what our data is actually a form of seeds, or closer to.

So this rename helps conceptualize that.
  • Loading branch information
kaspth authored Sep 7, 2023
1 parent 7e8370d commit 5fe85ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/oaken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def upsert(id, **attributes)
end
end

module Data
module Seeds
extend self

class Provider < Struct.new(:data, :provider)
Expand All @@ -115,7 +115,7 @@ def register(...) = records.register(...) # Set Active Record as the default pro

def self.load_from(directory)
Dir.glob("#{directory}{,/**/*}.rb").sort.each do |file|
Oaken::Data.class_eval File.read(file)
class_eval File.read(file)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/oaken_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class OakenTest < Oaken::Test
class SomeObject; end

def test_register
Oaken::Data.memory.register SomeObject
Oaken::Seeds.memory.register SomeObject
assert_respond_to self, :oaken_test_some_objects
end

Expand Down
6 changes: 3 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ class YamlRecord < ActiveRecord::Base

require "active_record/fixtures"

Oaken::Data.records.preregister ActiveRecord::Base.connection.tables.grep_v(/^ar_/)
Oaken::Data.load_from "test/seeds"
Oaken::Seeds.records.preregister ActiveRecord::Base.connection.tables.grep_v(/^ar_/)
Oaken::Seeds.load_from "test/seeds"

class Oaken::Test < ActiveSupport::TestCase
include ActiveRecord::TestFixtures
self.fixture_path = "test/fixtures"
self.use_transactional_tests = true
fixtures :all

include Oaken::Data
include Oaken::Seeds
end

0 comments on commit 5fe85ab

Please sign in to comment.