spec/woyo/world/group_spec.rb in woyo-world-0.0.8 vs spec/woyo/world/group_spec.rb in woyo-world-0.0.9

- old
+ new

@@ -29,16 +29,17 @@ it 'provides list of attribute names' do expect(@attributes.names).to eq [:test] end it 'registers attribute listeners' do - @attributes.add_attribute_listener :test, @listener + @attributes.add_listener :test, @listener end - it 'maintains list of attribute listeners' do + it 'maintains lists of attribute listeners' do expect(@attributes.listeners).to be_kind_of Hash - expect(@attributes.listeners[:test]).to be @listener + expect(@attributes.listeners[:test]).to be_kind_of Array + expect(@attributes.listeners[:test].first).to be @listener end it 'notifies listeners of attribute change' do expect(@listener.notified).to be false expect(@listener.attr).to be nil @@ -50,11 +51,11 @@ end it 'does not notify listener if attribute does not change' do @attributes[:test] = :same_value @listener = Listener.new - @attributes.add_attribute_listener :test, @listener + @attributes.add_listener :test, @listener expect(@listener.notified).to be false @attributes[:test] = :same_value expect(@listener.notified).to be false end @@ -94,10 +95,15 @@ it 'member values can be listed' do expect(@group.values).to eq %w( dumb bald smart ) end + it 'change tracking includes group as dependent'# do + # # simliar method as attributes with hash for value + # pending + # end + end describe Woyo::Attributes::Exclusion do before :all do @@ -114,11 +120,11 @@ expect(@group[:cold]).to be false end it 'registers as listener for attributes' do @group.members.each do |member| - expect(@group.attributes.listeners[member]).to be @group + expect(@group.attributes.listeners[member].first).to be @group end end it 'setting a member true changes the rest to false' do @group[:cold] = true @@ -157,7 +163,12 @@ @group[:warm] = true expect(@group.value).to eq :warm @group[:cold] = true expect(@group.value).to eq :cold end + + it 'change tracking includes group and other changed members as dependent'# do + # # simliar method as attributes with hash for value + # pending + # end end