From 47560e55c52b92cd76c33a60d7fd3cd44c568c50 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Mon, 5 Aug 2013 14:10:31 +0000 Subject: [PATCH] Extract cucumber and aruba monkey patches --- features/support/env.rb | 41 --------------------- features/support/env_aruba.rb | 16 ++++++++ features/support/env_cucumber-doc_string.rb | 23 ++++++++++++ 3 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 features/support/env_aruba.rb create mode 100644 features/support/env_cucumber-doc_string.rb diff --git a/features/support/env.rb b/features/support/env.rb index dc82856..e69de29 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,41 +0,0 @@ -module Cucumber - class Runtime - alias :old_step_match :step_match - - def step_match(step_name, name_to_report = nil) - if step_name.include? ' must ' - name_to_report = step_name.dup - step_name.gsub! ' must ', ' should ' - end - - old_step_match(step_name, name_to_report) - end - end -end - -require 'aruba/cucumber' - - -require 'cucumber/formatter/pretty' - -module Cucumber - module Ast - class DocString - alias :old_initialize :initialize - - def initialize(string, content_type) - old_initialize(string + "\n", content_type) - end - end - end - - module Formatter - class Pretty - alias :old_doc_string :doc_string - - def doc_string(string) - old_doc_string(string.chomp) - end - end - end -end diff --git a/features/support/env_aruba.rb b/features/support/env_aruba.rb new file mode 100644 index 0000000..06d38ec --- /dev/null +++ b/features/support/env_aruba.rb @@ -0,0 +1,16 @@ +module Cucumber + class Runtime + alias :old_step_match :step_match + + def step_match(step_name, name_to_report = nil) + if step_name.include? ' must ' + name_to_report = step_name.dup + step_name.gsub! ' must ', ' should ' + end + + old_step_match(step_name, name_to_report) + end + end +end + +require 'aruba/cucumber' diff --git a/features/support/env_cucumber-doc_string.rb b/features/support/env_cucumber-doc_string.rb new file mode 100644 index 0000000..cddd21e --- /dev/null +++ b/features/support/env_cucumber-doc_string.rb @@ -0,0 +1,23 @@ +require 'cucumber/formatter/pretty' + +module Cucumber + module Ast + class DocString + alias :old_initialize :initialize + + def initialize(string, content_type) + old_initialize(string + "\n", content_type) + end + end + end + + module Formatter + class Pretty + alias :old_doc_string :doc_string + + def doc_string(string) + old_doc_string(string.chomp) + end + end + end +end