aris
1
Hello,
I have followed the rspec course on code-school.
Now I try to make it work on my own project.
Let’s say I have this model :
class message < ActiveRecord::Base
attr_accessible :bericht, :user
belongs_to :user
belongs_to :category
end
Now I try to make a test so I can verify that a message has a title and
a
body.
How can I do this ?
Roelof
roelof
2
On Tue, Oct 30, 2012 at 6:29 AM, roelof [email protected] wrote:
I have followed the rspec course on code-school.
Now I try to make a test so I can verify that a message has a title and a
body.
How can I do this ?
I would suggest you use the rspec generators to create a model or
scaffold and then use the generated tests as a guide.
(Seems like something that an “rspec course” would have covered…)
–
Hassan S. ------------------------ [email protected]
twitter: @hassan
roelof
3
Thanks for the answer.
I will try to find out how this works. As far as I can find it this is
not
covered in this code school course.
Roelof
Op dinsdag 30 oktober 2012 14:48:47 UTC+1 schreef Hassan S. het
volgende:
roelof
4
On 30 October 2012 15:47, roelof [email protected] wrote:
Thanks for the answer.
I will try to find out how this works. As far as I can find it this is not
covered in this code school course.
Try railstutorial.org, which is free to use online. It gives a good
introduction to testing.
Colin
roelof
5
You can use the gem shoulda-matchers[1] to test it.
She works very well with rspec.
And it is very easy to test this.
With it you can test the attributes, calls from models and stuff …
You can use the gem-rails factory-girl, best to test the interactions,
writing less and being more efficient …
[1] → GitHub - thoughtbot/shoulda-matchers: Simple one-liner tests for common Rails functionality
[2] → GitHub - thoughtbot/factory_bot_rails: Factory Bot ♥ Rails
–
Rodrigo Martins
www.rrmartins.com http://rrmartins.github.com
tel: (28) 9882-6202
(27) 9601-9573
(21) 9942-2016
My profiles: [image: Facebook] http://pt-br.facebook.com/rr.martins.j
[image:
Twitter] http://www.twitter.com/rr_martins
Contact me: [image: Google Talk/] [email protected] [image:
Skype/]rr_martinsj [image:
MSN/] [email protected]
2012/10/30 Colin L. [email protected]