spec/rspec/rails/matchers/be_valid_spec.rb in rspec-rails-2.99.0.beta1 vs spec/rspec/rails/matchers/be_valid_spec.rb in rspec-rails-2.99.0.beta2
- old
+ new
@@ -1,7 +1,6 @@
require "spec_helper"
-require 'active_support/all'
require 'rspec/rails/matchers/be_valid'
describe "be_valid matcher" do
include RSpec::Rails::Matchers
@@ -18,11 +17,11 @@
expect(post).to be_valid
}.to raise_exception(/Title can't be blank/)
end
it "includes a failure message for the negative case" do
- post.stub(:valid?) { true }
+ allow(post).to receive(:valid?) { true }
expect {
expect(post).not_to be_valid
}.to raise_exception(/expected .* not to be valid/)
end
@@ -31,14 +30,14 @@
expect(post).to be_valid, "Post was not valid!"
}.to raise_exception(/Post was not valid!/)
end
it "includes the validation context if provided" do
- post.should_receive(:valid?).with(:create) { true }
+ expect(post).to receive(:valid?).with(:create) { true }
expect(post).to be_valid(:create)
end
it "does not include the validation context if not provided" do
- post.should_receive(:valid?).with(no_args) { true }
+ expect(post).to receive(:valid?).with(no_args) { true }
expect(post).to be_valid
end
end