Created
January 21, 2016 11:37
-
-
Save naichilab/867aebf620a44b669b00 to your computer and use it in GitHub Desktop.
その場でヘルパーメソッドを定義する方法
This file contains 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
context '有効なパラメータの場合' do | |
def create_user | |
post :create, user: attributes_for(:user) | |
end | |
it 'リクエストは302 リダイレクトとなること' do | |
create_user | |
expect(response.status).to eq 302 | |
end | |
it 'データベースに新しいユーザーが登録されること' do | |
expect{ | |
create_user | |
}.to change(User, :count).by(1) | |
end | |
it 'rootにリダイレクトすること' do | |
create_user | |
expect(response).to redirect_to root_path | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment