[Rspec-devel] Strange RSpec/Rails problem

aslak hellesoy aslak.hellesoy at gmail.com
Tue Aug 29 07:43:24 EDT 2006


On 8/29/06, Luke Redpath <luke at agileevolved.com> wrote:
> Aslak, I can get this error by simply generating a new Rails app,
> installing the RSpec on Rails plugin, doing the script/generate rspec
> installation then creating a single spec that is as simple as this:
>
> context "Foo" do
>    specify "whatever"
>      #nothing here
>    end
> end
>
> The strange thing is that I have an existing app elsewhere with a
> whole suite of specs that are running fine. The only difference is
> that it is using an older version of the RSpec on Rails plugin
> (around 0.5.6 I think).
>
> Cheers
> Luke
>

Here is how I tried to reproduce this:

1) Uninstall my old 1.1.4 rails:
sudo gem uninstall activesupport
sudo gem uninstall activerecord
sudo gem uninstall actionpack
sudo gem uninstall actionmailer
sudo gem uninstall actionwebservice

2) Install Rails 1.1.6
sudo gem install -y rails

3) Uninstall my old RSpec
sudo gem uninstall rspec

4) Install RSpec 0.6.2
sudo gem install rspec

5) Create a new rails app with rspec
rails rspec_test
cd rspec_test
ruby script/plugin install svn://rubyforge.org/var/svn/rspec/tags/REL_0_6_2/ven
dor/rspec_on_rails/vendor/plugins/rspec
script/generate rspec

6) Create a dummy spec in spec/spec.rb:

require File.dirname(__FILE__) + '/spec_helper'

context "Foo" do
  specify "whatever" do
    #nothing here
  end
end

7) Run the spec
spec spec/spec.rb

.

Finished in 0.026393 seconds

1 specification, 0 failures

-------

I'm unable to reproduce your problem. Are you sure you don't have
old/incompatible stuff lying around?

Aslak

> On 29 Aug 2006, at 11:55, aslak hellesoy wrote:
>
> > On 8/29/06, Luke Redpath <luke at agileevolved.com> wrote:
> >> NOTE: Please ignore the other version of this mail sitting in the
> >> moderation queue - I sent it with the wrong email address.
> >>
> >> I'm in the process of writing an RSpec/Rails tutorial and I just
> >> created a new Rails project to test out my tutorial code. However,
> >> when I run the specs, I get the following strange error:
> >>
> >> NoMethodError in 'A user (in general) should be invalid without a
> >> username'
> >> You have a nil object when you didn't expect it!
> >> You might have expected an instance of Array.
> >> The error occured while evaluating nil.-
> >> /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/
> >> active_record/transactions.rb:112:in `unlock_mutex'
> >> /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/
> >> active_record/fixtures.rb:534:in `teardown_with_fixtures'
> >> /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/
> >> active_record/fixtures.rb:556:in `teardown'
> >> ./spec/models/../spec_helper.rb:23:in `teardown'
> >> /Users/luke/Sandbox/misc/rspec_tutorial/config/../vendor/plugins/
> >> rspec/lib/rspec_on_rails.rb:103:in `run'
> >> I'm using RSpec 0.6.2 and the latest RSpec on Rails plugin with Rails
> >> 1.1.6. Any ideas what could be causing this? I've also tried freezing
> >> to edge revision 4727.
> >>
> >
> > Can you share some code that we can use to reproduce this?
> > Preferrably as a patch to RSpec's demo rails app under vendor/
> > rspec_on_rails
> >
> > Cheers,
> > Aslak
> >
> >> Cheers
> >> Luke
> >> _______________________________________________
> >> Rspec-devel mailing list
> >> Rspec-devel at rubyforge.org
> >> http://rubyforge.org/mailman/listinfo/rspec-devel
> >>
> > _______________________________________________
> > Rspec-devel mailing list
> > Rspec-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-devel
>
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>


More information about the Rspec-devel mailing list