testing


undefined method `generators' for #<RSpec::Core::Configuration


I have rspec2 installed with spork and guard and when run the guard command, I get this error:
undefined method `generators' for #<RSpec::Core::Configuration:0x007fb3944b23b0> (NoMethodError)
/Users/amiterandole/Desktop/current/rails/depot/spec/spec_helper.rb:64:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core.rb:108:in `configure'
/Users/amiterandole/Desktop/current/rails/depot/spec/spec_helper.rb:18:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork.rb:24:in `prefork'
/Users/amiterandole/Desktop/current/rails/depot/spec/spec_helper.rb:6:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork/test_framework.rb:138:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork/test_framework.rb:138:in `block (2 levels) in preload'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork/app_framework.rb:49:in `preload'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork/test_framework.rb:134:in `block in preload'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork.rb:62:in `exec_prefork'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork/test_framework.rb:120:in `preload'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:25:in `preload'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork/runner.rb:74:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/lib/spork/runner.rb:10:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/spork-1.0.0rc3/bin/spork:10:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/spork:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/spork:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/shellwords.rb:35:in `block in shellsplit': Unmatched double quote: "--format RSpec::Instafail' > .rspec" (ArgumentError)
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/shellwords.rb:33:in `scan'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/shellwords.rb:33:in `shellsplit'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/shellwords.rb:128:in `shellsplit'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:115:in `block in args_from_options_file'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:115:in `map'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:115:in `args_from_options_file'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:109:in `options_from'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:101:in `project_options'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:81:in `file_options'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:77:in `all_configs'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:34:in `parse_options'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:69:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun'
14:48:19 - ERROR - Could not start Spork server for RSpec after 30 seconds. I will continue waiting for a further 60 seconds.
14:49:19 - ERROR - Could not start Spork server for RSpec. Make sure you can use it manually first.
14:49:19 - INFO - Guard::RSpec is running
14:49:19 - INFO - Running all specs
14:49:19 - ERROR - Guard::RSpec failed to achieve its <start>, exception was:
> [#CFA8FD5ABE83] ArgumentError: Unmatched double quote: "--format RSpec::Instafail' > .rspec"
> [#CFA8FD5ABE83] /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/shellwords.rb:35:in `block in shellsplit'
> [#CFA8FD5ABE83] /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/shellwords.rb:33:in `scan'
> [#CFA8FD5ABE83] /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/shellwords.rb:33:in `shellsplit'
> [#CFA8FD5ABE83] /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/shellwords.rb:128:in `shellsplit'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:115:in `block in args_from_options_file'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:115:in `map'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:115:in `args_from_options_file'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:109:in `options_from'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:101:in `project_options'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:81:in `file_options'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:77:in `all_configs'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:34:in `parse_options'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-rspec-2.3.3/lib/guard/rspec/runner.rb:59:in `parsed_or_default_formatter'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-rspec-2.3.3/lib/guard/rspec/runner.rb:79:in `rspec_arguments'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-rspec-2.3.3/lib/guard/rspec/runner.rb:119:in `run_via_drb'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-rspec-2.3.3/lib/guard/rspec/runner.rb:36:in `run'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-rspec-2.3.3/lib/guard/rspec.rb:35:in `run_all'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-rspec-2.3.3/lib/guard/rspec.rb:31:in `start'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:99:in `block in run_supervised_task'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:97:in `catch'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:97:in `run_supervised_task'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:54:in `block (2 levels) in run'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:175:in `block (3 levels) in scoped_guards'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:174:in `each'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:174:in `block (2 levels) in scoped_guards'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:173:in `catch'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:173:in `block in scoped_guards'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:172:in `each'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:172:in `scoped_guards'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:53:in `block in run'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/lumberjack-1.0.2/lib/lumberjack.rb:27:in `unit_of_work'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/runner.rb:52:in `run'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard.rb:187:in `block in start'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard.rb:363:in `block in within_preserved_state'
> [#CFA8FD5ABE83] <internal:prelude>:10:in `synchronize'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard.rb:360:in `within_preserved_state'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard.rb:185:in `start'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/lib/guard/cli.rb:110:in `start'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/gems/guard-1.6.0/bin/guard:6:in `<top (required)>'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/bin/guard:19:in `load'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/bin/guard:19:in `<main>'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
> [#CFA8FD5ABE83] /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
14:49:19 - INFO - Guard::RSpec has just been fired
14:49:21 - INFO - Bundle already up-to-date
14:49:21 - INFO - Guard is now watching at '/Users/amiterandole/Desktop/current/rails/depot'
If I take out the generators config, things seem to work just fine. I am using rails 3.2.11 and ruby-1.9.3-p194
Here is what my gemfile looks like:
group :development, :test do
gem 'meta_request', '0.2.1'
gem "rspec-rails", "~> 2.0"
gem "factory_girl_rails", ">= 3.3.0"
gem "guard-rspec"
gem "capybara", ">= 1.1.2"
gem "database_cleaner"
gem "launchy", ">= 2.1.0"
gem 'rb-fsevent', '~> 0.9.1'
gem 'spork', '~> 1.0rc'
gem 'guard-spork', '~> 1.0rc'
gem "guard-bundler"
gem "guard-migrate"
end
Here is my guardfile:
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch('config/environments/test.rb')
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch('test/test_helper.rb') { :test_unit }
watch(%r{features/support/}) { :cucumber }
watch(%r{^spec/support/.+\.rb$})
end
guard 'rspec', :cli => "--drb" do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara features specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end
Here is my spec_helper.rb:
require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork do
# 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'
# 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.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
config.include FactoryGirl::Syntax::Methods
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
config.generators do |g|
g.view_specs false
g.helper_specs false
g.test_framework :rspec, :fixture => true
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
end
end
Spork.each_run do
# This code will be run each time you run your specs.
FactoryGirl.reload
end
end
How do I fix this?
I found the error. Apparently the config.generators block goes inside application.rb:
config.generators do |g|
g.view_specs false
g.helper_specs false
g.test_framework :rspec, :fixture => true
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
end

Related Links

Deploying a networked browser compatibility testing system
Cookie Testing for payment gateways
How to supply arguments using CMake and CTest?
Web testing frameworks for ASP.NET web application
How do you get a customer to accept better practices and cross-platform debugging during development?
No link to the test results in the Build Results reports in TFS 2008
Testing Problems upgrading from grails 1.0.5 to 1.1.1
Top 10 negative testing list
what are the different testings like DST, Wanem…?
Link testing
Biased random number sources
How do you ensure the same bug does not creep into the product the second time?
Mocking USB input
browser plugin to test a site's look when migrating
How do I test in both Safari 3 and Safari 4?
Is there a HOSTS file on Symbian Series 60 5th Edition devices?

Categories

HOME
java
ibm-bluemix
xamarin
zeromq
homebrew
iterator
yum
contact
iggrid
adobe-analytics
volttron
postgres-xl
n-gram
orchardcms
jsdoc
normalizr
immutable.js
phpfox
buck
opentype
libuv
c++-amp
google-cloud-nl
gsoap
microsoft-chart-controls
media-queries
bcd
.net-4.0
code-contracts
azure-sql-database
host
libvpx
occlusion
code-search-engine
sharefile
greenrobot-eventbus
spring-security-kerberos
bootstrap-dialog
unixodbc
websphere-mq-fte
wptoolkit
jsch
revapi
elgg
darcs
sybase-asa
redundancy
minimization
account-kit
or-tools
background-service
word-vba-mac
color-picker
libpng
nsviewcontroller
sigabrt
sdf
php-parse-error
phpcas
vhd
r-tree
execute
lemon
thredds
wireshark-dissector
browser-bugs
deis
vstest.console.exe
processmodel
angular-local-storage
key-management
device-orientation
tween
clicktag
xojo
wp-query
marmalade
braille
undefined-reference
oam
ora-00911
dataadapter
seed
random-seed
limejs
lcs
jelly
free-variable
dice
runas
windows-phone-7.1.1
asyncfileupload
hamachi
tomcat-valve
mysql-error-1005
blitz++
xsdobjectgen
castle-monorail
firefox-5
web-architecture
nintendo-ds
virtual-functions
wsdl.exe
.net-1.0
3gp

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App