Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Oaken::Data to Seeds #39

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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