andrea wrote:
Hi,
I recently migrated from classic rails testing to Rspec, so I am
pretty new to the framework and still learning. I am getting weird
errors on an ActiveRecord model test, here is the basic class model
definition:

class Size < ActiveRecord::Base
  has_many :quantities, :dependent => :destroy
  validates_presence_of :name
  validates_uniqueness_of :name, :case_sensitive => false
end

and this is the faulty spec:
  it 'new size should have an error on name' do
    Size.new.should have(1).error_on(:name)
  end

the red response is:
 'new size should have an error on name' FAILED
 expected 1 error on :name, got 0

if I change the spec to read like this:
 Size.new.should have(:no).error_on(:name)

It should be have(0).errors_on(:name), AFAIK

I still get a red response:
 'new size should have an error on name' FAILED
 expected 0 error on :name, got 1

Guess the problem is the model class name (Size) as I don't get such
weird stuff from other classes... can I fix this somehow?

Thanks

Andrea
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to