Last active
December 20, 2015 06:59
-
-
Save delba/6089673 to your computer and use it in GitHub Desktop.
ActionController::TestCase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # TL;DR | |
| # verb(action, *args) | |
| # verb(action, parameters, session, flash) | |
| require 'test_helper' | |
| class ProjectsControllerTest < ActionController::TestCase | |
| setup do | |
| @sophie = users(:sophie) | |
| end | |
| test 'inconsitencies' do | |
| session[:something] = 'something' | |
| flash[:somewhat] = 'somewhat' | |
| get :new | |
| assert_equal 'something', session[:something] | |
| assert_nil flash[:somewhat] | |
| end | |
| test 'get :new' do | |
| get :new, {}, user_id: @sophie.id | |
| assert_template :new | |
| end | |
| test 'post :create' do | |
| post :create, { | |
| project: { | |
| title: 'US Road Trip', | |
| } | |
| }, user_id: @sophie.id | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment