warden-github-rails 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37e76cad468bc0b04658632d0eb31771dede50b3
4
- data.tar.gz: c6fecc13ba562142149e111f77030bf853b3cbb8
3
+ metadata.gz: 94c4bcff3c0978874ae4233194457aa095b6ec98
4
+ data.tar.gz: 952a958502aef15b84ca89c4912d7577ea4ab0f4
5
5
  SHA512:
6
- metadata.gz: 9a6f23ae1e3bb517759c974626c446c248cd8856fa103a8ea3c307266ef3cc713da76bd133531b7bdaf4254291a2c041f5034d0812d0fe5b43e18eb238054c46
7
- data.tar.gz: f5fe6318363b452b5556ce99949ded463fcd86c4f7a33c484b91edc50daa4d5bed824af1d7a85c054740687a1f1b21a869d0a09104d03c7177905221c3efbea1
6
+ metadata.gz: df68ab5d8e005762758a1c42ebf734a5dd477dc3b9e553658bdad6518af55b9d5ec924b9b205a924ec0f5e95b5f236bddbb2d8e4473a7db2623531a20fa58e02
7
+ data.tar.gz: a5ca3a4d19fb32f664b3ae819df6243a557f252b01b59382965507b49cb99d88be888b1c9cdf0eb8d931205a541f480c2b337441f8ba7303d16c4639eafc4c2e
data/.travis.yml CHANGED
@@ -1,39 +1,23 @@
1
1
  language: ruby
2
2
  script: "bundle exec rspec"
3
3
  rvm:
4
- - 1.8.7
5
4
  - 1.9.2
6
5
  - 1.9.3
7
6
  - 2.0.0
8
7
  - ruby-head
9
- - jruby-18mode # JRuby in 1.8 mode
10
8
  - jruby-19mode # JRuby in 1.9 mode
11
- - rbx-18mode
12
9
  - rbx-19mode
13
10
  env:
14
11
  - "RAILS_VERSION=3.1.0"
15
12
  - "RAILS_VERSION=3.2.0"
16
- - "RAILS_VERSION=4.0.0.pre"
13
+ - "RAILS_VERSION=4.0.0"
17
14
  - "RAILS_VERSION=master"
18
15
  matrix:
19
16
  allow_failures:
20
17
  - env: "RAILS_VERSION=master"
21
18
  - rvm: ruby-head
22
19
  exclude:
23
- - rvm: 1.8.7
24
- env: "RAILS_VERSION=4.0.0.pre"
25
20
  - rvm: 1.9.2
26
- env: "RAILS_VERSION=4.0.0.pre"
27
- - rvm: jruby-18mode
28
- env: "RAILS_VERSION=4.0.0.pre"
29
- - rvm: rbx-18mode
30
- env: "RAILS_VERSION=4.0.0.pre"
31
- - rvm: 1.8.7
32
21
  env: "RAILS_VERSION=master"
33
22
  - rvm: 1.9.2
34
- env: "RAILS_VERSION=master"
35
- - rvm: jruby-18mode
36
- env: "RAILS_VERSION=master"
37
- - rvm: rbx-18mode
38
- env: "RAILS_VERSION=master"
39
-
23
+ env: "RAILS_VERSION=4.0.0"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.1.0
4
+
5
+ - Upgrade to octokit.rb version 2
6
+ - Require ruby 1.9 or higher
7
+
3
8
  ## v1.0.1
4
9
 
5
10
  - Fully test on Rails 4
data/Gemfile CHANGED
@@ -3,14 +3,14 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  if ENV['EDGE']
6
- gem 'warden-github', :github => 'atmos/warden-github'
6
+ gem 'warden-github', github: 'atmos/warden-github'
7
7
  end
8
8
 
9
9
  rails_version = ENV['RAILS_VERSION']
10
10
 
11
11
  rails_opts = case rails_version
12
12
  when 'master'
13
- { :github => 'rails/rails' }
13
+ { github: 'rails/rails' }
14
14
  when nil
15
15
  {}
16
16
  else
@@ -21,7 +21,7 @@ gem "rails", rails_opts
21
21
 
22
22
  group :development do
23
23
  unless ENV['CI']
24
- gem 'debugger', :platforms => :ruby_19, :require => false
25
- gem 'ruby-debug', :platforms => :ruby_18, :require => false
24
+ gem 'debugger', platforms: :ruby_19, require: false
25
+ gem 'ruby-debug', platforms: :ruby_18, require: false
26
26
  end
27
27
  end
data/README.md CHANGED
@@ -22,12 +22,12 @@ They allow you to restrict access to members of your organization or a certain t
22
22
  This is how your rails `routes.rb` could look like:
23
23
 
24
24
  ```ruby
25
- constraints(:subdomain => 'admin') do
26
- github_authenticate(:org => 'my_company_inc') do
25
+ constraints(subdomain: 'admin') do
26
+ github_authenticate(org: 'my_company_inc') do
27
27
  resources :users
28
28
  resources :projects
29
29
 
30
- github_authenticated(:team => 'sysadmins') do
30
+ github_authenticated(team: 'sysadmins') do
31
31
  resource :infrastructure
32
32
  end
33
33
  end
@@ -43,14 +43,14 @@ class UsersController < ApplicationController
43
43
 
44
44
  def new
45
45
  github_authenticate! # Performs OAuth flow when not logged in.
46
- @user = User.new(:name => github_user.name, :email => github_user.email)
46
+ @user = User.new(name: github_user.name, email: github_user.email)
47
47
  end
48
48
 
49
49
  def create
50
- attrs = params.require(:user).permit(:name, :email).merge(:github_id => github_user.id)
50
+ attrs = params.require(:user).permit(:name, :email).merge(github_id: github_user.id)
51
51
  @user = User.create(attrs)
52
52
 
53
- if @user
53
+ if @user.persisted?
54
54
  redirect_to :show
55
55
  else
56
56
  render :new
@@ -61,12 +61,30 @@ class UsersController < ApplicationController
61
61
  end
62
62
  ```
63
63
 
64
+ ## Example App
65
+
66
+ This repository includes an example app in [example/](example/).
67
+ To play with it, follow these steps:
68
+
69
+ 1. [Create an OAuth application in your GitHub settings](https://github.com/settings/applications/new).
70
+ Set the callback URL to `http://localhost:3000/`
71
+
72
+ 2. Check out this repo and run:
73
+
74
+ ```
75
+ $ bundle
76
+ $ cd example
77
+ $ GITHUB_CLIENT_ID=your_id_from_step1 GITHUB_CLIENT_SECRET=your_secret_from_step1 bundle exec rails s
78
+ ```
79
+
80
+ 3. Point your browser to [http://localhost:3000/](http://localhost:3000/) and enjoy!
81
+
64
82
  ## Installation
65
83
 
66
84
  To use this gem, add it to your `Gemfile`:
67
85
 
68
86
  ```ruby
69
- gem 'warden-github-rails', '~> 1.0'
87
+ gem 'warden-github-rails', '~> 1.1.0'
70
88
  ```
71
89
 
72
90
  If you're using devise, make sure to use version 2.2.4 or newer.
@@ -88,14 +106,14 @@ Here's how such a config might look like:
88
106
 
89
107
  ```ruby
90
108
  Warden::GitHub::Rails.setup do |config|
91
- config.add_scope :user, :client_id => 'foo',
92
- :client_secret => 'bar',
93
- :scope => 'user'
109
+ config.add_scope :user, client_id: 'foo',
110
+ client_secret: 'bar',
111
+ scope: 'user'
94
112
 
95
- config.add_scope :admin, :client_id => 'abc',
96
- :client_secret => 'xyz',
97
- :redirect_uri => '/admin/login/callback',
98
- :scope => 'repo'
113
+ config.add_scope :admin, client_id: 'abc',
114
+ client_secret: 'xyz',
115
+ redirect_uri: '/admin/login/callback',
116
+ scope: 'repo'
99
117
 
100
118
  config.default_scope = :admin
101
119
 
@@ -129,17 +147,17 @@ github_unauthenticated do
129
147
  end
130
148
 
131
149
  # Only matches when member of the organization. Initiates login if not logged in.
132
- github_authenticate(:org => 'my_company') do
150
+ github_authenticate(org: 'my_company') do
133
151
  resource :admin
134
152
  end
135
153
 
136
154
  # Only matches when member of the team. Does not initiate login if not logged in.
137
- github_authenticated(:team => 'markting') do
155
+ github_authenticated(team: 'markting') do
138
156
  get '/dashboard' => 'dashboard#show'
139
157
  end
140
158
 
141
159
  # Using dynamic membership values:
142
- github_authenticate(:org => lambda { |req| r.params[:id] }) do
160
+ github_authenticate(org: lambda { |req| req.params[:id] }) do
143
161
  get '/orgs/:id' => 'orgs#show'
144
162
  end
145
163
  ```
@@ -162,7 +180,7 @@ class SomeController < ActionController::Base
162
180
 
163
181
  def settings
164
182
  github_authenticate!
165
- @settings = UserSettings.find_by_github_user_id(github_user.id)
183
+ @settings = UserSettings.find_by(github_user_id: github_user.id)
166
184
  end
167
185
 
168
186
  def finish_wizard
@@ -177,7 +195,10 @@ end
177
195
 
178
196
  ### Communicating with the GitHub API
179
197
 
180
- Once a user is logged in, you'll have access to it in the controller using `github_user`. It is an instance of `Warden::GitHub::User` which is defined in the [warden-github](https://github.com/atmos/warden-github/blob/master/lib/warden/github/user.rb) gem. The instance has several methods to access user information such as `#name`, `#id`, `#email`, etc. It also features a method `#api` which returns a preconfigured [Octokit](https://github.com/pengwynn/octokit) client for that user.
198
+ Once a user is logged in, you'll have access to it in the controller using `github_user`.
199
+ It is an instance of `Warden::GitHub::User` which is defined in the [warden-github](https://github.com/atmos/warden-github/blob/master/lib/warden/github/user.rb) gem.
200
+ The instance has several methods to access user information such as `#name`, `#id`, `#email`, etc.
201
+ It also features a method `#api` which returns a preconfigured [Octokit](https://github.com/octokit/octokit.rb) client for that user.
181
202
 
182
203
  ### Test Helpers
183
204
 
@@ -239,7 +260,7 @@ This functionality is used in this gem in order to setup the github strategy for
239
260
 
240
261
  - [warden-github](https://github.com/atmos/warden-github)
241
262
  - [warden](https://github.com/hassox/warden)
242
- - [octokit](https://github.com/pengwynn/octokit)
263
+ - [octokit](https://github.com/octokit/octokit.rb)
243
264
 
244
265
  ### Maintainers
245
266
 
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
@@ -9,7 +9,7 @@ module Warden
9
9
  # Initiates the OAuth flow if not already authenticated for the
10
10
  # specified scope.
11
11
  def github_authenticate!(scope=Rails.default_scope)
12
- request.env['warden'].authenticate!(:scope => scope)
12
+ request.env['warden'].authenticate!(scope: scope)
13
13
  end
14
14
 
15
15
  # Logs out a user if currently logged in for the specified scope.
@@ -25,8 +25,8 @@ module Warden
25
25
 
26
26
  def setup_scopes(config)
27
27
  Rails.scopes.each do |scope, scope_config|
28
- config.scope_defaults scope, :strategies => [:github],
29
- :config => scope_config
28
+ config.scope_defaults scope, strategies: [:github],
29
+ config: scope_config
30
30
  end
31
31
  end
32
32
 
@@ -6,10 +6,10 @@ module Warden
6
6
  # authenticated, it initiates the OAuth flow.
7
7
  #
8
8
  # Team and organization memberships can be checked by specifying a hash
9
- # such as `:team => 'foobar'` or `:org => 'my_company'`.
9
+ # such as `team: 'foobar'` or `org: 'my_company'`.
10
10
  def github_authenticate(scope=nil, options={}, &routes_block)
11
11
  github_constraint(scope, options, routes_block) do |warden, scope|
12
- warden.authenticate!(:scope => scope)
12
+ warden.authenticate!(scope: scope)
13
13
  end
14
14
  end
15
15
 
@@ -17,10 +17,10 @@ module Warden
17
17
  # not authenticated, it does not initiate the OAuth flow.
18
18
  #
19
19
  # Team and organization memberships can be checked by specifying a hash
20
- # such as `:team => 'foobar'` or `:org => 'my_company'`.
20
+ # such as `team: 'foobar'` or `org: 'my_company'`.
21
21
  def github_authenticated(scope=nil, options={}, &routes_block)
22
22
  github_constraint(scope, options, routes_block) do |warden, scope|
23
- warden.authenticated?(:scope => scope)
23
+ warden.authenticated?(scope: scope)
24
24
  end
25
25
  end
26
26
 
@@ -30,7 +30,7 @@ module Warden
30
30
  # limited usage.
31
31
  def github_unauthenticated(scope=nil, options={}, &routes_block)
32
32
  github_constraint(scope, options, routes_block) do |warden, scope|
33
- not warden.authenticated?(:scope => scope)
33
+ not warden.authenticated?(scope: scope)
34
34
  end
35
35
  end
36
36
 
@@ -7,7 +7,7 @@ module Warden
7
7
 
8
8
  def initialize(*args)
9
9
  super
10
- @memberships = { :team => [], :org => [] }
10
+ @memberships = { team: [], org: [] }
11
11
  end
12
12
 
13
13
  def stub_membership(args)
@@ -10,7 +10,7 @@ module Warden
10
10
  # Login a mock GitHub user and return it.
11
11
  def github_login(scope=Rails.default_scope)
12
12
  MockUser.new.tap do |user|
13
- login_as(user, :scope => scope)
13
+ login_as(user, scope: scope)
14
14
  end
15
15
  end
16
16
  end
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe 'controller helpers' do
4
4
  {
5
- :scoped => :admin,
6
- :unscoped => Warden::GitHub::Rails.default_scope
5
+ scoped: :admin,
6
+ unscoped: Warden::GitHub::Rails.default_scope
7
7
  }.each do |type, scope|
8
8
  context "when using #{type}" do
9
9
  describe '#github_authenticate!' do
@@ -86,7 +86,7 @@ describe 'controller helpers' do
86
86
  context 'when logged in' do
87
87
  it "returns the user's session" do
88
88
  github_login(scope)
89
- expect(request.body).to eq({ :foo => :bar }.to_s)
89
+ expect(request.body).to eq({ foo: :bar }.to_s)
90
90
  end
91
91
  end
92
92
  end
@@ -13,7 +13,7 @@ describe 'request to a protected resource' do
13
13
  context 'and team member' do
14
14
  before do
15
15
  user = github_login
16
- user.stub_membership(:team => 123)
16
+ user.stub_membership(team: 123)
17
17
  end
18
18
 
19
19
  it { should be_ok }
@@ -37,7 +37,7 @@ describe 'request to a protected resource' do
37
37
  context 'and team member' do
38
38
  before do
39
39
  user = github_login
40
- user.stub_membership(:team => 456)
40
+ user.stub_membership(team: 456)
41
41
  end
42
42
 
43
43
  it { should be_ok }
@@ -57,7 +57,7 @@ describe 'request to a protected resource' do
57
57
  context 'and team member' do
58
58
  before do
59
59
  user = github_login
60
- user.stub_membership(:team => 123)
60
+ user.stub_membership(team: 123)
61
61
  end
62
62
 
63
63
  it { should be_ok }
@@ -72,7 +72,7 @@ describe 'request to a protected resource' do
72
72
  end
73
73
 
74
74
  context 'that requires an organization membership' do
75
- { :org => :foobar_inc, :organization => 'some_org' }.each do |key, value|
75
+ { org: :foobar_inc, organization: 'some_org' }.each do |key, value|
76
76
  context "which is specified as #{key}" do
77
77
  subject { get "/#{key}/protected" }
78
78
 
@@ -84,7 +84,7 @@ describe 'request to a protected resource' do
84
84
  context 'and organization member' do
85
85
  before do
86
86
  user = github_login
87
- user.stub_membership(:org => value)
87
+ user.stub_membership(org: value)
88
88
  end
89
89
 
90
90
  it { should be_ok }
@@ -105,7 +105,7 @@ describe 'request to a protected resource' do
105
105
  context 'and organization member' do
106
106
  before do
107
107
  user = github_login
108
- user.stub_membership(:org => 'some_org')
108
+ user.stub_membership(org: 'some_org')
109
109
  end
110
110
 
111
111
  it { should be_ok }
@@ -128,7 +128,7 @@ describe 'request to a resource that only exists when logged in' do
128
128
  context 'when team member' do
129
129
  before do
130
130
  user = github_login
131
- user.stub_membership(:team => 123)
131
+ user.stub_membership(team: 123)
132
132
  end
133
133
 
134
134
  it { should be_ok }
@@ -146,7 +146,7 @@ describe 'request to a resource that only exists when logged in' do
146
146
  context 'when team member' do
147
147
  before do
148
148
  user = github_login
149
- user.stub_membership(:team => 456)
149
+ user.stub_membership(team: 456)
150
150
  end
151
151
 
152
152
  it { should be_ok }
@@ -160,14 +160,14 @@ describe 'request to a resource that only exists when logged in' do
160
160
  end
161
161
 
162
162
  context 'that requires an organization membership' do
163
- { :org => :foobar_inc, :organization => 'some_org' }.each do |key, value|
163
+ { org: :foobar_inc, organization: 'some_org' }.each do |key, value|
164
164
  context "which is specified as #{key}" do
165
165
  subject { get "/#{key}/conditional" }
166
166
 
167
167
  context 'when organization member' do
168
168
  before do
169
169
  user = github_login
170
- user.stub_membership(:org => value)
170
+ user.stub_membership(org: value)
171
171
  end
172
172
 
173
173
  it { should be_ok }
@@ -16,18 +16,18 @@ describe 'request to custom configured scope' do
16
16
  context 'user' do
17
17
  it 'passes the correct configs to the oauth flow' do
18
18
  test_redirect('/protected',
19
- :client_id => 'foo',
20
- :redirect_uri => /\/protected$/,
21
- :scope => 'user')
19
+ client_id: 'foo',
20
+ redirect_uri: /\/protected$/,
21
+ scope: 'user')
22
22
  end
23
23
  end
24
24
 
25
25
  context 'admin' do
26
26
  it 'passes the correct configs to the oauth flow' do
27
27
  test_redirect('/admin/protected',
28
- :client_id => 'abc',
29
- :redirect_uri => /\/admin\/login\/callback$/,
30
- :scope => 'repo')
28
+ client_id: 'abc',
29
+ redirect_uri: /\/admin\/login\/callback$/,
30
+ scope: 'repo')
31
31
  end
32
32
  end
33
33
  end
@@ -1,21 +1,21 @@
1
1
  class ScopedController < ActionController::Base
2
2
  def authenticate
3
3
  github_authenticate!(:admin)
4
- render :nothing => true
4
+ render nothing: true
5
5
  end
6
6
 
7
7
  def logout
8
8
  was_logged_in = !github_user(:admin).nil?
9
9
  github_logout(:admin)
10
- render :text => was_logged_in
10
+ render text: was_logged_in
11
11
  end
12
12
 
13
13
  def authenticated
14
- render :text => github_authenticated?(:admin)
14
+ render text: github_authenticated?(:admin)
15
15
  end
16
16
 
17
17
  def user
18
- render :text => github_user(:admin)
18
+ render text: github_user(:admin)
19
19
  end
20
20
 
21
21
  def session
@@ -23,6 +23,6 @@ class ScopedController < ActionController::Base
23
23
  session[:foo] = :bar
24
24
  end
25
25
 
26
- render :text => github_session(:admin)
26
+ render text: github_session(:admin)
27
27
  end
28
28
  end
@@ -1,21 +1,21 @@
1
1
  class UnscopedController < ActionController::Base
2
2
  def authenticate
3
3
  github_authenticate!
4
- render :nothing => true
4
+ render nothing: true
5
5
  end
6
6
 
7
7
  def logout
8
8
  was_logged_in = !github_user.nil?
9
9
  github_logout
10
- render :text => was_logged_in
10
+ render text: was_logged_in
11
11
  end
12
12
 
13
13
  def authenticated
14
- render :text => github_authenticated?
14
+ render text: github_authenticated?
15
15
  end
16
16
 
17
17
  def user
18
- render :text => github_user
18
+ render text: github_user
19
19
  end
20
20
 
21
21
  def session
@@ -23,6 +23,6 @@ class UnscopedController < ActionController::Base
23
23
  session[:foo] = :bar
24
24
  end
25
25
 
26
- render :text => github_session
26
+ render text: github_session
27
27
  end
28
28
  end
@@ -1 +1 @@
1
- RailsApp::Application.config.session_store :cookie_store, :key => '_rails_app_session'
1
+ RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -1,12 +1,12 @@
1
1
  Warden::GitHub::Rails.setup do |config|
2
- config.add_scope :user, :client_id => ENV['GITHUB_CLIENT_ID'] || 'foo',
3
- :client_secret => ENV['GITHUB_CLIENT_SECRET'] || 'bar',
4
- :scope => 'user'
2
+ config.add_scope :user, client_id: ENV['GITHUB_CLIENT_ID'] || 'foo',
3
+ client_secret: ENV['GITHUB_CLIENT_SECRET'] || 'bar',
4
+ scope: 'user'
5
5
 
6
- config.add_scope :admin, :client_id => ENV['GITHUB_CLIENT_ID'] || 'abc',
7
- :client_secret => ENV['GITHUB_CLIENT_SECRET'] || 'xyz',
8
- :redirect_uri => '/admin/login/callback',
9
- :scope => 'repo'
6
+ config.add_scope :admin, client_id: ENV['GITHUB_CLIENT_ID'] || 'abc',
7
+ client_secret: ENV['GITHUB_CLIENT_SECRET'] || 'xyz',
8
+ redirect_uri: '/admin/login/callback',
9
+ scope: 'repo'
10
10
 
11
11
  config.add_team :marketing, 456
12
12
  end
@@ -1,4 +1,4 @@
1
1
  ActiveSupport.on_load(:action_controller) do
2
- wrap_parameters :format => [:json]
2
+ wrap_parameters format: [:json]
3
3
  end
4
4
 
@@ -15,23 +15,23 @@ RailsApp::Application.routes.draw do
15
15
  github_authenticated(:admin) { get '/admin/conditional' => responses[200] }
16
16
  github_unauthenticated(:admin) { get '/admin/conditional_inverse' => responses[200] }
17
17
 
18
- github_authenticate(:team => 123) { get '/team/protected' => responses[200] }
19
- github_authenticated(:team => 123) { get '/team/conditional' => responses[200] }
18
+ github_authenticate(team: 123) { get '/team/protected' => responses[200] }
19
+ github_authenticated(team: 123) { get '/team/conditional' => responses[200] }
20
20
 
21
- github_authenticate(:team => :marketing) { get '/team_alias/protected' => responses[200] }
22
- github_authenticated(:team => :marketing) { get '/team_alias/conditional' => responses[200] }
21
+ github_authenticate(team: :marketing) { get '/team_alias/protected' => responses[200] }
22
+ github_authenticated(team: :marketing) { get '/team_alias/conditional' => responses[200] }
23
23
 
24
- github_authenticate(:org => :foobar_inc) { get '/org/protected' => responses[200] }
25
- github_authenticated(:org => :foobar_inc) { get '/org/conditional' => responses[200] }
24
+ github_authenticate(org: :foobar_inc) { get '/org/protected' => responses[200] }
25
+ github_authenticated(org: :foobar_inc) { get '/org/conditional' => responses[200] }
26
26
 
27
- github_authenticate(:organization => 'some_org') { get '/organization/protected' => responses[200] }
28
- github_authenticated(:organization => 'some_org') { get '/organization/conditional' => responses[200] }
27
+ github_authenticate(organization: 'some_org') { get '/organization/protected' => responses[200] }
28
+ github_authenticated(organization: 'some_org') { get '/organization/conditional' => responses[200] }
29
29
 
30
- github_authenticated(:org => lambda { |req| req.params[:id] }) do
30
+ github_authenticated(org: lambda { |req| req.params[:id] }) do
31
31
  get '/dynamic_org/:id' => responses[200]
32
32
  end
33
33
 
34
- github_authenticated(:team => lambda { |req| req.params[:id] }) do
34
+ github_authenticated(team: lambda { |req| req.params[:id] }) do
35
35
  get '/dynamic_team/:id' => responses[200]
36
36
  end
37
37
 
@@ -11,7 +11,7 @@ describe Warden::GitHub::Rails::TestHelpers::MockUser do
11
11
  expect(user).not_to be_team_member(456)
12
12
  expect(user).not_to be_organization_member('foobar')
13
13
 
14
- user.stub_membership(:org => 'foobar', :team => [123, 456])
14
+ user.stub_membership(org: 'foobar', team: [123, 456])
15
15
 
16
16
  expect(user).to be_team_member(123)
17
17
  expect(user).to be_team_member(456)
@@ -4,7 +4,7 @@ describe Warden::GitHub::Rails::TestHelpers do
4
4
  describe '#github_login' do
5
5
  context 'when no scope is specified' do
6
6
  it 'uses the default scope from config to login' do
7
- Warden::GitHub::Rails.stub(:default_scope => :foobar)
7
+ Warden::GitHub::Rails.stub(default_scope: :foobar)
8
8
  should_receive(:login_as).with do |_, opts|
9
9
  expect(opts.fetch(:scope)).to eq(:foobar)
10
10
  end
@@ -20,6 +20,6 @@ Gem::Specification.new do |gem|
20
20
  gem.add_development_dependency 'rack-test', '~> 0.6'
21
21
  gem.add_development_dependency 'addressable', '~> 2.3'
22
22
 
23
- gem.add_dependency 'warden-github', '~> 0.14.0'
23
+ gem.add_dependency 'warden-github', '~> 1.0'
24
24
  gem.add_dependency 'railties', '>= 3.1'
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warden-github-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipe Fatio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-06 00:00:00.000000000 Z
11
+ date: 2013-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: 0.14.0
89
+ version: '1.0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: 0.14.0
96
+ version: '1.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: railties
99
99
  requirement: !ruby/object:Gem::Requirement