Class: Remarkable::ActiveRecord::Matchers::HaveNamedScope
- Inherits:
-
Matcher::Base
- Object
- Matcher::Base
- Remarkable::ActiveRecord::Matchers::HaveNamedScope
- Defined in:
- lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(scope_call, *args) ⇒ HaveNamedScope
constructor
A new instance of HaveNamedScope.
- #matches?(subject) ⇒ Boolean
- #negative_failure_message ⇒ Object
Methods inherited from Matcher::Base
Methods included from Matcher::DSL
Constructor Details
#initialize(scope_call, *args) ⇒ HaveNamedScope
Returns a new instance of HaveNamedScope.
5 6 7 8 9 |
# File 'lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb', line 5 def initialize(scope_call, *args) @scope_opts = args. @scope_call = scope_call.to_s @args = args end |
Instance Method Details
#description ⇒ Object
20 21 22 |
# File 'lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb', line 20 def description "have to scope itself to #{@scope_opts.inspect} when #{@scope_call} is called" end |
#failure_message ⇒ Object
24 25 26 |
# File 'lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb', line 24 def "Expected #{expectation} (#{@missing})" end |
#matches?(subject) ⇒ Boolean
11 12 13 14 15 16 17 18 |
# File 'lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb', line 11 def matches?(subject) @subject = subject assert_matcher do @scope = eval("#{subject_class}.#{@scope_call}") return_scope_object? && end end |
#negative_failure_message ⇒ Object
28 29 30 |
# File 'lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb', line 28 def "Did not expect #{expectation}" end |