I've proven I'm definitely new at this.  Turns out there is no
difference - my unit test running in the CE event_test.rb also fails.
The problem is trying to save an event in the unit test.  I suspect
that will require a functional test as it needs a valid login.

east

On Jan 5, 9:47 pm, east <[email protected]> wrote:
> OK - I'm a complete n00b at this, but I want to add a custom field or
> two to the CE event model.  To start off, I've created my own
> event_test.rb modeled after the CE version:
>
> require File.dirname(__FILE__) + '/../../vendor/plugins/
> community_engine/test/test_helper'
>
> class EventTest < ActiveSupport::TestCase
>
>   def test_base_event
>     event = Event.new(valid_event_attributes)
>     event.save
>     assert_equal(1, event.artist)
>   end
>
>   protected
>   def valid_event_attributes
>     {:name => 'A great event',
>      :user => User.new,
>      :start_time => 1.week.ago,
>      :end_time => 4.days.ago,
>      :description => 'This will be fun',
>      :metro_area => MetroArea.new
>     }
>   end
> end
>
> When running this, I get an error that about not having a login:
>  NoMethodError: You have a nil object when you didn't expect it!
>  The error occurred while evaluating nil.strip
>  app/models/user.rb:478:in `whitelist_attributes'
>      test/unit/event_test.rb:7:in `test_base_event'
>
> What I don't understand is how the CE event test works and mine
> doesn't (as mine is pretty much a stupid copy of the CE one).  Anyone
> have any ideas as to where I should look?  For that matter, any
> suggestions as to what is the best practice for creating unit or
> functional tests for extended CE models / controllers?
>
> Thanks for any help / advice in advance,
> east
-- 
You received this message because you are subscribed to the Google Groups 
"CommunityEngine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/communityengine?hl=en.


Reply via email to