Skip to content

Instantly share code, notes, and snippets.

@garethrees
Last active December 11, 2015 08:39
Show Gist options
  • Save garethrees/4575000 to your computer and use it in GitHub Desktop.
Save garethrees/4575000 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'
@garethrees
Copy link
Author

Getting the following error:

ERROR
  wrong number of arguments (0 for 1)
  /Users/gareth/.rvm/gems/ruby-1.9.3-p327/gems/rack-test-0.6.2/lib/rack/test.rb:121:in `request'
  test/integration/sign_in_spec.rb:8:in `block (2 levels) in <top (required)>'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment