Skip to content

Instantly share code, notes, and snippets.

@ashmoran
Forked from garethrees/integration_helper.rb
Created January 19, 2013 22:49
Show Gist options
  • Save ashmoran/4575694 to your computer and use it in GitHub Desktop.
Save ashmoran/4575694 to your computer and use it in GitHub Desktop.
require_relative 'test_helper'
require 'rack/test'
require 'minitest/autorun'
require 'capybara'
require 'capybara/dsl'
include Capybara::DSL
def app
MyApp::Server
end
Capybara.app = app
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({
:provider => 'github',
:uid => '123545',
:nickname => 'garethrees'
# etc.
})
require_relative '../integration_helper'
describe 'A User can sign in' do
include Rack::Test::Methods
before do
request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:github]
end
specify 'guest user can create an account' do
visit '/'
click_link 'Sign in with GitHub'
assert # can find user
end
end
ENV['RACK_ENV'] = 'test'
require_relative '../lib/myapp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment