Skip to content

Instantly share code, notes, and snippets.

@rockrep
Created September 15, 2010 17:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rockrep/581130 to your computer and use it in GitHub Desktop.
app/controllers/application_controller.rb
------------
class ApplicationController < ActionController::Base
include SslRequirement
ssl_exceptions
end
spec/support/authlogic.rb
---------
require "authlogic/test_case"
include Authlogic::TestCase
spec/controllers/scaffold_controller_spec.rb
----------
require 'spec_helper'
describe ScaffoldController do
before do
activate_authlogic
create_and_signin_user!
end
def mock_scaffold(stubs={})
@mock_scaffold ||= mock_model(Scaffold, stubs).as_null_object
end
describe "POST create" do
describe "with valid params" do
it "redirects to the created scaffold" do
Scaffold.stub(:new) { mock_scaffold(:save => true) }
post :create, :scaffold => {}
response.should redirect_to(scaffold_url(mock_scaffold))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment