Sha256: a4933e2e120c3efc20b0e1b418fa68b00454391d2d82b826efe9739fc5669708

Contents?: true

Size: 883 Bytes

Versions: 3

Compression:

Stored size: 883 Bytes

Contents

require 'spec_helper'
require 'ruby-debug'

describe 'OAuthPlayground' do
  before :each do
    @hydra = Typhoeus::Hydra.hydra
  end
  
  after :each do 
    @hydra.clear_stubs
  end
  
  it 'should load the index' do
    get '/'
    last_response.should be_ok
  end

=begin  
  # unfortunately, this fails when you pass the get method a param named code!
  # fixing this will require some mucking around in Rack::Test
  
  it "should make a request to Facebook's OAuth server when passed a code" do 
    test_string = Regexp.new("The time is #{Time.now.to_i}")

    # stub out the request and make sure it's returned
    @hydra.stub("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/access_token", "get").and_return(test_string)
    
    get "/", {"code" => "foo_bar"}

    # make sure the body includes the request string
    last_response.body.should =~ test_string
  end
=end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
koala-0.9.0 examples/oauth_playground/spec/oauth_playground_spec.rb
koala-0.7.3 examples/oauth_playground/spec/oauth_playground_spec.rb
koala-0.7.2 examples/oauth_playground/spec/oauth_playground_spec.rb