diff --git a/test/oaken_test.rb b/test/oaken_test.rb index 76dffef..4ce128e 100644 --- a/test/oaken_test.rb +++ b/test/oaken_test.rb @@ -15,6 +15,15 @@ def test_that_it_has_a_version_number refute_nil ::Oaken::VERSION end + def test_helper_methods + assert_equal 2, accounts.increment_counter # We start at 2 since the seeds file state should pass into here. + assert_equal 3, accounts.increment_counter + + assert_raise NoMethodError do + users.increment_counter + end + end + def test_fixture_yml_compatibility assert_equal "YAML", YamlRecord.first.name assert_equal accounts.business, YamlRecord.first.account diff --git a/test/seeds/accounts/business.rb b/test/seeds/accounts/business.rb index 0eed595..3f96740 100644 --- a/test/seeds/accounts/business.rb +++ b/test/seeds/accounts/business.rb @@ -1,4 +1,10 @@ business = accounts.update :business, name: "Big Business Co." +def accounts.increment_counter + @counter ||= 0 + @counter += 1 +end +accounts.increment_counter + users.update :kasper, name: "Kasper", accounts: [business] users.update :coworker, name: "Coworker", accounts: [business]