Skip to content

Instantly share code, notes, and snippets.

@harssh
Forked from kossnocorp/Gemfile
Created May 16, 2024 21:55
Show Gist options
  • Save harssh/d249717a62ca831384f9a4f1e46315d9 to your computer and use it in GitHub Desktop.
Save harssh/d249717a62ca831384f9a4f1e46315d9 to your computer and use it in GitHub Desktop.
...
Devise::OmniAuth.test_mode!
Before do
Devise::OmniAuth.short_circuit_authorizers!
Devise::OmniAuth.stub!(:facebook) do |b|
b.post('/oauth/access_token') do
[200, {}, { :access_token => 'facebook_access_token' }.to_json]
end
b.get('/me?access_token=facebook_access_token') do
[
200, {},
{
:id => '1111111111',
:link => 'http://facebook.com/username',
:email => 'username@example.com',
:first_name => 'User',
:last_name => 'Name',
:website => 'http://relike.com/users/username'
}.to_json
]
end
end
end
After do
Devise::OmniAuth.unshort_circuit_authorizers!
Devise::OmniAuth.reset_stubs!
end
...
...
gem 'devise',
:git => 'https://github.com/plataformatec/devise.git',
:branch => 'omniauth'
gem 'oa-oauth', :require => 'omniauth/oauth'
...
group :development, :test do
...
gem 'cucumber-rails', '0.3.2'
gem 'cucumber', '0.9.3'
...
end
...
Scenario: New user click on "Login" and login into relike
Given I am on the home page
When I follow "Login"
Then I should see "Successfully authorized from Facebook account."
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment