Forum: RSpec Error: undefined method `use_transactional_fixtures

Posted by waseem ahmad (Guest)
on 2009-01-07 08:07
(Received via mailing list)
Hi,

  I get this error when I do

  $spec /spec/any_spec

/home/waseem/app/spec/spec_helper.rb:14: undefined method
`use_transactional_fixtures=' for 
#<Spec::Example::Configuration:0xb6d9f218>
(NoMethodError)
    from 
/usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner.rb:184:in
`configure'
    from /home/waseem/app/spec/spec_helper.rb:10
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
    from ./spec/controllers/user_sessions_controller_spec.rb:1
    from
/usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in
`load'
    from
/usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in
`load_files'
    from
/usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:13:in
`each'
    from
/usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:13:in
`load_files'
    from
/usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/options.rb:98:in
`run_examples'
    from
/usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/command_line.rb:10:in
`run'
    from /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/spec:4
    from /usr/bin/spec:19:in `load'
    from /usr/bin/spec:19

I googled it and got
http://ryandaigle.com/articles/2008/11/19/what-s-new-in-edge-rails-application-rb-duality-is-no-moresee
Maxim's comment

What could be possibly wrong?
Posted by Mischa Fierer (mischa)
on 2009-01-07 08:55
(Received via mailing list)
this may help:

http://themomorohoax.com/2008/12/17/rails-2-3-tests
Posted by David Chelimsky (Guest)
on 2009-01-07 10:30
(Received via mailing list)
On Wed, Jan 7, 2009 at 12:29 AM, waseem ahmad <cougar2149@gmail.com> 
wrote:
> `configure'
> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in
>     from
> What could be possibly wrong?
Seems like it's not loading up rspec-rails' Configuration object. In
order for that to happen implicitly, the specs need to be in any of
spec/models, spec/controllers, spec/views, spec/helpers. Is your file
in one of those?
Posted by waseem ahmad (Guest)
on 2009-01-07 10:57
(Received via mailing list)
On Wed, Jan 7, 2009 at 2:55 PM, David Chelimsky 
<dchelimsky@gmail.com>wrote:

> Seems like it's not loading up rspec-rails' Configuration object. In
> order for that to happen implicitly, the specs need to be in any of
> spec/models, spec/controllers, spec/views, spec/helpers. Is your file
> in one of those?
>
>
Yeah the file is spec/controllers/user_sessions_controller.rb

@Mischa: The pointer you gave talks about rails edge. Right now I am on
rails 2.1
Posted by Mark Wilden (Guest)
on 2009-01-07 19:27
(Received via mailing list)
FWIW, I was getting this error yesterday. I completely uninstalled rspec 
and
rspec-rails (including David's code from GitHub) and reinstalled, and it
"went away."

///ark
Posted by David Chelimsky (Guest)
on 2009-01-07 19:28
(Received via mailing list)
On Wed, Jan 7, 2009 at 12:20 PM, Mark Wilden <mark@mwilden.com> wrote:
> FWIW, I was getting this error yesterday. I completely uninstalled rspec and
> rspec-rails (including David's code from GitHub) and reinstalled, and it
> "went away."

Which version did you install after removing everything?
Posted by Mark Wilden (Guest)
on 2009-01-07 20:14
(Received via mailing list)
On Wed, Jan 7, 2009 at 10:26 AM, David Chelimsky 
<dchelimsky@gmail.com>wrote:

> On Wed, Jan 7, 2009 at 12:20 PM, Mark Wilden <mark@mwilden.com> wrote:
> > FWIW, I was getting this error yesterday. I completely uninstalled rspec
> and
> > rspec-rails (including David's code from GitHub) and reinstalled, and it
> > "went away."
>
> Which version did you install after removing everything?
>
>
1.1.16, of course.

Kidding - 1.1.11. :)

///ark
Posted by waseem ahmad (Guest)
on 2009-01-08 06:28
(Received via mailing list)
I have both the rspec 1.1.11 and rspec-rails 1.1.11 as gems. I had them
plugged in my application too. When I removed them from my application 
the
problem was solved. The version of both the gems and plugins are same.

Why did this happen?
Posted by David Chelimsky (Guest)
on 2009-01-08 14:46
(Received via mailing list)
On Wed, Jan 7, 2009 at 11:26 PM, waseem ahmad <cougar2149@gmail.com> 
wrote:
> I have both the rspec 1.1.11 and rspec-rails 1.1.11 as gems. I had them
> plugged in my application too. When I removed them from my application the
> problem was solved. The version of both the gems and plugins are same.
>
> Why did this happen?

I haven't seen the problem of use_transactional_fixtures before, but
there were some problems with installing rspec/rspec-rails as gems w/
1.1.11.

This will be fixed in the 1.1.12 release coming shortly.

Cheers,
David
Posted by Jason Fb (jasonfb)
on 2010-02-26 20:44
This happens when you generate tests pre-Rails 2.3 then upgrade to Rails 
2.3.

go to test/test_helper.rb and change:
class Test::Unit::testCase

to:
class ActiveSupport::TestCase

http://www.datatravels.com/technotes/2009/04/21/rails-error-undefined-method-use_transactional_fix/


waseem ahmad wrote:
> Hi,
> 
>   I get this error when I do
> 
>   $spec /spec/any_spec
> 
> /home/waseem/app/spec/spec_helper.rb:14: undefined method
> `use_transactional_fixtures=' for 
> #<Spec::Example::Configuration:0xb6d9f218>
> (NoMethodError)
>     from 
> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner.rb:184:in
> `configure'
>     from /home/waseem/app/spec/spec_helper.rb:10
>     from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require'
>     from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require'
>     from ./spec/controllers/user_sessions_controller_spec.rb:1
>     from
> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in
> `load'
>     from
> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:14:in
> `load_files'
>     from
> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:13:in
> `each'
>     from
> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/example_group_runner.rb:13:in
> `load_files'
>     from
> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/options.rb:98:in
> `run_examples'
>     from
> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/runner/command_line.rb:10:in
> `run'
>     from /usr/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/spec:4
>     from /usr/bin/spec:19:in `load'
>     from /usr/bin/spec:19
> 
> I googled it and got
> http://ryandaigle.com/articles/2008/11/19/what-s-new-in-edge-rails-application-rb-duality-is-no-moresee
> Maxim's comment
> 
> What could be possibly wrong?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.