Class: UseLayout

Inherits:
Object
  • Object
show all
Defined in:
lib/objective_spec/matchers/use_layout_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ UseLayout

Returns a new instance of UseLayout.



4
5
6
# File 'lib/objective_spec/matchers/use_layout_matcher.rb', line 4

def initialize(expected)
  @expected = 'layouts/' + expected
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



2
3
4
# File 'lib/objective_spec/matchers/use_layout_matcher.rb', line 2

def actual
  @actual
end

#expectedObject (readonly)

Returns the value of attribute expected.



2
3
4
# File 'lib/objective_spec/matchers/use_layout_matcher.rb', line 2

def expected
  @expected
end

Instance Method Details

#failure_messageObject



13
14
15
# File 'lib/objective_spec/matchers/use_layout_matcher.rb', line 13

def failure_message
  return "use_layout expected #{@expected.inspect}, got #{@actual.inspect}"
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/objective_spec/matchers/use_layout_matcher.rb', line 8

def matches?(controller)
  @actual = controller.layout
  @actual == @expected
end

#negeative_failure_messageObject



17
18
19
# File 'lib/objective_spec/matchers/use_layout_matcher.rb', line 17

def negeative_failure_message
  return "use_layout expected #{@expected.inspect} not to equal #{@actual.inspect}"
end