Lint: Fix RSpec/ExampleWording

This commit is contained in:
Jared Beck 2017-04-01 01:50:13 -04:00
parent 2246570dc3
commit af10cd4f00
17 changed files with 96 additions and 100 deletions

View File

@ -18,9 +18,6 @@ Style/FrozenStringLiteralComment:
RSpec/BeforeAfterAll:
Enabled: false
RSpec/ExampleWording:
Enabled: false
RSpec/ExampleLength:
Enabled: false

View File

@ -13,11 +13,11 @@ describe Boolit, type: :model do
before { subject.update_attributes!(name: FFaker::Name.name) }
it "should have versions" do
it "has two versions" do
expect(subject.versions.size).to eq(2)
end
it "should be able to be reified and persisted" do
it "can be reified and persisted" do
expect { subject.versions.last.reify.save! }.to_not raise_error
end
@ -28,7 +28,7 @@ describe Boolit, type: :model do
expect(Boolit.first).to be_nil
end
it "should still be able to be reified and persisted" do
it "still can be reified and persisted" do
expect { subject.paper_trail.previous_version.save! }.to_not raise_error
end
@ -40,7 +40,7 @@ describe Boolit, type: :model do
end
after { PaperTrail.serializer = PaperTrail::Serializers::YAML }
it "should not overwrite that attribute during the reification process" do
it "does not overwrite that attribute during the reification process" do
expect(subject.paper_trail.previous_version.name).to be_nil
end
end

View File

@ -4,13 +4,13 @@ describe CallbackModifier, type: :model do
with_versioning do
describe "callback-methods", versioning: true do
describe "paper_trail_on_destroy" do
it "should add :destroy to paper_trail_options[:on]" do
it "adds :destroy to paper_trail_options[:on]" do
modifier = NoArgDestroyModifier.create!(some_content: FFaker::Lorem.sentence)
expect(modifier.paper_trail_options[:on]).to eq [:destroy]
end
context "when :before" do
it "should create the version before destroy" do
it "creates the version before destroy" do
modifier = BeforeDestroyModifier.create!(some_content: FFaker::Lorem.sentence)
modifier.test_destroy
expect(modifier.versions.last.reify).not_to be_flagged_deleted
@ -18,7 +18,7 @@ describe CallbackModifier, type: :model do
end
context "when :after" do
it "should create the version after destroy" do
it "creates the version after destroy" do
modifier = AfterDestroyModifier.create!(some_content: FFaker::Lorem.sentence)
modifier.test_destroy
expect(modifier.versions.last.reify).to be_flagged_deleted
@ -26,7 +26,7 @@ describe CallbackModifier, type: :model do
end
context "when no argument" do
it "should default to before destroy" do
it "defaults to before destroy" do
modifier = NoArgDestroyModifier.create!(some_content: FFaker::Lorem.sentence)
modifier.test_destroy
expect(modifier.versions.last.reify).not_to be_flagged_deleted
@ -35,12 +35,12 @@ describe CallbackModifier, type: :model do
end
describe "paper_trail_on_update" do
it "should add :update to paper_trail_options[:on]" do
it "adds :update to paper_trail_options[:on]" do
modifier = UpdateModifier.create!(some_content: FFaker::Lorem.sentence)
expect(modifier.paper_trail_options[:on]).to eq [:update]
end
it "should create a version" do
it "creates a version" do
modifier = UpdateModifier.create!(some_content: FFaker::Lorem.sentence)
modifier.update_attributes! some_content: "modified"
expect(modifier.versions.last.event).to eq "update"
@ -48,36 +48,36 @@ describe CallbackModifier, type: :model do
end
describe "paper_trail_on_create" do
it "should add :create to paper_trail_options[:on]" do
it "adds :create to paper_trail_options[:on]" do
modifier = CreateModifier.create!(some_content: FFaker::Lorem.sentence)
expect(modifier.paper_trail_options[:on]).to eq [:create]
end
it "should create a version" do
it "creates a version" do
modifier = CreateModifier.create!(some_content: FFaker::Lorem.sentence)
expect(modifier.versions.last.event).to eq "create"
end
end
context "when no callback-method used" do
it "should set paper_trail_options[:on] to [:create, :update, :destroy]" do
it "sets paper_trail_options[:on] to [:create, :update, :destroy]" do
modifier = DefaultModifier.create!(some_content: FFaker::Lorem.sentence)
expect(modifier.paper_trail_options[:on]).to eq %i(create update destroy)
end
it "should default to track destroy" do
it "tracks destroy" do
modifier = DefaultModifier.create!(some_content: FFaker::Lorem.sentence)
modifier.destroy
expect(modifier.versions.last.event).to eq "destroy"
end
it "should default to track update" do
it "tracks update" do
modifier = DefaultModifier.create!(some_content: FFaker::Lorem.sentence)
modifier.update_attributes! some_content: "modified"
expect(modifier.versions.last.event).to eq "update"
end
it "should default to track create" do
it "tracks create" do
modifier = DefaultModifier.create!(some_content: FFaker::Lorem.sentence)
expect(modifier.versions.last.event).to eq "create"
end

View File

@ -6,15 +6,15 @@ describe Gadget, type: :model do
let(:gadget) { Gadget.create!(name: "Wrench", brand: "Acme") }
describe "updates", versioning: true do
it "should generate a version for updates to `name` attribute" do
it "generates a version for updates to `name` attribute" do
expect { gadget.update_attribute(:name, "Hammer") }.to(change { gadget.versions.size }.by(1))
end
it "should ignore for updates to `brand` attribute" do
it "ignores for updates to `brand` attribute" do
expect { gadget.update_attribute(:brand, "Stanley") }.to_not(change { gadget.versions.size })
end
it "should still generate a version when only the `updated_at` attribute is updated" do
it "still generates a version when only the `updated_at` attribute is updated" do
# Plus 1 second because MySQL lacks sub-second resolution
expect {
gadget.update_attribute(:updated_at, Time.now + 1)
@ -36,25 +36,25 @@ describe Gadget, type: :model do
before { subject.save! }
context "without update timestamps" do
it "should only acknowledge non-ignored attrs" do
it "only acknowledges non-ignored attrs" do
subject.name = "Wrench"
expect(subject.paper_trail.changed_notably?).to be true
end
it "should not acknowledge ignored attr (brand)" do
it "does not acknowledge ignored attr (brand)" do
subject.brand = "Acme"
expect(subject.paper_trail.changed_notably?).to be false
end
end
context "with update timestamps" do
it "should only acknowledge non-ignored attrs" do
it "only acknowledges non-ignored attrs" do
subject.name = "Wrench"
subject.updated_at = Time.now
expect(subject.paper_trail.changed_notably?).to be true
end
it "should not acknowledge ignored attrs and timestamps only" do
it "does not acknowledge ignored attrs and timestamps only" do
subject.brand = "Acme"
subject.updated_at = Time.now
expect(subject.paper_trail.changed_notably?).to be false

View File

@ -15,19 +15,19 @@ describe JoinedVersion, type: :model, versioning: true do
before { widget } # persist a widget
describe "#subsequent" do
it "shouldn't error out when there is a default_scope that joins" do
it "does not raise error when there is a default_scope that joins" do
JoinedVersion.subsequent(version).first
end
end
describe "#preceding" do
it "shouldn't error out when there is a default scope that joins" do
it "does not raise error when there is a default scope that joins" do
JoinedVersion.preceding(version).first
end
end
describe "#between" do
it "shouldn't error out when there is a default scope that joins" do
it "does not raise error when there is a default scope that joins" do
JoinedVersion.between(Time.now, 1.minute.from_now).first
end
end
@ -38,7 +38,7 @@ describe JoinedVersion, type: :model, versioning: true do
describe "#index" do
it { is_expected.to respond_to(:index) }
it "shouldn't error out when there is a default scope that joins" do
it "does not raise error when there is a default scope that joins" do
widget # persist a widget
version.index
end

View File

@ -3,16 +3,15 @@ require "rails_helper"
# The `json_versions` table tests postgres' `json` data type. So, that
# table is only created when testing against postgres and ActiveRecord >= 4.
if JsonVersion.table_exists?
describe JsonVersion, type: :model do
it "should include the `VersionConcern` module to get base functionality" do
expect(JsonVersion).to include(PaperTrail::VersionConcern)
RSpec.describe JsonVersion, type: :model do
it "includes the VersionConcern module" do
expect(described_class).to include(PaperTrail::VersionConcern)
end
describe "Methods" do
describe "Class" do
describe "#where_object" do
it { expect(JsonVersion).to respond_to(:where_object) }
it { expect(described_class).to respond_to(:where_object) }
it "escapes values" do
f = Fruit.create(name: "Bobby")
@ -25,9 +24,9 @@ if JsonVersion.table_exists?
end
context "invalid arguments" do
it "should raise an error" do
expect { JsonVersion.where_object(:foo) }.to raise_error(ArgumentError)
expect { JsonVersion.where_object([]) }.to raise_error(ArgumentError)
it "raises an error" do
expect { described_class.where_object(:foo) }.to raise_error(ArgumentError)
expect { described_class.where_object([]) }.to raise_error(ArgumentError)
end
end
@ -43,15 +42,15 @@ if JsonVersion.table_exists?
fruit.update_attributes!(name: fruit_names.sample, color: FFaker::Color.name)
end
it "should be able to locate versions according to their `object` contents" do
expect(JsonVersion.where_object(name: name)).to eq([fruit.versions[1]])
expect(JsonVersion.where_object(color: color)).to eq([fruit.versions[2]])
it "locates versions according to their `object` contents" do
expect(described_class.where_object(name: name)).to eq([fruit.versions[1]])
expect(described_class.where_object(color: color)).to eq([fruit.versions[2]])
end
end
end
describe "#where_object_changes" do
it { expect(JsonVersion).to respond_to(:where_object_changes) }
it { expect(described_class).to respond_to(:where_object_changes) }
it "escapes values" do
f = Fruit.create(name: "Bobby")
@ -64,9 +63,9 @@ if JsonVersion.table_exists?
end
context "invalid arguments" do
it "should raise an error" do
expect { JsonVersion.where_object_changes(:foo) }.to raise_error(ArgumentError)
expect { JsonVersion.where_object_changes([]) }.to raise_error(ArgumentError)
it "raises an error" do
expect { described_class.where_object_changes(:foo) }.to raise_error(ArgumentError)
expect { described_class.where_object_changes([]) }.to raise_error(ArgumentError)
end
end

View File

@ -4,7 +4,7 @@ describe NotOnUpdate, type: :model do
describe "#touch_with_version", versioning: true do
let!(:record) { described_class.create! }
it "should create a version, regardless" do
it "creates a version, regardless" do
expect { record.paper_trail.touch_with_version }.to change {
PaperTrail::Version.count
}.by(+1)

View File

@ -4,7 +4,7 @@ describe PostWithStatus, type: :model do
with_versioning do
let(:post) { described_class.create!(status: "draft") }
it "should stash the enum value properly in versions" do
it "saves the enum value in versions" do
post.published!
post.archived!
expect(post.paper_trail.previous_version.published?).to be true
@ -23,7 +23,7 @@ describe PostWithStatus, type: :model do
context "storing enum object_changes" do
subject { post.versions.last }
it "should stash the enum value properly in versions object_changes" do
it "saves the enum value properly in versions object_changes" do
post.published!
post.archived!
expect(subject.changeset["status"]).to eql %w(published archived)

View File

@ -9,7 +9,7 @@ describe Skipper, type: :model do
let(:t1) { Time.zone.local(2015, 7, 15, 20, 34, 0) }
let(:t2) { Time.zone.local(2015, 7, 15, 20, 34, 30) }
it "should not create a version" do
it "does not create a version" do
skipper = Skipper.create!(another_timestamp: t1)
expect {
skipper.update_attributes!(another_timestamp: t2)
@ -24,7 +24,7 @@ describe Skipper, type: :model do
let(:t2) { Time.zone.local(2015, 7, 15, 20, 34, 30) }
context "without preserve (default)" do
it "should have no timestamp" do
it "has no timestamp" do
skipper = Skipper.create!(another_timestamp: t1)
skipper.update_attributes!(another_timestamp: t2, name: "Foobar")
skipper = skipper.versions.last.reify
@ -33,7 +33,7 @@ describe Skipper, type: :model do
end
context "with preserve" do
it "should preserve its timestamp" do
it "preserves its timestamp" do
skipper = Skipper.create!(another_timestamp: t1)
skipper.update_attributes!(another_timestamp: t2, name: "Foobar")
skipper = skipper.versions.last.reify(unversioned_attributes: :preserve)

View File

@ -3,7 +3,7 @@ require "rails_helper"
describe Thing, type: :model do
it { is_expected.to be_versioned }
describe "should not store object_changes", versioning: true do
describe "does not store object_changes", versioning: true do
let(:thing) { Thing.create(name: "pencil") }
it { expect(thing.versions.last.object_changes).to be_nil }

View File

@ -1,7 +1,7 @@
require "rails_helper"
describe PaperTrail::Version, type: :model do
it "should include the `VersionConcern` module to get base functionality" do
it "includes the VersionConcern module" do
expect(PaperTrail::Version).to include(PaperTrail::VersionConcern)
end
@ -13,7 +13,7 @@ describe PaperTrail::Version, type: :model do
context "serializer is YAML" do
specify { expect(PaperTrail.serializer).to be PaperTrail::Serializers::YAML }
it "should store out as a plain hash" do
it "store out as a plain hash" do
expect(value =~ /HashWithIndifferentAccess/).to be_nil
end
end
@ -21,7 +21,7 @@ describe PaperTrail::Version, type: :model do
context "serializer is JSON" do
before(:all) { PaperTrail.serializer = PaperTrail::Serializers::JSON }
it "should store out as a plain hash" do
it "store out as a plain hash" do
expect(value =~ /HashWithIndifferentAccess/).to be_nil
end
@ -40,7 +40,7 @@ describe PaperTrail::Version, type: :model do
context "No previous versions" do
specify { expect(subject.previous).to be_nil }
it "should return nil" do
it "return nil" do
expect(subject.paper_trail_originator).to be_nil
end
end
@ -58,7 +58,7 @@ describe PaperTrail::Version, type: :model do
specify { expect(subject.previous).to be_instance_of(PaperTrail::Version) }
it "should return nil" do
it "return nil" do
expect(subject.paper_trail_originator).to eq(name)
end
end
@ -67,13 +67,13 @@ describe PaperTrail::Version, type: :model do
describe "#originator" do
it { is_expected.to respond_to(:originator) }
it "should set the invoke `paper_trail_originator`" do
it "sets the invoke `paper_trail_originator`" do
allow(ActiveSupport::Deprecation).to receive(:warn)
is_expected.to receive(:paper_trail_originator)
subject.originator
end
it "should display a deprecation warning" do
it "displays a deprecation warning" do
expect(ActiveSupport::Deprecation).to receive(:warn).
with(/Use paper_trail_originator instead of originator/)
subject.originator
@ -95,7 +95,7 @@ describe PaperTrail::Version, type: :model do
describe "#version_author" do
it { is_expected.to respond_to(:version_author) }
it "should be an alias for the `terminator` method" do
it "is an alias for the `terminator` method" do
expect(subject.method(:version_author)).to eq(subject.method(:terminator))
end
end
@ -136,7 +136,7 @@ describe PaperTrail::Version, type: :model do
it { expect(PaperTrail::Version).to respond_to(:where_object) }
context "invalid arguments" do
it "should raise an error" do
it "raises an error" do
expect {
PaperTrail::Version.where_object(:foo)
}.to raise_error(ArgumentError)
@ -162,7 +162,7 @@ describe PaperTrail::Version, type: :model do
expect(PaperTrail.serializer).to be PaperTrail::Serializers::YAML
end
it "should be able to locate versions according to their `object` contents" do
it "locates versions according to their `object` contents" do
expect(
PaperTrail::Version.where_object(name: name)
).to eq([widget.versions[1]])
@ -181,7 +181,7 @@ describe PaperTrail::Version, type: :model do
expect(PaperTrail.serializer).to be PaperTrail::Serializers::JSON
end
it "should be able to locate versions according to their `object` contents" do
it "locates versions according to their `object` contents" do
expect(
PaperTrail::Version.where_object(name: name)
).to eq([widget.versions[1]])
@ -199,7 +199,7 @@ describe PaperTrail::Version, type: :model do
describe "#where_object_changes" do
context "invalid arguments" do
it "should raise an error" do
it "raises an error" do
expect {
PaperTrail::Version.where_object_changes(:foo)
}.to raise_error(ArgumentError)

View File

@ -38,13 +38,13 @@ describe Widget, type: :model do
describe "versioning option" do
context "enabled", versioning: true do
it "should enable versioning" do
it "enables versioning" do
expect(widget.versions.size).to eq(1)
end
end
context "disabled (default)" do
it "should not enable versioning" do
it "does not enable versioning" do
expect(widget.versions.size).to eq(0)
end
end
@ -69,7 +69,7 @@ describe Widget, type: :model do
describe "after_create" do
let(:widget) { Widget.create!(name: "Foobar", created_at: Time.now - 1.week) }
it "corresponding version should use the widget's `updated_at`" do
it "corresponding version uses the widget's `updated_at`" do
expect(widget.versions.last.created_at.to_i).to eq(widget.updated_at.to_i)
end
end
@ -81,22 +81,22 @@ describe Widget, type: :model do
it { expect(subject.paper_trail).not_to be_live }
it "should clear the `versions_association_name` virtual attribute" do
it "clears the `versions_association_name` virtual attribute" do
subject.save!
expect(subject.paper_trail).to be_live
end
it "corresponding version should use the widget updated_at" do
it "corresponding version uses the widget updated_at" do
expect(widget.versions.last.created_at.to_i).to eq(widget.updated_at.to_i)
end
end
describe "after_destroy" do
it "should create a version for that event" do
it "creates a version for that event" do
expect { widget.destroy }.to change(widget.versions, :count).by(1)
end
it "should assign the version into the `versions_association_name`" do
it "assigns the version into the `versions_association_name`" do
expect(widget.version).to be_nil
widget.destroy
expect(widget.version).not_to be_nil
@ -134,7 +134,7 @@ describe Widget, type: :model do
describe "Association", versioning: true do
describe "sort order" do
it "should sort by the timestamp order from the `VersionConcern`" do
it "sorts by the timestamp order from the `VersionConcern`" do
expect(widget.versions.to_sql).to eq(
widget.versions.reorder(PaperTrail::Version.timestamp_sort_order).to_sql
)
@ -144,7 +144,7 @@ describe Widget, type: :model do
if defined?(ActiveRecord::IdentityMap) && ActiveRecord::IdentityMap.respond_to?(:without)
describe "IdentityMap", versioning: true do
it "should not clobber the IdentityMap when reifying" do
it "does not clobber the IdentityMap when reifying" do
widget.update_attributes name: "Henry", created_at: Time.now - 1.day
widget.update_attributes name: "Harry"
expect(ActiveRecord::IdentityMap).to receive(:without).once
@ -202,7 +202,7 @@ describe Widget, type: :model do
context "accessed from live model instance" do
specify { expect(widget.paper_trail).to be_live }
it "should return the originator for the model at a given state" do
it "returns the originator for the model at a given state" do
expect(widget.paper_trail.originator).to eq(orig_name)
widget.paper_trail.whodunnit(new_name) { |w|
w.update_attributes(name: "Elizabeth")
@ -221,11 +221,11 @@ describe Widget, type: :model do
context "default behavior (no `options[:dup]` option passed in)" do
let(:reified_widget) { widget.versions[1].reify }
it "should return the appropriate originator" do
it "returns the appropriate originator" do
expect(reified_widget.paper_trail.originator).to eq(orig_name)
end
it "should not create a new model instance" do
it "does not create a new model instance" do
expect(reified_widget).not_to be_new_record
end
end
@ -233,11 +233,11 @@ describe Widget, type: :model do
context "creating a new instance (`options[:dup] == true`)" do
let(:reified_widget) { widget.versions[1].reify(dup: true) }
it "should return the appropriate originator" do
it "returns the appropriate originator" do
expect(reified_widget.paper_trail.originator).to eq(orig_name)
end
it "should not create a new model instance" do
it "does not create a new model instance" do
expect(reified_widget).to be_new_record
end
end
@ -247,7 +247,7 @@ describe Widget, type: :model do
describe "#version_at" do
context "Timestamp argument is AFTER object has been destroyed" do
it "should return `nil`" do
it "returns nil" do
widget.update_attribute(:name, "foobar")
widget.destroy
expect(widget.paper_trail.version_at(Time.now)).to be_nil
@ -257,7 +257,7 @@ describe Widget, type: :model do
describe "#whodunnit" do
context "no block given" do
it "should raise an error" do
it "raises an error" do
expect {
widget.paper_trail.whodunnit("Ben")
}.to raise_error(ArgumentError, "expected to receive a block")
@ -273,7 +273,7 @@ describe Widget, type: :model do
expect(widget.versions.last.whodunnit).to eq(orig_name) # persist `widget`
end
it "should modify value of `PaperTrail.whodunnit` while executing the block" do
it "modifies value of `PaperTrail.whodunnit` while executing the block" do
widget.paper_trail.whodunnit(new_name) do
expect(PaperTrail.whodunnit).to eq(new_name)
widget.update_attributes(name: "Elizabeth")
@ -339,7 +339,7 @@ describe Widget, type: :model do
end
describe ".disable" do
it "should set the `paper_trail.enabled?` to `false`" do
it "sets the `paper_trail.enabled?` to `false`" do
expect(Widget.paper_trail.enabled?).to eq(true)
Widget.paper_trail.disable
expect(Widget.paper_trail.enabled?).to eq(false)
@ -347,7 +347,7 @@ describe Widget, type: :model do
end
describe ".enable" do
it "should set the `paper_trail.enabled?` to `true`" do
it "sets the `paper_trail.enabled?` to `true`" do
Widget.paper_trail.disable
expect(Widget.paper_trail.enabled?).to eq(false)
Widget.paper_trail.enable

View File

@ -4,13 +4,13 @@ describe PaperTrail, type: :module, versioning: true do
describe "#config" do
it { is_expected.to respond_to(:config) }
it "should allow for config values to be set" do
it "allows for config values to be set" do
expect(subject.config.enabled).to eq(true)
subject.config.enabled = false
expect(subject.config.enabled).to eq(false)
end
it "should accept blocks and yield the config instance" do
it "accepts blocks and yield the config instance" do
expect(subject.config.enabled).to eq(true)
subject.config { |c| c.enabled = false }
expect(subject.config.enabled).to eq(false)
@ -20,7 +20,7 @@ describe PaperTrail, type: :module, versioning: true do
describe "#configure" do
it { is_expected.to respond_to(:configure) }
it "should be an alias for the `config` method" do
it "is an alias for the `config` method" do
expect(subject.method(:configure)).to eq(subject.method(:config))
end
end

View File

@ -18,7 +18,7 @@ describe PaperTrail::VersionConcern do
end
describe "persistence", versioning: true do
it "should store versions in the correct corresponding db location" do
it "stores versions in the correct corresponding db location" do
foo_doc = Foo::Document.create!(name: "foobar")
bar_doc = Bar::Document.create!(name: "raboof")
expect(foo_doc.versions.first).to be_instance_of(Foo::Version)

View File

@ -3,7 +3,7 @@ require "spec_helper"
module PaperTrail
RSpec.describe VERSION do
describe "STRING" do
it "should join the numbers into a period separated string" do
it "joins the numbers into a period separated string" do
expect(described_class::STRING).to eq(
[
described_class::MAJOR,

View File

@ -21,11 +21,11 @@ RSpec.describe PaperTrail do
end
context "default" do
it "should have versioning off by default" do
it "has versioning off by default" do
expect(described_class).not_to be_enabled
end
it "should turn versioning on in a `with_versioning` block" do
it "has versioning on in a `with_versioning` block" do
expect(described_class).not_to be_enabled
with_versioning do
expect(described_class).to be_enabled
@ -34,7 +34,7 @@ RSpec.describe PaperTrail do
end
context "error within `with_versioning` block" do
it "should revert the value of `PaperTrail.enabled?` to it's previous state" do
it "reverts the value of `PaperTrail.enabled?` to its previous state" do
expect(described_class).not_to be_enabled
expect { with_versioning { raise } }.to raise_error(RuntimeError)
expect(described_class).not_to be_enabled
@ -43,11 +43,11 @@ RSpec.describe PaperTrail do
end
context "`versioning: true`", versioning: true do
it "should have versioning on by default" do
it "has versioning on by default" do
expect(described_class).to be_enabled
end
it "should keep versioning on after a with_versioning block" do
it "keeps versioning on after a with_versioning block" do
expect(described_class).to be_enabled
with_versioning do
expect(described_class).to be_enabled
@ -60,11 +60,11 @@ RSpec.describe PaperTrail do
it { expect(described_class).not_to be_enabled }
with_versioning do
it "should have versioning on by default" do
it "has versioning on by default" do
expect(described_class).to be_enabled
end
end
it "should not leak the `enabled?` state into successive tests" do
it "does not leak the `enabled?` state into successive tests" do
expect(described_class).not_to be_enabled
end
end
@ -77,7 +77,7 @@ RSpec.describe PaperTrail do
describe ".whodunnit" do
before(:all) { described_class.whodunnit = "foobar" }
it "should get set to `nil` by default" do
it "is nil by default" do
expect(described_class.whodunnit).to be_nil
end
end
@ -85,7 +85,7 @@ RSpec.describe PaperTrail do
describe ".controller_info" do
before(:all) { described_class.controller_info = { foo: "bar" } }
it "should get set to an empty hash before each test" do
it "is set to an empty hash before each test" do
expect(described_class.controller_info).to eq({})
end
end

View File

@ -6,14 +6,14 @@ describe "Articles management", type: :request, order: :defined do
context "versioning disabled" do
specify { expect(PaperTrail).not_to be_enabled }
it "should not create a version" do
it "does not create a version" do
expect(PaperTrail).to be_enabled_for_controller
expect {
post articles_path, params_wrapper(valid_params)
}.to_not change(PaperTrail::Version, :count)
end
it "should not leak the state of the `PaperTrail.enabled_for_controller?` into the next test" do
it "does not leak the state of the `PaperTrail.enabled_for_controller?` into the next test" do
expect(PaperTrail).to be_enabled_for_controller
end
end
@ -22,7 +22,7 @@ describe "Articles management", type: :request, order: :defined do
let(:article) { Article.last }
context "`current_user` method returns a `String`" do
it "should set that value as the `whodunnit`" do
it "sets that value as the `whodunnit`" do
expect {
post articles_path, params_wrapper(valid_params)
}.to change(PaperTrail::Version, :count).by(1)