spec/spec_helper.rb in washout_builder-0.10.3 vs spec/spec_helper.rb in washout_builder-0.10.4

- old
+ new

@@ -19,18 +19,41 @@ require 'rspec/autorun' require "pry" require "savon" require 'wash_out' +require 'capybara/rspec' +require 'capybara/rails' +require 'capybara/firebug/rspec' +require 'forgery/forgery' +require 'webmock/rspec' +require 'headless' + Rails.backtrace_cleaner.remove_silencers! # Load support files Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } RSpec.configure do |config| require 'rspec/expectations' config.include RSpec::Matchers + + # mock framework + # config.mock_with :mocha + + #config.include Savon::Spec::Macros + #config.include AbstractController::Translation + + config.before(:suite) do + # Reload factories in spec/factories. + FactoryGirl.reload + # Blocks all remote HTTP requests by default, they need to be stubbed. + WebMock.disable_net_connect!(:allow_localhost => true) + if !RUBY_PLATFORM.downcase.include?('darwin') && !ENV['NO_HEADLESS'] + Headless.new(reuse: false, destroy_on_exit: false).start + end + end config.mock_with :rspec config.before(:all) do WashoutBuilder::Engine.config.wash_out = { snakecase_input: false, @@ -60,13 +83,13 @@ def mock_controller(options = {}, &block) Object.send :remove_const, :ApiController if defined?(ApiController) Object.send :const_set, :ApiController, Class.new(ApplicationController) { soap_service options.reverse_merge({ - snakecase_input: true, - camelize_wsdl: true, - namespace: false - }) + snakecase_input: true, + camelize_wsdl: true, + namespace: false + }) class_exec &block if block } ActiveSupport::Dependencies::Reference.instance_variable_get(:'@store').delete('ApiController') end