I have a controller sessions that can create session. I\'d like to call it from the console, like controller.create. Here is the action:
def create
From the console:
include ActionController::TestProcess
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@controller = SomeController.new
@request.env["omniauth.auth"] = {'provider' => "twitter", 'uid' => "1234", 'user_info' => {'name' => "foo"}}
app.get "/signup" etc
From rspec:
it "should allow login" do
request.env["omniauth.auth"] = {'provider' => "twitter", 'uid' => "1234", 'user_info' => {'name' => "foo"}}
post :create
puts @current_user.name
assigns(@current_user).should_not be_nil
end