kevinrood / teamcity_formatter

TeamCity cucumber output formatter
Apache License 2.0
5 stars 8 forks source link

load error #1

Closed ailjushkin closed 8 years ago

ailjushkin commented 8 years ago
cannot load such file -- team_city_formatter/formatter
Error creating formatter: TeamCityFormatter::Formatter (LoadError)

cucumber ... --expand -f TeamCityFormatter::Formatter ...

Seems Like the problem is in class name and file name

Camel case replaced with _ when searching file.

Then, TeamCityFormatter::Formatter is going to be replaced on team_city_formatter, meanwhile your path is teamcity_formatter/formatter

kevinrood commented 8 years ago

Are you using the gem with bundler and letting it automatically require the gem?

ailjushkin commented 8 years ago

@kevinrood i'm using bundler and requesting formatter passing argument in console: -f TeamCityFormatter::Formatter

Seems like, cucumber has its own plan to search for the passed formatter:

  1. in gem paths
  2. then in features/support

So it translates formatter name into the path to class file (this exception proves it).

Using cucumber 2.0.2

@kevinrood and as you can see I've added pull request fixing this issue...

kevinrood commented 8 years ago

@PositiveAlex first of all - thank you very much for the feedback on the gem and the pull request!

I've been doing some experimenting with a project which uses this gem. I don't believe bundler is handling the require for you. I was careful when naming the gem to make sure it follows the rubygem recommendations. Originally in my project I was manually requiring the gem's main file require 'teamcity_formatter'. I switched the project to use bundler's facility for automatically loading the gem (in my features/support/env.rb file):

require 'bundler'
Bundler.require

Are you already using this approach in your project?

kevinrood commented 8 years ago

@PositiveAlex allowing bundler to require the gem's main file as described above worked for me - the formatter was loaded and available for use by cucumber when called with the -f command line argument.

ailjushkin commented 8 years ago

@kevinrood thanks, I need time to test this approach on my project. And i'm glad to work together :)

ailjushkin commented 8 years ago

@kevinrood Pull request update: I renamed main rb file to it's original name. this can allow to require it manually as it was, require through bundler and in my case - not doing anything, just use cucumbers method -f without require in env.rb: all tree cases are ok then.