Skip to content

Instantly share code, notes, and snippets.

@Circuit8
Created August 16, 2016 10:26
Show Gist options
  • Save Circuit8/a46d85655c36831ab92e1bedec375b28 to your computer and use it in GitHub Desktop.
Save Circuit8/a46d85655c36831ab92e1bedec375b28 to your computer and use it in GitHub Desktop.
Error when I run `bundle exec rspec`. Works fine with bundle exec guard.
bundler: failed to load command: rspec (/home/joshua/.rbenv/versions/2.3.0/bin/rspec)
RuntimeError: missing run or map statement
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:146:in `to_app'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:160:in `block in generate_map'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:160:in `each'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:160:in `generate_map'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:145:in `to_app'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/capybara-2.7.1/lib/capybara/rails.rb:13:in `<top (required)>'
/home/joshua/Programs/Ruby/Rails/fitness-members/spec/spec_helper.rb:2:in `require'
/home/joshua/Programs/Ruby/Rails/fitness-members/spec/spec_helper.rb:2:in `<top (required)>'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/configuration.rb:1394:in `require'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/configuration.rb:1394:in `block in requires='
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/configuration.rb:1394:in `each'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/configuration.rb:1394:in `requires='
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/configuration_options.rb:112:in `block in process_options_into'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/configuration_options.rb:111:in `each'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/configuration_options.rb:111:in `process_options_into'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/configuration_options.rb:21:in `configure'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/runner.rb:99:in `setup'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/runner.rb:86:in `run'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/runner.rb:71:in `run'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/lib/rspec/core/runner.rb:45:in `invoke'
/home/joshua/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.1/exe/rspec:4:in `<top (required)>'
/home/joshua/.rbenv/versions/2.3.0/bin/rspec:23:in `load'
/home/joshua/.rbenv/versions/2.3.0/bin/rspec:23:in `<top (required)>'
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
## Note: if you are using the `directories` clause above and you are not
## watching the project directory ('.'), then you will want to move
## the Guardfile to a watched dir and symlink it back, e.g.
#
# $ mkdir config
# $ mv Guardfile config/
# $ ln -s config/Guardfile .
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
# Note: The cmd option is now required due to the increasing number of ways
# rspec may be run, below are examples of the most common uses.
# * bundler: 'bundle exec rspec'
# * bundler binstubs: 'bin/rspec'
# * spring: 'bin/rspec' (This will use spring if running and you have
# installed the spring binstubs per the docs)
# * zeus: 'zeus rspec' (requires the server to be started separately)
# * 'just' rspec: 'rspec'
guard :rspec, cmd: "spring rspec" do
require "guard/rspec/dsl"
dsl = Guard::RSpec::Dsl.new(self)
# Feel free to open issues for suggestions and improvements
# RSpec files
rspec = dsl.rspec
watch(rspec.spec_helper) { rspec.spec_dir }
watch(rspec.spec_support) { rspec.spec_dir }
watch(rspec.spec_files)
# Ruby files
ruby = dsl.ruby
dsl.watch_spec_files_for(ruby.lib_files)
# Rails files
rails = dsl.rails(view_extensions: %w(erb haml slim))
dsl.watch_spec_files_for(rails.app_files)
dsl.watch_spec_files_for(rails.views)
watch(rails.controllers) do |m|
[
rspec.spec.call("routing/#{m[1]}_routing"),
rspec.spec.call("controllers/#{m[1]}_controller"),
rspec.spec.call("acceptance/#{m[1]}")
]
end
# Rails config changes
watch(rails.spec_helper) { rspec.spec_dir }
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
# Capybara features specs
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
end
end
require 'simplecov'
SimpleCov.start 'rails'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
Dir[Rails.root.join("app/**/*.rb")].each {|f| require f}
ActiveRecord::Migration.maintain_test_schema!
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
VCR.configure do |c|
c.cassette_library_dir = 'spec/vcr'
c.hook_into :webmock
c.allow_http_connections_when_no_cassette = true
end
RSpec.configure do |config|
# Ensure that if we are running js tests, we are using latest webpack assets
# This will use the defaults of :js and :server_rendering meta tags
ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, :js => true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
end
require 'factory_girl_rails'
require 'capybara/rails'
require 'capybara/rspec'
require 'paperclip/matchers'
Dir[Rails.root.join("spec/support/**/*.rb")].each{ |file| require file }
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
Capybara.javascript_driver = :webkit
Capybara::Webkit.configure do |config|
config.allow_url("player.vimeo.com")
end
config.include ActiveJob::TestHelper
config.include FactoryGirl::Syntax::Methods
config.include VCR::RSpec::Macros
config.include FontAwesome::Rails::IconHelper
config.include Paperclip::Shoulda::Matchers
config.include Requests::JsonHelpers, type: :request
config.include FeatureHelpers, type: :feature
end
@Shekharrajak
Copy link

Shekharrajak commented Aug 3, 2017

Is the error fixed now ? @Circuit8 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment