add step writer for undefined steps, cucumber automagicks
This commit is contained in:
parent
58ebd113ba
commit
6ed2459d61
@ -2,7 +2,7 @@ module Flowerbox
|
||||
module CoreExt
|
||||
module Module
|
||||
def find_constant(string)
|
||||
const_get(constants.find { |f| f.to_s.downcase == string.to_s.downcase })
|
||||
const_get(constants.find { |f| f.to_s.downcase == string.to_s.downcase.gsub('_', '') })
|
||||
end
|
||||
|
||||
def for(env)
|
||||
|
20
lib/flowerbox/reporter/step_writer.rb
Normal file
20
lib/flowerbox/reporter/step_writer.rb
Normal file
@ -0,0 +1,20 @@
|
||||
require 'flowerbox/reporter/base'
|
||||
|
||||
module Flowerbox::Reporter
|
||||
class StepWriter < Base
|
||||
def report_undefined(result)
|
||||
target = File.join(options[:target], result.step_type.downcase, result.original_name.strip.downcase.gsub(%r{[^\w]+}, '_')) + '.js'
|
||||
|
||||
if result.test_environment.primarily_coffeescript?
|
||||
target << '.coffee'
|
||||
end
|
||||
|
||||
if !File.file?(target)
|
||||
self.puts "Writing #{target}..."
|
||||
|
||||
File.open(target, 'wb') { |fh| fh.print result.test_environment.obtain_test_definition_for(result) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user