Class: RSpec::ActiveRecord::Expectations::MessageBuilder::QueryPhrases
- Inherits:
-
Object
- Object
- RSpec::ActiveRecord::Expectations::MessageBuilder::QueryPhrases
- Defined in:
- lib/rspec/activerecord/expectations/message_builder.rb
Instance Attribute Summary collapse
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Instance Method Summary collapse
-
#initialize(matcher) ⇒ QueryPhrases
constructor
A new instance of QueryPhrases.
-
#negative_suffix ⇒ Object
using positive suffix from above can cause double negatives.
- #prefix ⇒ Object
- #suffix ⇒ Object
Constructor Details
#initialize(matcher) ⇒ QueryPhrases
Returns a new instance of QueryPhrases.
31 32 33 |
# File 'lib/rspec/activerecord/expectations/message_builder.rb', line 31 def initialize(matcher) @matcher = matcher end |
Instance Attribute Details
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
29 30 31 |
# File 'lib/rspec/activerecord/expectations/message_builder.rb', line 29 def matcher @matcher end |
Instance Method Details
#negative_suffix ⇒ Object
using positive suffix from above can cause double negatives
50 51 52 53 54 55 56 57 58 |
# File 'lib/rspec/activerecord/expectations/message_builder.rb', line 50 def negative_suffix if matcher.comparison == :exactly "did so" elsif matcher.actual_count == 1 "executed one" else "executed #{matcher.actual_count}" end end |
#prefix ⇒ Object
35 36 37 |
# File 'lib/rspec/activerecord/expectations/message_builder.rb', line 35 def prefix "execute #{comparison_phrase} #{query_type_name}" end |
#suffix ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/rspec/activerecord/expectations/message_builder.rb', line 39 def suffix if matcher.actual_count == 0 "didn't execute any" elsif matcher.actual_count == 1 "executed one" else "executed #{matcher.actual_count}" end end |