Closed ailjushkin closed 8 years ago
Are you using the gem with bundler and letting it automatically require the gem?
@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:
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...
@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?
@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.
@kevinrood thanks, I need time to test this approach on my project. And i'm glad to work together :)
@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.
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 onteam_city_formatter
, meanwhile your path isteamcity_formatter/formatter