Failure Reference: "User.count" didn't change by 1. Expected: 3 Actual: 2

394 views
Skip to first unread message

Masaaki Furuki

unread,
Jun 24, 2015, 1:23:50 PM6/24/15
to rubyonra...@googlegroups.com
What does "User.count" didn't change by 1. Expected: 3 Actual: 2 means?

Colin Law

unread,
Jun 24, 2015, 1:40:52 PM6/24/15
to rubyonra...@googlegroups.com
On 24 June 2015 at 18:22, Masaaki Furuki <johnm...@gmail.com> wrote:
> What does "User.count" didn't change by 1. Expected: 3 Actual: 2 means?

If I asked you to guess what it means what would you say?
Start by looking at the test it refers to, see what you are asking it
to test, then try to work out the answer to your question.

Colin
Message has been deleted

Masaaki Furuki

unread,
Jun 24, 2015, 2:12:56 PM6/24/15
to rubyonra...@googlegroups.com
Hi Colin,

Thanks for your reply. Actually problem has been already solved as you can see in link down below but this question remains.


I just want to make reference of failure, error message reference for sake of efficiency. In this case, where numbers 1, 2, 3 come from is actual question instead for what these numbers stands for. 

Masaaki Furuki

unread,
Jun 24, 2015, 2:14:53 PM6/24/15
to rubyonra...@googlegroups.com
Hi Liz,

Thanks for your reply. As I replied to Colin's comment, I'm wondering where these number actually come from. I mean originally.

On Wednesday, June 24, 2015 at 11:04:52 AM UTC-7, Elizabeth McGurty wrote:
I have some time here....  Please provide more information about the context in which you are making the User.count call.
Liz

Colin Law

unread,
Jun 24, 2015, 2:20:23 PM6/24/15
to rubyonra...@googlegroups.com
On 24 June 2015 at 19:12, Masaaki Furuki <johnm...@gmail.com> wrote:
> Hi Colin,
>
> Thanks for your reply. Actually problem has been already solved as you can
> see in link down below but this question remains.
>
> http://stackoverflow.com/questions/30990576/user-count-didnt-change-by-1-rails
>
> I just want to make reference of failure, error message reference for sake
> of efficiency. In this case, where numbers 1, 2, 3 come from is actual
> question instead for what these numbers stands for.

The test_should_create_user expects one record to be added to the user
table, it had two records at the start of the test so count should
increase from 2 to 3. It did not increase by 1 from 2 to 3, hence the
error.

Colin

>
>
> On Wednesday, June 24, 2015 at 10:40:52 AM UTC-7, Colin Law wrote:
>>
>> On 24 June 2015 at 18:22, Masaaki Furuki <johnm...@gmail.com> wrote:
>> > What does "User.count" didn't change by 1. Expected: 3 Actual: 2 means?
>>
>> If I asked you to guess what it means what would you say?
>> Start by looking at the test it refers to, see what you are asking it
>> to test, then try to work out the answer to your question.
>>
>> Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/b85cb187-6a21-4088-b096-9fc241e5eaaf%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Masaaki Furuki

unread,
Jun 24, 2015, 2:26:11 PM6/24/15
to rubyonra...@googlegroups.com
Colin,

So in the begging, I only had first_name and last_name in 'myapp/test/fixtures/users.yml' but there is 3rd attribute 'email' in model and controller is that what this means.

Thanks,
Masaaki

Colin Law

unread,
Jun 24, 2015, 2:56:42 PM6/24/15
to rubyonra...@googlegroups.com
On 24 June 2015 at 19:26, Masaaki Furuki <johnm...@gmail.com> wrote:
> Colin,
>
> So in the begging, I only had first_name and last_name in
> 'myapp/test/fixtures/users.yml' but there is 3rd attribute 'email' in model
> and controller is that what this means.

No, it is talking about the number of records in the users table.
Initially 2 from your test/fixtures/users.yml and it should have added
a new record. It did not add an error as you had an attribute missing
so the validation failed and therefore the record count did not
increase to three.

Colin
> https://groups.google.com/d/msgid/rubyonrails-talk/54125d9c-6005-486c-aece-b6cdaa792f83%40googlegroups.com.

Masaaki Furuki

unread,
Jun 24, 2015, 5:12:08 PM6/24/15
to rubyonra...@googlegroups.com
Thanks for you support.
Reply all
Reply to author
Forward
0 new messages