>
> how about some code and error messages
>
> aslak
Sorry, I should have done that earlier. At the moment I'm running a very
basic spec file, I've stripped out the rest as I figure this out.
user_spec.rb
------------
require File.dirname(__FILE__) + '/../spec_helper'
describe User, "when first created" do
before(:each) do
@user = User.new
end
it "should be invalid with 7 errors" do
@user.should_not be_valid
@user.errors.count.should == 7
end
end
In user.rb I have
---------------
validates_presence_of :first_name, :surname, :login, :email,
:mobile,
:message => "is required"
With DRB I get
---------------
ruby script/spec -X spec/models/user_spec.rb
F
1)
'User when first created should be invalid with 7 errors' FAILED
expected: 7,
got: 32 (using ==)
./spec/models/user_spec.rb:10:
Finished in 0.026632 seconds
1 example, 1 failure
And without DRB I get
-----------------------
ruby script/spec spec/models/user_spec.rb
.
Finished in 0.190591 seconds
1 example, 0 failures
When I check the 32 errors above, I find repeating messages of email
required, first name required etc. I'm using svn and the whole spec was
actually working before (I really should have started using autotest
earlier). So something along the way got broke. I have 9 other models
and their specs work just fine. And in the web browser I only get the
expected 7 errors.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users