Skip to content

Instantly share code, notes, and snippets.

View AleksandrKudashkin's full-sized avatar

Aleksandr Kudashkin AleksandrKudashkin

  • Montreal, Canada
View GitHub Profile
@AleksandrKudashkin
AleksandrKudashkin / proc_spec_sample.rb
Created September 11, 2016 00:27
Proc refactoring for controller test
describe 'POST #create' do
let(:create_request) { Proc.new { |q| post :create, question: attributes_for(q) } }
context 'with valid object' do
it 'saves the new question in the database' do
expect { create_request.call(:question) }.to change(Question, :count).by(1)
end
it 'redirects to show this question view' do
create_request.call(:question)