[rspec-users] explanation of "describe" vs "context"...

Scott Taylor scott at railsnewbie.com
Sun Jul 12 15:48:06 EDT 2009


Chris Sund wrote:
> Hey everyone,
>
> This is a noob question. I'm not grasping the difference between
> "describe" and "context" in my spec file. As an example, what's the
> difference with this...
>
> describe Game do
>      context "starting up" do
> it "should send a welcome message" do
>         @messenger.should_receive(:puts).with("Welcome to
> Mastermind!")
>         @game.start(%w[r g y c])
>       end
>
>
>
> And this....
>
> describe Game do
>      describe "starting up" do
> it "should send a welcome message" do
>         @messenger.should_receive(:puts).with("Welcome to
> Mastermind!")
>         @game.start(%w[r g y c])
>       end
>
>
> Is this just preference, or are the serious differences?
>
>
>   
They are aliased, so there is no functional difference:

http://gist.github.com/ded8be0839e77c30afe1

Scott


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



More information about the rspec-users mailing list