Closed emerleite closed 14 years ago
It is now RSpec.configure
(with a capital "S"). Please change Rspec
to RSpec
and report back if that works.
Doesn't work. I receive undefined method `fixture_path=' for #RSpec::Core::Configuration:0x101566948 (NoMethodError) same as when I use Rspec.configure
When I use Rspec.configuration It works, but the before statement doesn't execute.
Cheers,
Emerson
You forgot to add require "rspec/rails"
above the configuration block.
@emerlite - is @justinko correct? Please verify so I can close this. Thx.
No, he isn't. I've alread added the require statement
@emerleite - please post your spec_helper and any error messages you're seeing.
@emerleite - also, what is the command you're using to run and where do the files that are failing live (i.e. directories and filenames)
Rspec.configure do |config|
config.mock_with :rspec
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.before :each do
CleanDatabase.clean!
end
end
The error is:
/Users/emerson.leite/Projetos/webmedia-sync/spec/spec_helper.rb:26: undefined method `fixture_path=' for #<RSpec::Core::Configuration:0x101566948> (NoMethodError)
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core.rb:61:in `configure'
from /Users/emerson.leite/Projetos/webmedia-sync/spec/spec_helper.rb:12
from /Users/emerson.leite/Projetos/webmedia-sync/spec/controllers/videos_controller_spec.rb:1:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/spec/controllers/videos_controller_spec.rb:1
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require_files_to_run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `map'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require_files_to_run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/command_line.rb:18:in `run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:46:in `run_in_process'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:37:in `run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:10:in `autorun'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/bin/rspec:19
To solve this, I changed this configuration to this:
Rspec.configure do |config|
config.mock_with :rspec
config.before :each do
CleanDatabase.clean!
end
end
Rspec.configuration do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
end
It works
Please post the entire spec_helper.rb file. A gist or pastie would be best so I can see the line numbers. Thx.
That might remove the error, but that's just because RSpec.configuration
doesn't do anything with the block that's passed to it, so fixture_path
is not getting set.
spec_helper_unit.rb - http://pastie.org/1098096 spec_helper.rb - http://pastie.org/1098094
/Users/emerson.leite/Projetos/webmedia-sync/spec/spec_helper.rb:27: undefined method `fixture_path=' for #<RSpec::Core::Configuration:0x101566948> (NoMethodError)
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core.rb:61:in `configure'
from /Users/emerson.leite/Projetos/webmedia-sync/spec/spec_helper.rb:12
from /Users/emerson.leite/Projetos/webmedia-sync/spec/controllers/videos_controller_spec.rb:1:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/spec/controllers/videos_controller_spec.rb:1
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require_files_to_run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `map'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require_files_to_run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/command_line.rb:18:in `run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:46:in `run_in_process'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:37:in `run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:10:in `autorun'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/bin/rspec:19
I don't think this will help, but please change Rspec to RSpec.
Otherwise, I'm at a loss. It seems that the configuration form rspec-rails is not being loaded, but the one from rspec-core is.
What's in your Gemfile?
Usign RSpec I got the same error.
My Gemfile:
gem 'rspec', '>= 2.0.0.beta.19'
gem 'rspec-core', '>= 2.0.0.beta.19', :require => 'rspec/core'
gem 'rspec-expectations', '>= 2.0.0.beta.19', :require => 'rspec/expectations'
gem 'rspec-mocks', '>= 2.0.0.beta.19', :require => 'rspec/mocks'
gem 'rspec-rails', '>= 2.0.0.beta.19'
Try getting rid of everything but rspec-rails.
Doesn't work:
/Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/dm-rails-1.0.3/lib/dm-rails/railties/log_subscriber.rb:4: uninitialized constant ActiveSupport::LogSubscriber (NameError)
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/dm-rails-1.0.3/lib/dm-rails/railtie.rb:16:in `require'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/dm-rails-1.0.3/lib/dm-rails/railtie.rb:16
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/dm-rails-1.0.3/lib/dm-rails.rb:1:in `require'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/dm-rails-1.0.3/lib/dm-rails.rb:1
from /Users/emerson.leite/Projetos/webmedia-sync/.bundle/environment.rb:329:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/.bundle/environment.rb:329:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/.bundle/environment.rb:324:in `each'
from /Users/emerson.leite/Projetos/webmedia-sync/.bundle/environment.rb:324:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/.bundle/environment.rb:323:in `each'
from /Users/emerson.leite/Projetos/webmedia-sync/.bundle/environment.rb:323:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/config/application.rb:9
from /Users/emerson.leite/Projetos/webmedia-sync/spec/../config/environment.rb:2:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/spec/../config/environment.rb:2
from /Users/emerson.leite/Projetos/webmedia-sync/spec/spec_helper_unit.rb:2:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/spec/spec_helper_unit.rb:2
from /Users/emerson.leite/Projetos/webmedia-sync/spec/spec_helper.rb:4:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/spec/spec_helper.rb:4
from /Users/emerson.leite/Projetos/webmedia-sync/spec/controllers/videos_controller_spec.rb:1:in `require'
from /Users/emerson.leite/Projetos/webmedia-sync/spec/controllers/videos_controller_spec.rb:1
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require_files_to_run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `map'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/configuration.rb:288:in `require_files_to_run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/command_line.rb:18:in `run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:46:in `run_in_process'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:37:in `run'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/runner.rb:10:in `autorun'
from /Users/emerson.leite/.rvm/gems/ruby-1.8.7-p299@webmedia-sync/bin/rspec:19
The fact that you're using dm-rails (data mapper) would be nice to know, don't ya think?
Yep. My fault, but adding the other rspec gems this error dissapear.
1.) Get rid of spec_helper_unit.rb (or not require it) 2.) Make your spec_helper.rb look EXACTLY like this: http://github.com/datamapper/dm-rails
Doesn't make sense, because in this docs config.fixture_path is commented. So obviously I'll not receive the error. Any other sugestion? Cheers
Obviously, uncomment that line. If you're still having issues after that, it is a dm-rails issue.
dm-rails needs to support RSpec, not RSpec supports dm-rails.
Good luck.
@emerleite - what's the latest on this?
Probably really a dm-rails bug. You can close it.
Cheers
Cool. Thanks. Please do feel free to open a new one if you are able to narrow this down to rspec.
Cheers, David
Hi, I'm using Rspec 2.0.0.beta.19 and having some issues with Rspec.configuration | Rspec.configure
When I use Rspec.configure, fixture_path doesn't exists anymore and I receive an error. When I use Rspec.configuration, config.before is not executed anymore.
I think this is an issue.
Thanks,
Emerson