spec/models/widget_spec.rb in paper_trail-5.2.3 vs spec/models/widget_spec.rb in paper_trail-6.0.0

- old
+ new

@@ -12,17 +12,32 @@ widget.update_attributes!(name: "Leonard", an_integer: 1) widget.update_attributes!(name: "Tom") widget.update_attributes!(name: "Bob") end - it "is possible to do assertions on versions" do + it "is possible to do assertions on version attributes" do expect(widget).to have_a_version_with name: "Leonard", an_integer: 1 expect(widget).to have_a_version_with an_integer: 1 expect(widget).to have_a_version_with name: "Tom" end end + describe "`have_a_version_with_changes` matcher", versioning: true do + before do + widget.update_attributes!(name: "Leonard", an_integer: 2) + widget.update_attributes!(name: "Tom") + widget.update_attributes!(name: "Bob") + end + + it "is possible to do assertions on version changes" do + expect(widget).to have_a_version_with_changes name: "Leonard", an_integer: 2 + expect(widget).to have_a_version_with_changes an_integer: 2 + expect(widget).to have_a_version_with_changes name: "Tom" + expect(widget).to have_a_version_with_changes name: "Bob" + end + end + describe "versioning option" do context "enabled", versioning: true do it "should enable versioning" do expect(widget.versions.size).to eq(1) end @@ -236,11 +251,9 @@ end end end describe "#whodunnit" do - it { is_expected.to respond_to(:whodunnit) } - context "no block given" do it "should raise an error" do expect { widget.paper_trail.whodunnit("Ben") }.to raise_error(ArgumentError, "expected to receive a block")