lib/cucumber/rb_support/rb_language.rb in cucumber-1.3.11 vs lib/cucumber/rb_support/rb_language.rb in cucumber-1.3.12

- old
+ new

@@ -3,23 +3,12 @@ require 'cucumber/rb_support/rb_world' require 'cucumber/rb_support/rb_step_definition' require 'cucumber/rb_support/rb_hook' require 'cucumber/rb_support/rb_transform' require 'cucumber/rb_support/snippet' +require 'multi_test' -begin - require 'rspec/expectations' -rescue LoadError - begin - require 'spec/expectations' - require 'spec/runner/differs/default' - require 'ostruct' - rescue LoadError - require 'test/unit/assertions' - end -end - module Cucumber module RbSupport # Raised if a World block returns Nil. class NilWorld < StandardError def initialize @@ -54,28 +43,12 @@ def initialize(runtime) @runtime = runtime @step_definitions = [] RbDsl.rb_language = self @world_proc = @world_modules = nil - @assertions_module = find_best_assertions_module end - def find_best_assertions_module - begin - ::RSpec::Matchers - rescue NameError - # RSpec >=1.2.4 - begin - options = OpenStruct.new(:diff_format => :unified, :context_lines => 3) - Spec::Expectations.differ = Spec::Expectations::Differs::Default.new(options) - ::Spec::Matchers - rescue NameError - ::Test::Unit::Assertions - end - end - end - def step_matches(name_to_match, name_to_format) @step_definitions.map do |step_definition| if(arguments = step_definition.arguments_from(name_to_match)) StepMatch.new(step_definition, name_to_match, name_to_format, arguments) else @@ -143,10 +116,10 @@ end end def extend_world @current_world.extend(RbWorld) - @current_world.extend(@assertions_module) + MultiTest.extend_with_best_assertion_library(@current_world) (@world_modules || []).each do |mod| @current_world.extend(mod) end end