Module: AvocadoFormatter

Defined in:
lib/avocado_formatter.rb,
lib/avocado_formatter/rspec3.rb

Defined Under Namespace

Classes: RSpec3

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cucumber2?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/avocado_formatter.rb', line 8

def cucumber2?
  defined?(::Cucumber) && ::Cucumber::VERSION >= '2.0.0'
end

.new(*args) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/avocado_formatter.rb', line 38

def self.new(*args)
  case args.size
  when 1 then
    if rspec3?
      RSpec3
    else
      RSpec
    end
  when 2 then Spec
  when 3 then Cucumber
  else
    raise ArgumentError
  end.new(*args)
end

.rspec3?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/avocado_formatter.rb', line 19

def rspec3?
  defined?(::RSpec::Core) && ::RSpec::Core::Version::STRING >= '3.0.0'
end

Instance Method Details

#initialize(runtime, path_or_io, options) ⇒ Object

Cucumber 2 detects the formatter API based on initialize arity



15
16
# File 'lib/avocado_formatter.rb', line 15

def initialize(runtime, path_or_io, options)
end