Skip to content

Instantly share code, notes, and snippets.

@smtm
Created January 11, 2009 11:40
Show Gist options
  • Save smtm/45694 to your computer and use it in GitHub Desktop.
Save smtm/45694 to your computer and use it in GitHub Desktop.
---A Method in Test_helper.rb
def login_pmtwo
u=User.new(:login =>"pmtwo",:password =>"secret",:administrator =>true)
post :login, :login=>'pmtwo', :password=>'secret'
end
---:projects_controller.rb
require File.dirname(__FILE__) + '/../test_helper'
class ProjectsControllerTest < ActionController::TestCase
context "on GET to :show" do
setup do
login_pmtwo
@controller = ProjectsController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
get :show, :id =>1
end
should_assign_to :project
should_respond_with :success
should_not_set_the_flash
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment