Skip to content

Commit

Permalink
Added test for change tracking on properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Nov 11, 2014
1 parent 9bfd6be commit fabc1cc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions spec/unit/attributes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,18 @@ class BarHistory3 < BarHistory2
expect(subject.duck).to eq ["Quack", "Peep"]
end

it "should be able to track change status" do
expect {
subject.fubar = ["Meow"]
}.to change { subject.fubar_changed? }.from(false).to(true)
context "change tracking" do
it "should work for delegated attributes" do
expect {
subject.fubar = ["Meow"]
}.to change { subject.fubar_changed? }.from(false).to(true)
end

it "should work for properties" do
expect {
subject.goose = ["honk!"]
}.to change { subject.goose_changed? }.from(false).to(true)
end
end

describe "array getters and setters" do
Expand Down

0 comments on commit fabc1cc

Please sign in to comment.