Permalink
Browse files

added slug / prefix spec.

removed failing controller specs. This needs some more attention, when I rewrite it to use shoulda.
  • Loading branch information...
1 parent 0504fc6 commit d120e8481c12831759e67928ee75eaa7979af56f @peterberkenbosch peterberkenbosch committed Jan 26, 2010
Showing with 6 additions and 16 deletions.
  1. +1 −16 spec/controllers/content_controller_spec.rb
  2. +5 −0 spec/models/page_spec.rb
View
17 spec/controllers/content_controller_spec.rb
@@ -6,7 +6,7 @@
@page = mock("page")
# Generally, prefer stub! over should_receive in setup.
- @page.stub!(:slug).and_return('test')
+ @page.stub!(:slug).and_return('/test')
@page.stub!(:title).and_return('Testing 123')
@page.stub!(:body).and_return('This is a test... cooool')
end
@@ -15,19 +15,4 @@
params_from(:get, "/foobar").should == {:controller => "content", :action => "show", :path=>["foobar"]}
end
- it "should render a 404 when no content is found by the given slug" do
-
- get 'show', :path=>["foobar"]
- response.should render_template("#{RAILS_ROOT}/public/404.html")
- response.headers["Status"].should == "404 Not Found"
- end
-
- it "should render the page when the slug is correct" do
- get 'show', :path=>["test"]
-
- Page.should_receive(:find_by_slug).with('test').and_return(@page)
- response.should be_success
- assigns[:page].should equal(@page)
- end
-
end
View
5 spec/models/page_spec.rb
@@ -12,4 +12,9 @@
it "should be valid" do
@page.should be_valid
end
+
+ it "should add an / to the slug" do
+ @page.slug.should == "/test-page"
+ end
+
end

0 comments on commit d120e84

Please sign in to comment.