Skip to content

Instantly share code, notes, and snippets.

@mulderp
Created September 27, 2012 14:31
Show Gist options
  • Save mulderp/3794314 to your computer and use it in GitHub Desktop.
Save mulderp/3794314 to your computer and use it in GitHub Desktop.
API spec
require 'spec_helper'
require 'vcr'
require 'fakeweb'
require 'pry'
VCR.configure do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.hook_into :fakeweb
end
describe OmniAuth::Strategies::OAuthConnect do
def app
Rack::Builder.new {
use Rack::Session::Cookie
use OmniAuth::Strategies::OAuthConnect, "handle", "appid", "http://0.0.0.0:3000/oauth2/authorize"
run lambda {|env| [404, {'Content-Type' => 'text/plain'}, [nil || env.key?('omniauth.auth').to_s]] }
}.to_app
end
let(:auth_hash) { last_request.env['omniauth.auth'] }
describe "#request_phase" do
it "should redirect to fidor with session_id" do
VCR.use_cassette 'request_phase' do
get '/auth/fidor_connect'
last_response.should be_redirect
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment