Thanks Myron, I've been talking it out with a couple friends and we've come 
up with the strange conclusion. I'm going to try and uncomplicate some of 
my models a bit more here and re-approach this. It does help to know that, 
at leas theoretically, this is setup in what should be the right way. If I 
am still facing this same problem, I'll come back with more code... 
otherwise hopefully this was just me stumbling in the dark for a little 
while.

Thanks!

On Thursday, May 21, 2015 at 7:12:19 PM UTC+2, Myron Marston wrote:
>
> On Thu, May 21, 2015 at 9:45 AM, Matthew Vincent <[email protected] 
> <javascript:>> 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/3318d180-fcc8-43f2-9138-2ca26d34af13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to