Forum: RSpec rspec_on_rails_on_crack not being loaded properly

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
danielpennypacker (Guest)
on 2009-04-08 02:58
(Received via mailing list)
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-...
Sent from the rspec-users mailing list archive at Nabble.com.
David C. (Guest)
on 2009-04-08 03:07
(Received via mailing list)
On Tue, Apr 7, 2009 at 5:40 PM, danielpennypacker
<removed_email_address@domain.invalid> 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
danielpennypacker (Guest)
on 2009-04-08 05:31
(Received via mailing list)
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
>> removed_email_address@domain.invalid
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
> _______________________________________________
> rspec-users mailing list
> removed_email_address@domain.invalid
> http://rubyforge.org/mailman/listinfo/rspec-users
>
>

--
View this message in context:
http://www.nabble.com/rspec_on_rails_on_crack-not-...
Sent from the rspec-users mailing list archive at Nabble.com.
David C. (Guest)
on 2009-04-08 05:51
(Received via mailing list)
On Tue, Apr 7, 2009 at 6:55 PM, danielpennypacker
<removed_email_address@domain.invalid> 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 :)

> 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!
danielpennypacker (Guest)
on 2009-04-08 21:32
(Received via mailing list)
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
>>>> removed_email_address@domain.invalid
>> 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-...
Sent from the rspec-users mailing list archive at Nabble.com.
danielpennypacker (Guest)
on 2009-04-09 04:25
(Received via mailing list)
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-...
Sent from the rspec-users mailing list archive at Nabble.com.
David C. (Guest)
on 2009-04-09 04:32
(Received via mailing list)
On Wed, Apr 8, 2009 at 9:22 PM, danielpennypacker
<removed_email_address@domain.invalid> 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.
This topic is locked and can not be replied to.