Module: Pact::RSpec
- Defined in:
- lib/pact/rspec.rb
Class Method Summary collapse
- .color_enabled? ⇒ Boolean
- .formatter_class ⇒ Object
- .full_description(example) ⇒ Object
- .is_rspec_2 ⇒ Object
- .is_rspec_3 ⇒ Object
- .runner_defined? ⇒ Boolean
- .with_rspec_2 ⇒ Object
- .with_rspec_3 ⇒ Object
Class Method Details
.color_enabled? ⇒ Boolean
5 6 7 8 9 10 11 |
# File 'lib/pact/rspec.rb', line 5 def self.color_enabled? if ::RSpec.configuration.respond_to?(:color_enabled?) ::RSpec.configuration.color_enabled?(::RSpec.configuration.output_stream) else ::RSpec.configuration.color_enabled? end end |
.formatter_class ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/pact/rspec.rb', line 13 def self.formatter_class if ::RSpec::Core::Formatters.respond_to?(:register) require 'pact/provider/rspec/formatter_rspec_3' Pact::Provider::RSpec::Formatter else require 'pact/provider/rspec/formatter_rspec_2' Pact::Provider::RSpec::Formatter2 end end |
.full_description(example) ⇒ Object
23 24 25 |
# File 'lib/pact/rspec.rb', line 23 def self.full_description example example.respond_to?(:full_description) ? example.full_description : example.example.full_description end |
.is_rspec_2 ⇒ Object
35 36 37 |
# File 'lib/pact/rspec.rb', line 35 def self.is_rspec_2 defined?(::RSpec) && !is_rspec_3 end |
.is_rspec_3 ⇒ Object
31 32 33 |
# File 'lib/pact/rspec.rb', line 31 def self.is_rspec_3 defined?(::RSpec) && ::RSpec::Core::Formatters.respond_to?(:register) end |
.runner_defined? ⇒ Boolean
27 28 29 |
# File 'lib/pact/rspec.rb', line 27 def self.runner_defined? defined?(::RSpec::Core::Runner) end |
.with_rspec_2 ⇒ Object
45 46 47 48 49 |
# File 'lib/pact/rspec.rb', line 45 def self.with_rspec_2 if is_rspec_2 yield end end |
.with_rspec_3 ⇒ Object
39 40 41 42 43 |
# File 'lib/pact/rspec.rb', line 39 def self.with_rspec_3 if is_rspec_3 yield end end |