Created
September 27, 2011 01:52
-
-
Save kaznum/1244104 to your computer and use it in GitHub Desktop.
Is there more beautiful expression of lazy evaluation for expect{} and DRY?
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
# FIXME | |
# Is there more beautiful expression of lazy evaluation for expect{} and DRY? | |
# | |
describe ItemsController do | |
describe "POST 'create'" do | |
before do | |
@action = lambda { post :create, :name => 'foo' } | |
end | |
describe "response" do | |
before do | |
@action.call | |
end | |
subject {response} | |
it { should redirect_to items_url } | |
end | |
describe "the change of the number of items" do | |
specify { | |
expect { @action.call }.to change(Item.count).by(1) } | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:item => { :name => 'foo' }が良い、というのはナシの方向で(笑)