diff --git a/lib/webrat.rb b/lib/webrat.rb index fbddb7c..f7f1a73 100644 --- a/lib/webrat.rb +++ b/lib/webrat.rb @@ -10,9 +10,4 @@ require "active_support" require File.dirname(__FILE__) + "/webrat/core" require File.dirname(__FILE__) + "/webrat/rails" if defined?(RAILS_ENV) - -if defined?(Merb) - require File.join(File.dirname(__FILE__), "boot_merb.rb") -else - require File.join(File.dirname(__FILE__), "boot_rails.rb") -end +require File.join(File.dirname(__FILE__), "boot_merb.rb") if defined?(Merb) diff --git a/lib/webrat/core/scope.rb b/lib/webrat/core/scope.rb index 3b96c12..891c298 100644 --- a/lib/webrat/core/scope.rb +++ b/lib/webrat/core/scope.rb @@ -82,12 +82,11 @@ module Webrat # along with the form. An optional content_type may be given. # # Example: -<<<<<<< HEAD:lib/webrat/core/scope.rb # attaches_file "Resume", "/path/to/the/resume.txt" # attaches_file "Photo", "/path/to/the/image.png", "image/png" def attaches_file(id_or_name_or_label, path, content_type = nil) find_field(id_or_name_or_label, FileField).set(path, content_type) -======= + end # save_and_open def save_and_open return unless File.exist?(Webrat.root + "/tmp") @@ -97,7 +96,6 @@ module Webrat f.write response.body end `open tmp/#{filename}` ->>>>>>> 300880db2f0d50a3e2d7b171eb9745cb50e1c534:lib/webrat/page.rb end alias_method :attach_file, :attaches_file diff --git a/spec/api/attaches_file_spec.rb b/spec/api/attaches_file_spec.rb index edf0e74..55e040f 100644 --- a/spec/api/attaches_file_spec.rb +++ b/spec/api/attaches_file_spec.rb @@ -1,5 +1,5 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") - +unless ENV["TEST_MODE"] == "merb" describe "attaches_file" do before do @session = Webrat::TestSession.new @@ -70,3 +70,4 @@ describe "attaches_file" do @session.clicks_button end end +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c4370c3..35403b0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,9 +5,11 @@ require "spec" begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end if ["rails","merb"].include?(ENV["TEST_MODE"]) - require File.join(File.dirname(__FILE__), "helper_#{ENV["TEST_MODE"]}.rb") + require File.join(File.dirname(__FILE__), "webrat", "#{ENV["TEST_MODE"]}", "helper.rb") else - raise "Please set the environment variable TEST_MODE to either 'rails' or 'merb'." + puts "Please set the environment variable TEST_MODE to either 'rails' or 'merb'." + $stdout.flush + exit 1 end require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat") diff --git a/spec/webrat/merb/helper.rb b/spec/webrat/merb/helper.rb new file mode 100644 index 0000000..8c79f95 --- /dev/null +++ b/spec/webrat/merb/helper.rb @@ -0,0 +1,11 @@ +require 'merb-core' +require 'merb_stories' +# module Merb +# module Test +# class RspecStory +# def flunk(message) +# raise message +# end +# end +# end +# end diff --git a/spec/webrat/rails/helper.rb b/spec/webrat/rails/helper.rb new file mode 100644 index 0000000..bde582b --- /dev/null +++ b/spec/webrat/rails/helper.rb @@ -0,0 +1,6 @@ +require "active_support" + +silence_warnings do + require "action_controller" + require "action_controller/integration" +end