Class: Shoulda::Matchers::Integrations::TestFrameworks::RspecExpectations

Inherits:
Object
  • Object
show all
Defined in:
lib/shoulda/matchers/integrations/test_frameworks/cucumber.rb

Instance Method Summary collapse

Instance Method Details

#include(*modules, **_options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/shoulda/matchers/integrations/test_frameworks/cucumber.rb', line 17

def include(*modules, **_options)
   ::RSpec::Matchers.send(:include, *modules)
rescue NameError
   if (require("rspec/expectations"))
      retry
   else
      raise_error
   end
rescue LoadError
   raise_error
end

#n_unit?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/shoulda/matchers/integrations/test_frameworks/cucumber.rb', line 29

def n_unit?
   false
end

#present?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/shoulda/matchers/integrations/test_frameworks/cucumber.rb', line 33

def present?
   true
end

#raise_errorObject

Raises:

  • (TestFrameworkNotFound)


37
38
39
40
41
42
43
44
# File 'lib/shoulda/matchers/integrations/test_frameworks/cucumber.rb', line 37

def raise_error
   raise TestFrameworkNotFound, <<-EOT
You have to include the 'rspec-expectations' gem to Gemfile, and add
the line before requiring the shoulda matchers:

require 'rspec/expectations'
EOT
end

#validate!Object



11
12
13
14
15
# File 'lib/shoulda/matchers/integrations/test_frameworks/cucumber.rb', line 11

def validate!
   return if defined?(::RSpec) && defined?(::RSpec::Matchers)

   raise_error
end