Skip to content

Instantly share code, notes, and snippets.

@rafmagana
Created May 10, 2012 20:01
Show Gist options
  • Save rafmagana/2655504 to your computer and use it in GitHub Desktop.
Save rafmagana/2655504 to your computer and use it in GitHub Desktop.
# spec/controllers/admin/restaurant_offers_controller.spec.rb
describe "GET :edit" do
before do
@restaurant_offer.stub(:editable?).and_return true
end
def doittoit
get :edit, id: @restaurant_offer.id, restaurant_id: @resto.id
end
it "is successful" do
doittoit
response.should be_successful
end
it "renders the :edit template" do
doittoit
response.should render_template('edit')
end
end
describe "GET :edit" do
let(:get_edit) do
get :edit, id: @restaurant_offer.id, restaurant_id: @resto.id
end
before do
@restaurant_offer.stub(:editable?).and_return true
end
before(:each) do
get_edit
end
it "is successful" do
response.should be_successful
end
it "renders the :edit template" do
response.should render_template('edit')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment