Module: Cuprum::Rails::RSpec::Matchers

Defined in:
lib/cuprum/rails/rspec/matchers.rb,
lib/cuprum/rails/rspec/matchers/be_a_result_matcher.rb

Overview

Namespace for custom RSpec matchers.

Defined Under Namespace

Classes: BeAResultMatcher

Instance Method Summary collapse

Instance Method Details

#be_a_failing_result(expected_class = nil) ⇒ Cuprum::Rails::RSpec::Matchers::BeAResultMatcher

Asserts that the object is a result with status: :failure.

Parameters:

  • expected_class (Class) (defaults to: nil)

    the expected class of result. Defaults to Cuprum::Result.

Returns:



18
19
20
# File 'lib/cuprum/rails/rspec/matchers.rb', line 18

def be_a_failing_result(expected_class = nil)
  be_a_result(expected_class).with_status(:failure)
end

#be_a_passing_result(expected_class = nil) ⇒ Cuprum::Rails::RSpec::Matchers::BeAResultMatcher

Asserts that the object is a Cuprum::Result with status: :success.

Parameters:

  • expected_class (Class) (defaults to: nil)

    the expected class of result. Defaults to Cuprum::Result.

Returns:



29
30
31
# File 'lib/cuprum/rails/rspec/matchers.rb', line 29

def be_a_passing_result(expected_class = nil)
  be_a_result(expected_class).with_status(:success).and_error(nil)
end

#be_a_result(expected_class = nil) ⇒ Cuprum::Rails::RSpec::Matchers::BeAResultMatcher

Asserts that the object is a Cuprum::Result.

Returns:



37
38
39
# File 'lib/cuprum/rails/rspec/matchers.rb', line 37

def be_a_result(expected_class = nil)
  Cuprum::Rails::RSpec::Matchers::BeAResultMatcher.new(expected_class)
end