From 43763789d32aa3d39f3b7d20e8a8be0f82ecfba3 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Sun, 13 Aug 2023 01:21:32 +0200 Subject: [PATCH] Forgot to test that default attributes can be overriden --- test/oaken_test.rb | 6 +++++- test/seeds.rb | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/test/oaken_test.rb b/test/oaken_test.rb index 3f5c99f..ff15f8e 100644 --- a/test/oaken_test.rb +++ b/test/oaken_test.rb @@ -24,13 +24,17 @@ def test_accessing_fixture assert_equal [users.kasper, users.coworker], accounts.business.users end + def test_default_attributes_override + assert_equal "Big Business Co.", accounts.business.name + end + def test_default_attributes_last_into_test users.update :homer assert_equal [accounts.business], users.homer.accounts end def test_default_attributes_block - users.with accounts: [accounts.update(:home_co, name: "Yo")] do + users.with accounts: [accounts.update(:home_co)] do users.update :homer end assert_equal [accounts.home_co], users.homer.accounts diff --git a/test/seeds.rb b/test/seeds.rb index eb6ec17..5fb6a06 100644 --- a/test/seeds.rb +++ b/test/seeds.rb @@ -1,3 +1,4 @@ +accounts.with name: -> { id.to_s.humanize } accounts.update :business, name: "Big Business Co." users.with name: -> { id.to_s.capitalize }, accounts: [accounts.business]