Sha256: 57535ad8fb89394fa41d751fec3ee1ea9258ee73a0ca371de40a54bcb0ef1d42

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

# Start simplecov instrumentation
require 'simplecov'
SimpleCov.start

# Set the environment variables for the test app
ENV[ 'RAILS_ENV' ] = 'test'
# ENV[ 'RAILS_ROOT' ] =

# Add the test app to the load path
$: << ENV[ 'EASTWOOD_RAILS_PATH' ]

# Require all dependencies
Bundler.require

# Boot the rails app
require 'config/environment'

# Require test dependencies *after* rails
require 'rspec/rails'
require 'shoulda'
require 'execjs'

# Define some helpers
module ResponseBodyHelper
  def the_response_body
    JSON.parse response.body, :symbolize_names => true
  end
end

# Configure RSpec
RSpec.configure do |config|
  # Use color
  config.color_enabled = true
  # Change the formatter
  config.formatter = :documentation
  # Include those helpers
  config.include ResponseBodyHelper
  # Reset Eastwood after each test
  config.after do
    Eastwood.reset!
  end
end

RSpec::Matchers.define :delegate do |method|
  match do |delegate|
    delegate.send method
  end
  chain :to do |receiver, method|
    @receiver, @method = receiver, method
    @receiver.should_receive( @method ){ true }
  end
  description do
    "delegate ##{method} to #{@receiver}##{@method}"
  end
  failure_message_for_should do |delegate|
    "expected that #{delegate}##{method} would delegate to #{@receiver}##{@method}"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eastwood-0.4.0 spec/spec_helper.rb
eastwood-0.3.8 spec/spec_helper.rb
eastwood-0.3.7 spec/spec_helper.rb
eastwood-0.3.5 spec/spec_helper.rb