1
- require 'rspec/expectations'
1
+ if Rails . env . test?
2
+ require 'rspec/expectations'
2
3
3
- # Validate the subject's class did call "acts_as_paranoid"
4
- RSpec ::Matchers . define :act_as_paranoid do
5
- match { |subject | subject . class . ancestors . include? ( Paranoia ) }
4
+ # Validate the subject's class did call "acts_as_paranoid"
5
+ RSpec ::Matchers . define :act_as_paranoid do
6
+ match { |subject | subject . class . ancestors . include? ( Paranoia ) }
6
7
7
- failure_message_proc = lambda do
8
- "expected #{ subject . class } to use `acts_as_paranoid`"
9
- end
8
+ failure_message_proc = lambda do
9
+ "expected #{ subject . class } to use `acts_as_paranoid`"
10
+ end
10
11
11
- failure_message_when_negated_proc = lambda do
12
- "expected #{ subject . class } not to use `acts_as_paranoid`"
13
- end
12
+ failure_message_when_negated_proc = lambda do
13
+ "expected #{ subject . class } not to use `acts_as_paranoid`"
14
+ end
14
15
15
- if respond_to? ( :failure_message_when_negated )
16
- failure_message ( &failure_message_proc )
17
- failure_message_when_negated ( &failure_message_when_negated_proc )
18
- else
19
- # RSpec 2 compatibility:
20
- failure_message_for_should ( &failure_message_proc )
21
- failure_message_for_should_not ( &failure_message_when_negated_proc )
16
+ if respond_to? ( :failure_message_when_negated )
17
+ failure_message ( &failure_message_proc )
18
+ failure_message_when_negated ( &failure_message_when_negated_proc )
19
+ else
20
+ # RSpec 2 compatibility:
21
+ failure_message_for_should ( &failure_message_proc )
22
+ failure_message_for_should_not ( &failure_message_when_negated_proc )
23
+ end
22
24
end
23
- end
25
+
26
+ end
0 commit comments