File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,8 @@ def unmatched_attributes
61
61
end
62
62
63
63
# @api public
64
- # Passes if actual is an instance of `model_class` and returns `false ` for
65
- # `persisted ?`. Typically used to specify instance variables assigned to
64
+ # Passes if actual is an instance of `model_class` and returns `true ` for
65
+ # `new_record ?`. Typically used to specify instance variables assigned to
66
66
# views by controller actions
67
67
#
68
68
# Use the `with` method to specify the specific attributes to match on the
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Matchers
4
4
# @private
5
5
class BeANewRecord < RSpec ::Matchers ::BuiltIn ::BaseMatcher
6
6
def matches? ( actual )
7
- ! actual . persisted ?
7
+ actual . new_record ?
8
8
end
9
9
10
10
def failure_message
@@ -17,7 +17,7 @@ def failure_message_when_negated
17
17
end
18
18
19
19
# @api public
20
- # Passes if actual returns `false ` for `persisted ?`.
20
+ # Passes if actual returns `true ` for `new_record ?`.
21
21
#
22
22
# @example
23
23
# get :new
Original file line number Diff line number Diff line change 1
1
require "spec_helper"
2
2
3
3
describe "be_new_record" do
4
- context "un-persisted record" do
5
- let ( :record ) { double ( 'record' , :persisted ? => false ) }
4
+ context "a new record" do
5
+ let ( :record ) { double ( 'record' , :new_record ? => true ) }
6
6
7
7
it "passes" do
8
8
expect ( record ) . to be_new_record
15
15
end
16
16
end
17
17
18
- context "persisted record" do
19
- let ( :record ) { double ( 'record' , :persisted ? => true ) }
18
+ context "a persisted record" do
19
+ let ( :record ) { double ( 'record' , :new_record ? => false ) }
20
20
21
21
it "fails" do
22
22
expect ( record ) . not_to be_new_record
You can’t perform that action at this time.
0 commit comments