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



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/vHZ8LfPhp44J.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Hassan Schroeder at Oct 30, 2012 at 1:47 pm

    On Tue, Oct 30, 2012 at 6:29 AM, roelof 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 Schroeder ------------------------ hassan.schroeder@gmail.com
    http://about.me/hassanschroeder
    twitter: @hassan

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Roelof at Oct 30, 2012 at 3:48 pm
    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 Schroeder het
    volgende:
    On Tue, Oct 30, 2012 at 6:29 AM, roelof <rwo...@hotmail.com <javascript:>>
    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 Schroeder ------------------------ hassan.s...@gmail.com<javascript:>
    http://about.me/hassanschroeder
    twitter: @hassan
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/YQ_LX4-zTogJ.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Colin Law at Oct 30, 2012 at 4:15 pm

    On 30 October 2012 15:47, roelof 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

    Op dinsdag 30 oktober 2012 14:48:47 UTC+1 schreef Hassan Schroeder het
    volgende:
    On Tue, Oct 30, 2012 at 6:29 AM, roelof 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 Schroeder ------------------------ hassan.s...@gmail.com
    http://about.me/hassanschroeder
    twitter: @hassan
    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/rubyonrails-talk/-/YQ_LX4-zTogJ.

    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rodrigo Martins at Oct 30, 2012 at 6:13 pm
    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] -> https://github.com/thoughtbot/shoulda-matchers
    [2] -> https://github.com/thoughtbot/factory_girl_rails


    --
    * Att*
    ___________________________
    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/] rodrigo@rrmartins.com [image:
    Skype/]rr_martinsj [image:
    MSN/] rodrigo@rrmartins.com




    2012/10/30 Colin Law <clanlaw@googlemail.com>
    On 30 October 2012 15:47, roelof 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

    Op dinsdag 30 oktober 2012 14:48:47 UTC+1 schreef Hassan Schroeder het
    volgende:
    On Tue, Oct 30, 2012 at 6:29 AM, roelof 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 Schroeder ------------------------ hassan.s...@gmail.com
    http://about.me/hassanschroeder
    twitter: @hassan
    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/rubyonrails-talk/-/YQ_LX4-zTogJ.

    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 30, '12 at 1:29p
activeOct 30, '12 at 6:13p
posts5
users4
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase