I came up with this code:

   def mock_result(stubs = {})
     @result ||= mock('Object', stubs)
   end

    describe "being an administrator" do
      it "should create a new user using OpenID authentication" do
 
@controller.should_receive(:authenticate_with_open_id).with(@identity_url,
anything()).and_yield(mock_result(:successful? => true),
@identity_url, mock_registration)
        User.should_receive(:create_with_role).and_return(@user =
create_operator_user)
        do_verb
        response.should redirect_to(users_path)
      end
    end

which doesn't give any error and seems pretty fine to me. Is this the
way it is meant to be done?

Thanks for your help
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to