[rspec-users] Error against latest trunk while testing via spec for model

Deepak Jois
Wed, 14 Feb 2007 00:37:08 -0000

On 2/13/07, David Chelimsky <dchelimsky at gmail.com>
wrote:
> FYI - I just ran our suite and everything related to models ran just
> fine with the following:
>
> RSpec rev 1493
> Rails rev 6149
> ruby 1.8.5
> mysql 4.1
>

Almost the same for me

RSpec rev 1493
Rails rev 6149
ruby 1.8.5
mysql 5.0.27

The error seems to be related to loading the fixture because other
specs not related to specs pass as normal.

And I can replicate it both on my Mac as well as Linux machines. I
could be doing something stupud, but here is my code:

The Venue Model:
==class Venue < ActiveRecord::Base
  validates_uniqueness_of :name, :on => :create, :message => "must be
unique"
  validates_presence_of :name, :description
end
==
The Venue Fixture:
==one:
  id: 1
  name: LT1
  description: Lecture Theatre 1
  active: 1
two:
  id: 2
  name: LT2
  description: Lecture Theatre 2
  active: 0
==
Spec file using fixtures. As I said above, I have another context
where I do not use specs and it works just fine.

===context "Given a generated venue_spec.rb with fixtures loaded" do
  fixtures :venues

  specify "fixtures should load two Venues" do
    Venue.should have(2).records
  end

  specify "a new venue cannot have the same name" do
    v = Venue.new(:name => "LT2", :description => "Lecture
Theatre 2
(duplicate)", :active => false)
    v.should_not_be_valid
  end
end
====