Here''s part of a spec (with some details changed/omitted) for an
observer
that notifies another system via a SOAP API that a user was created:
describe UserObserver do
  before(:each) do
    @observer = UserObserver.instance
  end
  it "sends notification of creation" do
    user = mock_model(User, :email_address =>
"user-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org", ...)
    expected_attributes = {
      :id => user.id,
      :"email-address" => user.email_address,
      ...
    }
    SomeApi.should_receive(:user_created).with(:attributes =>
expected_attributes).and_return("created")
    @observer.after_create(user)
  end
end
When testing your model that this observer observes, you might want to use
the no peeping toms plugin [
http://github.com/pat-maddox/no-peeping-toms/tree/master ] to prevent
observers from being notified.
Regards,
Craig
-- 
Craig Demyanovich
Mutually Human Software
http://mutuallyhuman.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---