Rspec_on_rails_on_crack not being loaded properly

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.

On Tue, Apr 7, 2009 at 5:40 PM, danielpennypacker
[email protected] wrote:

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.

My understanding is that there is an rspec_on_rails_on_crack branch
that is not master that works better w/ the latest rails. Not sure of
the details and running out the door shortly, but take a look and see
if that can help resolve any issues you’re having.

Cheers,
David

We’re using Rails 2.1.1 and rspec/rspec_on_rails 1.8.6. It was working
okay
on a different my dev branch, so I’m not sure if different versions are
the
problem.

Thanks so much for the speedy reply, and I hope knowing my versions
helps.
My senior dev is gonna help with it tomorrow, so I’ll make sure to
update
our findings.

Thanks again!

My understanding is that there is an rspec_on_rails_on_crack branch
that is not master that works better w/ the latest rails. Not sure of
the details and running out the door shortly, but take a look and see
f that can help resolve any issues you’re having.

Cheers,
David

David C.-2 wrote:

  • Beast uses rspec, and this was the first time I’ve been exposed to it,

forgot to commit a file somewhere, but I can’t figure it out.

This file is copied to ~/spec when you run ‘ruby script/generate rspec’

#Debugger.start

 end
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/example/example_group_methods.rb:177:in
    from
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/lib/spec/runner/example_group_runner.rb:14:in
    from /Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/bin/spec:4
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users


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

On Tue, Apr 7, 2009 at 6:55 PM, danielpennypacker
[email protected] wrote:

We’re using Rails 2.1.1 and rspec/rspec_on_rails 1.8.6.

1.8.6 doesn’t really exist. The most recent is 1.2.2 :slight_smile:

It was working okay
on a different my dev branch, so I’m not sure if different versions are the
problem.

Thanks so much for the speedy reply, and I hope knowing my versions helps.
My senior dev is gonna help with it tomorrow, so I’ll make sure to update
our findings.

Cool - good luck!

So me and the senior dev solved the problem. We tried a number of
things, so
I’m not sure if my original question is that relevant, but here’s what
was
kinda going on…

-This is my first time integrating lots of plugins from another app, so
I
was going in between installing gems as gems and installing gems as
plugins.

  • Because i wasn’t consistent about that, and I wasn’t consistent about
    re-running script/generate rspec, I was getting weird behavior. I guess
    in
    the version we’re using (I don’t know if this is changed later), the
    files
    generated are different whether you have rspec installed as a plugin or
    as a
    gem.

-Hope that helps for anyone, and thanks for the feedback.

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

On Wed, Apr 8, 2009 at 9:22 PM, danielpennypacker
[email protected] wrote:

the version we’re using (I don’t know if this is changed later), the files
generated are different whether you have rspec installed as a plugin or as a
gem.

The generated files should be the same either way - but they behave
slightly differently depending on where they are installed.

Oops, sotty about that, I got my version of ruby mixed in there.
They’re both 1.1.8

I followed the instructions here:
http://wiki.github.com/dchelimsky/rspec/rails

David C.-2 wrote:

the
Thanks again!

code

 ./spec/controllers/sessions_controller_spec.rb:13: undefined method
run it before, so thanks for any help!
ENV[“RAILS_ENV”] = “test”
Spec::Runner.configure do |config|
 def login_as(user)
end
module_eval' /Users/pennypacker/Desktop/work/infectious-trunk/vendor/plugins/rspec/lib/spec/extensions/main.rb:27:in each’
/Users/pennypacker/.gem/ruby/1.8/gems/rspec-1.2.2/bin/spec:4
[email protected]
View this message in context:
http://rubyforge.org/mailman/listinfo/rspec-users


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