class Merb::Test::Rspec::ControllerMatchers::Provide

Public Class Methods

new(expected) click to toggle source

Parameters

expected<Symbol>

A format to check

# File lib/merb-core/test/matchers/controller_matchers.rb, line 63
def initialize(expected)
  @expected = expected
end

Public Instance Methods

failure_message() click to toggle source

Returns

String

The failure message.

# File lib/merb-core/test/matchers/controller_matchers.rb, line 80
def failure_message
  "expected #{@target.name} to provide #{@expected}, but it doesn't"
end
matches?(target) click to toggle source

Parameters

target<Symbol>

A ControllerClass or controller_instance

Returns

Boolean

True if the formats provided by the target controller/class include the expected

# File lib/merb-core/test/matchers/controller_matchers.rb, line 73
def matches?(target)
  @target = target
  provided_formats.include?( @expected )
end
negative_failure_message() click to toggle source

Returns

String

The failure message to be displayed in negative matches.

# File lib/merb-core/test/matchers/controller_matchers.rb, line 86
def negative_failure_message
  "expected #{@target.name} not to provide #{@expected}, but it does"
end
provided_formats() click to toggle source

Returns

Array

The formats the expected provides

# File lib/merb-core/test/matchers/controller_matchers.rb, line 92
def provided_formats
  @target.class_provided_formats
end