On Thu, May 21, 2015 at 9:45 AM, Matthew Vincent <[email protected]> wrote:
> I'm trying to setup the best way to setup several expectations against a
> controller action. Everything I'm running across seems to suggest that this
> should be working, but only the first expectation will pass. If I switch the
> order, it doesn't matter, it is always the first one that passes. I'm sure
> I'm missing something obvious at this point and I need a second pair of eyes
> to help me. Any thoughts?
>
>
>
>
> subject(:post_image) { -> { post :create, location_id: location.id,
> reconstruction_id: reconstruction.id, image: {image:
> Rack::Test::UploadedFile.new(Rails.root.join('spec', 'fixtures', 'files',
> 'test1500white.png'), 'image/png') } } }
>
> it { is_expected.to change(Image, :count).by(1) }
> it { is_expected.to change(AssetRelation, :count).by(1) }
>
> There's nothing obviously wrong from the snippet you posted. My best
guess is that it has to do with the state change not being fully reset
between examples. For example, if your DB isn't being rolled back or
cleaned out between examples, it could allow the first example to pass but
could cause the second example to fail due to data left around from the
first example.
If you're able to put together a reproducible example so we can play with
it, we can help more, but without that, we can only guess as to the problem.
HTH,
Myron
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/CADUxQmt31%2B1avVRg3yVdnK0MjhzkkAqzpaBopuxfiqAW5RZZ-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.