Class: Liquid::Rails::Rspec::DropMatchers::ScopeMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/liquid4-rails/rspec/drop_matchers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ScopeMatcher

Returns a new instance of ScopeMatcher.



126
127
128
# File 'lib/liquid4-rails/rspec/drop_matchers.rb', line 126

def initialize(name)
  @name = name
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



124
125
126
# File 'lib/liquid4-rails/rspec/drop_matchers.rb', line 124

def actual
  @actual
end

#nameObject (readonly)

Returns the value of attribute name.



124
125
126
# File 'lib/liquid4-rails/rspec/drop_matchers.rb', line 124

def name
  @name
end

Instance Method Details

#descriptionObject



136
137
138
# File 'lib/liquid4-rails/rspec/drop_matchers.rb', line 136

def description
  "have scope #{name}"
end

#failure_messageObject



140
141
142
# File 'lib/liquid4-rails/rspec/drop_matchers.rb', line 140

def failure_message
  %Q{expected #{actual.inspect} to define "#{name}" as scope}
end

#failure_message_when_negatedObject



144
145
146
# File 'lib/liquid4-rails/rspec/drop_matchers.rb', line 144

def failure_message_when_negated
  %Q{expected #{actual.inspect} not to define "#{name}" as scope}
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


130
131
132
133
134
# File 'lib/liquid4-rails/rspec/drop_matchers.rb', line 130

def matches?(actual)
  @actual = actual

  scopes.include?(name)
end