diff --git a/test/automated/excluded_attributes/many.rb b/test/automated/excluded_attributes/many.rb index 9285ead..7ee37c6 100644 --- a/test/automated/excluded_attributes/many.rb +++ b/test/automated/excluded_attributes/many.rb @@ -2,24 +2,36 @@ context "Excluded Attributes" do context "Many" do - receiver = Controls::Object::New.example - source = Controls::Hash.example - - SetAttributes.(receiver, source, exclude: [ - :some_other_attribute, - :yet_another_attribute] - ) - - context "Excluded" do - test "Aren't set" do - assert(receiver.some_other_attribute.nil?) - assert(receiver.yet_another_attribute.nil?) - end - end + hash_source = Controls::Hash.example + object_source = Controls::Object.example + + mapping = hash_source.keys + + [[hash_source, 'Hash'], [object_source, 'Object']].each do |source_info| + + source = source_info[0] + source_type = source_info[1] + + context "#{source_type} Source" do + receiver = Controls::Object::New.example + + SetAttributes.(receiver, source, include: mapping, exclude: [ + :some_other_attribute, + :yet_another_attribute] + ) + + context "Excluded" do + test "Aren't set" do + assert(receiver.some_other_attribute.nil?) + assert(receiver.yet_another_attribute.nil?) + end + end - context "Not Excluded Attributes" do - test "Are set" do - assert(receiver.some_attribute == 'some value') + context "Not Excluded Attributes" do + test "Are set" do + assert(receiver.some_attribute == 'some value') + end + end end end end diff --git a/test/automated/excluded_attributes/one.rb b/test/automated/excluded_attributes/one.rb index fc1ad93..8300a85 100644 --- a/test/automated/excluded_attributes/one.rb +++ b/test/automated/excluded_attributes/one.rb @@ -2,21 +2,33 @@ context "Excluded Attributes" do context "One" do - receiver = Controls::Object::New.example - data = Controls::Hash.example + hash_source = Controls::Hash.example + object_source = Controls::Object.example - SetAttributes.(receiver, data, exclude: :some_other_attribute) + mapping = hash_source.keys - context "Excluded" do - test "Aren't set" do - assert(receiver.some_other_attribute.nil?) - end - end + [[hash_source, 'Hash'], [object_source, 'Object']].each do |source_info| + + source = source_info[0] + source_type = source_info[1] + + context "#{source_type} Source" do + receiver = Controls::Object::New.example + + SetAttributes.(receiver, source, include: mapping, exclude: :some_other_attribute) + + context "Excluded" do + test "Aren't set" do + assert(receiver.some_other_attribute.nil?) + end + end - context "Not Excluded Attributes" do - test "Are set" do - assert(receiver.some_attribute == 'some value') - assert(receiver.yet_another_attribute == 'yet another value') + context "Not Excluded Attributes" do + test "Are set" do + assert(receiver.some_attribute == 'some value') + assert(receiver.yet_another_attribute == 'yet another value') + end + end end end end