Skip to content

Instantly share code, notes, and snippets.

@naichilab
Created January 19, 2016 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save naichilab/3cc2fc1d80ce39a134f5 to your computer and use it in GitHub Desktop.
Save naichilab/3cc2fc1d80ce39a134f5 to your computer and use it in GitHub Desktop.
describe 'Post #create' do
context '有効なパラメータの場合' do
let(:create_user) { -> { post :create, user: attributes_for(:user) }}
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
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment