This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Sean Braithwaite (author)
Mon Mar 24 14:14:32 -0700 2008
| 08819d2f » | benburkert | 2008-02-22 | 1 | require File.join(File.dirname(__FILE__), 'controller_spec_helper.rb') | |
| 208424ba » | hornbeck | 2008-01-25 | 2 | ||
| ef6f0855 » | jwhitmire | 2008-01-28 | 3 | describe Articles do | |
| 0a17d2bf » | brapse | 2008-02-15 | 4 | include DefaultSpecHelper | |
| 5 | include ArticleSpecHelper | ||||
| 6 | include DefaultControllerHelper | ||||
| 7 | |||||
| 8 | it_should_behave_like "default controller behavior" | ||||
| 9 | |||||
| 8071c75c » | jwhitmire | 2008-01-28 | 10 | describe "#index" do | |
| 6744c2ee » | benburkert | 2008-02-14 | 11 | it "should find all articles and place them in @articles" do | |
| 12 | Article.should_receive(:all).and_return [] | ||||
| 13 | dispatch_to(Articles, :index).assigns(:articles).should == [] | ||||
| 14 | end | ||||
| 15 | |||||
| 16 | it "should find all articles by reverse date" do | ||||
| 17 | Article.should_receive(:all).with(:order => 'created_at desc') | ||||
| 18 | |||||
| 19 | dispatch_to(Articles, :index) | ||||
| 20 | end | ||||
| 21 | end | ||||
| 22 | |||||
| 23 | describe "#show" do | ||||
| 24 | before(:each) do | ||||
| 25 | @article = mock_model Article, | ||||
| 26 | { | ||||
| 27 | :title => "Merb + Blerb = Superb!", | ||||
| 28 | :slug => "merb-blerb-superb", | ||||
| 29 | :created_at => Time.now, | ||||
| 30 | :body => "", | ||||
| 31 | :comments => [] | ||||
| 32 | } | ||||
| 33 | end | ||||
| 34 | |||||
| 35 | it "should find the first article by the slug" do | ||||
| 36 | Article.should_receive(:with_slug).with(@article.slug).and_return @article | ||||
| 37 | |||||
| 38 | dispatch_to(Articles, :show, :id => @article.slug) | ||||
| 8071c75c » | jwhitmire | 2008-01-28 | 39 | end | |
| 40 | |||||
| 6744c2ee » | benburkert | 2008-02-14 | 41 | it "should find the first article and place it in @article" do | |
| 42 | Article.should_receive(:with_slug).and_return @article | ||||
| 43 | |||||
| 44 | dispatch_to(Articles, :show, :id => @article.slug).assigns(:article).should == @article | ||||
| 45 | end | ||||
| 46 | |||||
| 47 | it "should raise a NotFound error if the slug id does not find an article" do | ||||
| 48 | Article.should_receive(:with_slug).and_return nil | ||||
| 49 | |||||
| 50 | lambda { dispatch_to(Articles, :show, :id => @article.slug) }.should raise_error(Merb::ControllerExceptions::NotFound) | ||||
| 51 | end | ||||
| 8071c75c » | jwhitmire | 2008-01-28 | 52 | end | |
| 0a17d2bf » | brapse | 2008-02-15 | 53 | end | |







