Hi, I am trying to upgrade RSpec for one of my projects from 2.12 to 2.14(in order to move to the latest one eventually) and facing an issue with regards to RSpec command delegating command-line options to another loader process on 2.14.
Attaching Gemfile-2.12(before) and Gemfile-2.14(after), spec/stripe_spec_helper.rb and spec/spec_helper.rb. This is the command that I run on the feature branch which has rspec-rails 2.14 and on master: $ RAILS_ENV=test bundle exec rspec --format documentation --format RspecJunitFormatter --out rspec_results/rspec_result.xml --format html --out rspec_results/rspec_result.html Here is the error message (Note that the command is working on master branch): /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/dante-0.2.0/lib/dante/runner.rb:212:in > `parse_options': invalid option: -X (OptionParser::InvalidOption) > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/dante-0.2.0/lib/dante/runner.rb:50:in > `execute' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/stripe-ruby-mock-2.5.0/lib/stripe_mock/api/server.rb:18:in > `spawn_server' > from > /Users/surya/projects/my_rails_application/spec/stripe_spec_helper.rb:2:in > `<top (required)>' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/activesupport-4.1.15/lib/active_support/dependencies.rb:247:in > `require' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/activesupport-4.1.15/lib/active_support/dependencies.rb:247:in > `block in require' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/activesupport-4.1.15/lib/active_support/dependencies.rb:232:in > `load_dependency' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/activesupport-4.1.15/lib/active_support/dependencies.rb:247:in > `require' > from > /Users/surya/projects/my_rails_application/spec/models/group_spec.rb:4:in > `block in <top (required)>' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in > `module_eval' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in > `subclass' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in > `describe' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/dsl.rb:18:in > `describe' > from > /Users/surya/projects/my_rails_application/spec/models/group_spec.rb:3:in > `<top (required)>' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/activesupport-4.1.15/lib/active_support/dependencies.rb:241:in > `load' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/activesupport-4.1.15/lib/active_support/dependencies.rb:241:in > `block in load' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/activesupport-4.1.15/lib/active_support/dependencies.rb:232:in > `load_dependency' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/activesupport-4.1.15/lib/active_support/dependencies.rb:241:in > `load' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in > `block in load_spec_files' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in > `each' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in > `load_spec_files' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in > `run' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:77:in > `rescue in run' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:73:in > `run' > from > /Users/surya/.rvm/gems/ruby-2.2.5@my-gemset/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in > `block in autorun' > Coverage report generated for RSpec to > /Users/surya/projects/my_rails_application/coverage. 10134 / 57425 LOC > (17.65%) covered. > Coverage report generated for RSpec to > /Users/surya/projects/my_rails_application/coverage/coverage.json. 10134 / > 57425 LOC (17.65%) covered. > Coverage report Rcov style generated for RSpec to > /Users/surya/projects/my_rails_application/coverage/rcov Any ideas as to why RSpec runner delegates the options to stripe mock server on rspec-rails 2.14 but not on 2.12? -- Please consider the environment before printing this email. Regards, Surya -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/CAHGOqz7xPB8Hj%3D1VX7mS3i9EtaqQqtPfTzSshY4VqFsgEhrvsw%40mail.gmail.com.
Gemfile-2.12
Description: Binary data
Gemfile-2.14
Description: Binary data
require 'spork'
require 'faker'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'database_cleaner'
require 'webmock/rspec'
require 'rspec_candy/all'
require 'sidekiq/testing'
Sidekiq::Testing.fake!
Sidekiq::Logging.logger = nil
OmniAuth.config.test_mode = true
omniauth_hash = {
"provider" => "google_oauth2",
"uid" => "123456789",
"info" => {
"name" => Faker::Name.name,
"email" => Faker::Name.first_name+"@test.com",
"first_name" => Faker::Name.first_name,
"last_name" => Faker::Name.last_name
},
"credentials" => {
"token" => Faker::Lorem.characters(10),
"refresh_token" => Faker::Lorem.characters(10)
}
}
OmniAuth.config.add_mock(:google_oauth2, omniauth_hash)
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each) do
DatabaseCleaner.start
end
config.before(:each) do
DEFAULT_REDIS_CLIENT.flushdb
end
config.after(:each) do
DatabaseCleaner.clean
end
config.include Devise::TestHelpers, :type => :controller
config.include Devise::TestHelpers, :type => :helper
config.include RequestHelpers, type: :request
config.include AuthHelper, type: :request
end
end
Spork.each_run do
# This code will be run each time you run your specs.
WebMock.allow_net_connect!(:net_http_connect_on_start => true)
end
# --- Instructions ---
# Sort the contents of this file into a Spork.prefork and a Spork.each_run
# block.
#
# The Spork.prefork block is run only once when the spork server is started.
# You typically want to place most of your (slow) initializer code in here, in
# particular, require'ing any 3rd-party gems that you don't normally modify
# during development.
#
# The Spork.each_run block is run each time you run your specs. In case you
# need to load files that tend to change during development, require them here.
# With Rails, your application modules are loaded automatically, so sometimes
# this block can remain empty.
#
# Note: You can modify files loaded *from* the Spork.each_run block without
# restarting the spork server. However, this file itself will not be reloaded,
# so if you change any of the code inside the each_run block, you still need to
# restart the server. In general, if you have non-trivial code in this file,
# it's advisable to move it into a separate file so you can easily edit it
# without restarting spork. (For example, with RSpec, you could move
# non-trivial code into a file spec/support/my_helper.rb, making sure that the
# spec/support/* files are require'd from inside the each_run block.)
#
# Any code that is left outside the two blocks will be run during preforking
# *and* during each_run -- that's probably not what you want.
#
# These instructions should self-destruct in 10 seconds. If they don't, feel
# free to delete them.
require 'stripe_mock'
StripeMock.spawn_server
RSpec.configure do |config|
config.before(:suite) do
$stripe_client = StripeMock.start_client
Stripe::Plan.create(
:amount => 0,
:interval => "year",
:name => "Annual Subscription",
:currency => "inr",
:id => "annual"
)
Stripe::Plan.create(
:amount => 0,
:interval => "month",
:name => "Monthly Subscription",
:currency => "inr",
:id => "monthly"
)
end
config.after(:suite) do
StripeMock.stop_client(:clear_server_data => true)
end
config.before(:each) do
@stripe_helper = StripeMock.create_test_helper
Zuora::ApiClient.stub(:create_account).and_return(true)
end
end
