[rspec-users] rspec_on_rails_on_crack not being loaded properly

danielpennypacker danielpennypacker at gmail.com
Tue Apr 7 18:40:13 EDT 2009


Here's an intro to what I'm working on...

- We're adding Beast Forums to our site and we decided to integrate the code
instead of have it run in a separate app. 

- Beast uses rspec, and this was the first time I've been exposed to it, we
use boring old unit tests. Beast also uses the rspec_on_rails_on_crack
plugin. 

- I was doing work on a development branch and eventually got all of the
specs written for Beast to past after they had been integrated into our
site. 

- I merged my branch back to trunk resolved conflicts and did 'rake spec'

- rake 'spec:models' works fine, but when I try running specs for the
controllers, I get this error:
  ./spec/controllers/sessions_controller_spec.rb:13: undefined method `act!'
for ActiveSupport::TestCase::Subclass_1:Class (NoMethodError)

  - act! is defined in rspec_on_rails_on_crack, and is being required in
spec_helper.rb, but for some reason it isn't loading. I'm guessing that I
forgot to commit a file somewhere, but I can't figure it out.

- I know this is a pretty general question, but I thought someone might have
run it before, so thanks for any help! 

Here's 'spec_helper.rb'. It's been a bit modified from what was in Beast
Forums

--------------------------------------------

# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'spec'
require 'spec/rails'
require 'rspec_on_rails_on_crack'
#require 'model_stubbing'
#require File.dirname(__FILE__) + "/model_stubs"
#require 'ruby-debug'
#Debugger.start

Spec::Runner.configure do |config|
  include AuthenticatedTestHelper
  config.use_transactional_fixtures = true
  config.use_instantiated_fixtures  = false
  config.fixture_path = RAILS_ROOT + '/test/fixtures/'

  def current_site(site = nil)
    Site.find(:first) || Site.find(site.id)
  end

  # Sets the current user in the session from the user fixtures.
   def login_as(user)
    controller.stub!(:current_user).and_return(@user = user ? users(user) :
nil)
  end

  def authorize_as(user)
    @request.env["HTTP_AUTHORIZATION"] = user ? "Basic
#{Base64.encode64("#{users(user).login}:test")}" : nil
  end
end

Full error trace:

---------------------------------------------------------

./spec/controllers/sessions_controller_spec.rb:13: undefined method `act!'
for ActiveSupport::TestCase::Subclass_1:Class (NoMethodError)
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/example/example_group_methods.rb:177:in
`module_eval'
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/example/example_group_methods.rb:177:in
`subclass'
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/example/example_group_methods.rb:55:in
`describe'
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/example/example_group_factory.rb:29:in
`create_example_group'
	from
/Users/pennypacker/Desktop/work/infectious-trunk/vendor/plugins/rspec/lib/spec/extensions/main.rb:27:in
`describe'
	from ./spec/controllers/sessions_controller_spec.rb:3
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/runner/example_group_runner.rb:15:in
`load'
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/runner/example_group_runner.rb:15:in
`load_files'
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/runner/example_group_runner.rb:14:in
`each'
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/runner/example_group_runner.rb:14:in
`load_files'
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/runner/options.rb:97:in
`run_examples'
	from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/runner/command_line.rb:9:in
`run'
	from /Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/bin/spec:4



-- 
View this message in context: http://www.nabble.com/rspec_on_rails_on_crack-not-being-loaded-properly-tp22939702p22939702.html
Sent from the rspec-users mailing list archive at Nabble.com.



More information about the rspec-users mailing list