tpope/fivemat

fivemat.rb:12:in `new': ArgumentError (ArgumentError)

Closed this issue · 7 comments

Hello, I'm trying to implement this in my rails 2 app,
So, I've changed the .rspec, cucumber.yml, Gemfile,
Cucumber tests works fine, but I'm getting an error with Rspec.

$ bundle exec rake:

/Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/fivemat-1.0.0/lib/fivemat.rb:12:in `new': ArgumentError (ArgumentError)
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/options.rb:247:in `load_formatters'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/options.rb:240:in `map'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/options.rb:240:in `load_formatters'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/options.rb:236:in `formatters'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/reporter.rb:111:in `formatters'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/reporter.rb:50:in `start'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:32:in `prepare'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:20:in `run'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/options.rb:153:in `run_examples'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/command_line.rb:9:in `run'
  from /Users/mariozaizar/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/bin/spec:5
rake aborted!

So, looking at the code:

module Fivemat
  autoload :Cucumber, 'fivemat/cucumber'
  autoload :MiniTest, 'fivemat/minitest/unit'
  autoload :RSpec, 'fivemat/rspec'

  def self.new(*args)
    case args.size
    when 0 then MiniTest::Unit
    when 1 then RSpec
    when 3 then Cucumber
    else
      raise ArgumentError
    end.new(*args)
  end
end

Seems like it wasn't hitting rspec.
Does this works with rspec prior to 2?
I'm using 1.3.2

As it stands now it's RSpec 2 only. It probably would be pretty easy to write an RSpec 1 formatter, but I haven't tried.

@mariozaizar I wrote an RSpec 1 formatter you can try in issue #6.

Great! it works, please accept @cgriego 's pull request.

Okie dokie.

Please update the gem with this new code.

Released.