accepts_nested_attributes is a function of the owner (Timesheet), not
the association (TimeEntry / time_entries). This:

  @timesheet.time_entries << valid_entry << wrong_entry

operates direction on the time_entries association. If you want to
test nested attributes you have to create a Timesheet model with
time_entries in the params. I don't recall the syntax for this, but
it's probably something like:

  Timesheet.new :time_entries => [ { :worktime => nil }, { :worktime
=> :something_not_nil } ]

HTH,
David

On Fri, Feb 22, 2013 at 4:11 AM, Javix <[email protected]> wrote:
> SORRY, it has NOT solved the problem, Any ideas?
>
>
> On Friday, 22 February 2013 11:05:18 UTC+1, Javix wrote:
>>
>> adding just the below to TimeEntry model fixed the problem and makes the
>> test pass:
>>
>> class TimeEntry < ActiveRecord::Base
>> ...
>>   validates :worktime, presence: true, inclusion: { in: [0.5, 1] }
>> ...
>> end
>>
>> Regards
>
> --
> 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/msg/rspec/-/8BLnK0cTKq0J.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to