Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require File.dirname(__FILE__) + '/../spec_helper' describe FeedsController, " called with uri /feeds/new" do before(:each) do @feed = mock("feed") Feed.stub!(:new).and_return(@feed) @feed.stub!(:save).and_return(true) controller.stub!(:authenticate).and_return(true) end it "should be an instance of FeedsController" do controller.should be_an_instance_of(FeedsController) end it "should create a new instance of Feed with GET to new" do get :new response.should be_success response.should render_template("feeds/new") end it "should save an instance of Feed with POST on create" do post :create response.should redirect_to(feeds_url) end it "should flash a success message" do post :create flash[:notice].should == "Feed was successfully created." end it "should create the feed" do Feed.should_receive(:new).with({"name" => "Filme", \ "url" => "http://localhost", \ "description" => "Alles zum Thema " + "Filme"}).and_return(@feed) post :create, :feed => {"name" => "Filme", \ "url" => "http://localhost", \ "description" => "Alles zum Thema Filme"} end it "should save the feed" do @feed.should_receive(:save).and_return(true) post :create end end describe FeedsController, " receiving /feeds/new using POST, \ but doesn't save" do before(:each) do @feed = mock("feed") Feed.stub!(:new).and_return(@feed) @feed.stub!(:save).and_return(false) controller.stub!(:authenticate).and_return(true) end it "should fail when saving feed" do @feed.should_receive(:save).and_return(false) post :create end it "should render the form new.html.erb" do post :create response.should render_template(:new) end end
This paste will be private.
From the Design Piracy series on my blog: