warden-github-rails-thinknear-fork 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.travis.yml +39 -0
- data/CHANGELOG.md +20 -0
- data/Gemfile +27 -0
- data/LICENSE.txt +22 -0
- data/README.md +250 -0
- data/Rakefile +6 -0
- data/VERSION +1 -0
- data/lib/warden/github/rails.rb +39 -0
- data/lib/warden/github/rails/config.rb +49 -0
- data/lib/warden/github/rails/controller_helpers.rb +39 -0
- data/lib/warden/github/rails/railtie.rb +42 -0
- data/lib/warden/github/rails/routes.rb +83 -0
- data/lib/warden/github/rails/test_helpers.rb +28 -0
- data/lib/warden/github/rails/test_helpers/mock_user.rb +30 -0
- data/lib/warden/github/rails/version.rb +9 -0
- data/spec/integration/controller_helpers_spec.rb +95 -0
- data/spec/integration/membership_spec.rb +183 -0
- data/spec/integration/route_spec.rb +82 -0
- data/spec/integration/scope_spec.rb +33 -0
- data/spec/integration/view_helpers_spec.rb +19 -0
- data/spec/rails_app/app/controllers/scoped_controller.rb +28 -0
- data/spec/rails_app/app/controllers/unscoped_controller.rb +28 -0
- data/spec/rails_app/app/controllers/view_tests_controller.rb +2 -0
- data/spec/rails_app/app/views/view_tests/authenticated.html.erb +1 -0
- data/spec/rails_app/app/views/view_tests/user.html.erb +1 -0
- data/spec/rails_app/config.ru +2 -0
- data/spec/rails_app/config/application.rb +20 -0
- data/spec/rails_app/config/boot.rb +3 -0
- data/spec/rails_app/config/environment.rb +3 -0
- data/spec/rails_app/config/environments/development.rb +8 -0
- data/spec/rails_app/config/environments/production.rb +8 -0
- data/spec/rails_app/config/environments/test.rb +11 -0
- data/spec/rails_app/config/initializers/secret_token.rb +1 -0
- data/spec/rails_app/config/initializers/session_store.rb +1 -0
- data/spec/rails_app/config/initializers/warden_github_rails.rb +12 -0
- data/spec/rails_app/config/initializers/wrap_parameters.rb +4 -0
- data/spec/rails_app/config/routes.rb +53 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/unit/config_spec.rb +67 -0
- data/spec/unit/mock_user_spec.rb +21 -0
- data/spec/unit/rails_spec.rb +11 -0
- data/spec/unit/test_helpers_spec.rb +39 -0
- data/warden-github-rails.gemspec +25 -0
- metadata +215 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Warden::GitHub::Rails::TestHelpers::MockUser do
|
4
|
+
it { should be_a Warden::GitHub::User }
|
5
|
+
|
6
|
+
describe '#stub_membership' do
|
7
|
+
subject(:user) { described_class.new }
|
8
|
+
|
9
|
+
it 'stubs memberships' do
|
10
|
+
expect(user).not_to be_team_member(123)
|
11
|
+
expect(user).not_to be_team_member(456)
|
12
|
+
expect(user).not_to be_organization_member('foobar')
|
13
|
+
|
14
|
+
user.stub_membership(:org => 'foobar', :team => [123, 456])
|
15
|
+
|
16
|
+
expect(user).to be_team_member(123)
|
17
|
+
expect(user).to be_team_member(456)
|
18
|
+
expect(user).to be_organization_member('foobar')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Warden::GitHub::Rails::TestHelpers do
|
4
|
+
describe '#github_login' do
|
5
|
+
context 'when no scope is specified' do
|
6
|
+
it 'uses the default scope from config to login' do
|
7
|
+
Warden::GitHub::Rails.stub(:default_scope => :foobar)
|
8
|
+
should_receive(:login_as).with do |_, opts|
|
9
|
+
expect(opts.fetch(:scope)).to eq(:foobar)
|
10
|
+
end
|
11
|
+
|
12
|
+
github_login
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when a scope is specified' do
|
17
|
+
it 'uses that scope to login' do
|
18
|
+
should_receive(:login_as).with do |_, opts|
|
19
|
+
expect(opts.fetch(:scope)).to eq(:admin)
|
20
|
+
end
|
21
|
+
|
22
|
+
github_login(:admin)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'logs in a mock user' do
|
27
|
+
expected_user = nil
|
28
|
+
|
29
|
+
should_receive(:login_as).with do |user, _|
|
30
|
+
expected_user = user
|
31
|
+
expect(user).to be_a(Warden::GitHub::Rails::TestHelpers::MockUser)
|
32
|
+
end
|
33
|
+
|
34
|
+
user = github_login
|
35
|
+
|
36
|
+
expect(user).to eq(expected_user)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'warden/github/rails/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = 'warden-github-rails-thinknear-fork'
|
7
|
+
gem.version = Warden::GitHub::Rails::VERSION
|
8
|
+
gem.authors = ['Philipe Fatio']
|
9
|
+
gem.email = ['me@phili.pe']
|
10
|
+
gem.summary = %q{An easy drop in solution for rails to use GitHub authentication.}
|
11
|
+
gem.description = gem.summary
|
12
|
+
gem.homepage = 'https://github.com/fphilipe/warden-github-rails'
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($/) - Dir.glob('example/**/*')
|
15
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
+
|
17
|
+
gem.add_development_dependency 'rspec', '~> 2.14'
|
18
|
+
gem.add_development_dependency 'simplecov'
|
19
|
+
gem.add_development_dependency 'rails', '>= 3.2'
|
20
|
+
gem.add_development_dependency 'rack-test', '~> 0.6'
|
21
|
+
gem.add_development_dependency 'addressable', '~> 2.3'
|
22
|
+
|
23
|
+
gem.add_dependency 'warden-github', '~> 1.0'
|
24
|
+
gem.add_dependency 'railties', '>= 3.1'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: warden-github-rails-thinknear-fork
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Philipe Fatio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: simplecov
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: addressable
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: warden-github
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: railties
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.1'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.1'
|
111
|
+
description: An easy drop in solution for rails to use GitHub authentication.
|
112
|
+
email:
|
113
|
+
- me@phili.pe
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
|
+
- .travis.yml
|
121
|
+
- CHANGELOG.md
|
122
|
+
- Gemfile
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- VERSION
|
127
|
+
- lib/warden/github/rails.rb
|
128
|
+
- lib/warden/github/rails/config.rb
|
129
|
+
- lib/warden/github/rails/controller_helpers.rb
|
130
|
+
- lib/warden/github/rails/railtie.rb
|
131
|
+
- lib/warden/github/rails/routes.rb
|
132
|
+
- lib/warden/github/rails/test_helpers.rb
|
133
|
+
- lib/warden/github/rails/test_helpers/mock_user.rb
|
134
|
+
- lib/warden/github/rails/version.rb
|
135
|
+
- spec/integration/controller_helpers_spec.rb
|
136
|
+
- spec/integration/membership_spec.rb
|
137
|
+
- spec/integration/route_spec.rb
|
138
|
+
- spec/integration/scope_spec.rb
|
139
|
+
- spec/integration/view_helpers_spec.rb
|
140
|
+
- spec/rails_app/app/controllers/scoped_controller.rb
|
141
|
+
- spec/rails_app/app/controllers/unscoped_controller.rb
|
142
|
+
- spec/rails_app/app/controllers/view_tests_controller.rb
|
143
|
+
- spec/rails_app/app/views/view_tests/authenticated.html.erb
|
144
|
+
- spec/rails_app/app/views/view_tests/user.html.erb
|
145
|
+
- spec/rails_app/config.ru
|
146
|
+
- spec/rails_app/config/application.rb
|
147
|
+
- spec/rails_app/config/boot.rb
|
148
|
+
- spec/rails_app/config/environment.rb
|
149
|
+
- spec/rails_app/config/environments/development.rb
|
150
|
+
- spec/rails_app/config/environments/production.rb
|
151
|
+
- spec/rails_app/config/environments/test.rb
|
152
|
+
- spec/rails_app/config/initializers/secret_token.rb
|
153
|
+
- spec/rails_app/config/initializers/session_store.rb
|
154
|
+
- spec/rails_app/config/initializers/warden_github_rails.rb
|
155
|
+
- spec/rails_app/config/initializers/wrap_parameters.rb
|
156
|
+
- spec/rails_app/config/routes.rb
|
157
|
+
- spec/rails_app/script/rails
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
- spec/unit/config_spec.rb
|
160
|
+
- spec/unit/mock_user_spec.rb
|
161
|
+
- spec/unit/rails_spec.rb
|
162
|
+
- spec/unit/test_helpers_spec.rb
|
163
|
+
- warden-github-rails.gemspec
|
164
|
+
homepage: https://github.com/fphilipe/warden-github-rails
|
165
|
+
licenses: []
|
166
|
+
metadata: {}
|
167
|
+
post_install_message:
|
168
|
+
rdoc_options: []
|
169
|
+
require_paths:
|
170
|
+
- lib
|
171
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
requirements: []
|
182
|
+
rubyforge_project:
|
183
|
+
rubygems_version: 2.0.7
|
184
|
+
signing_key:
|
185
|
+
specification_version: 4
|
186
|
+
summary: An easy drop in solution for rails to use GitHub authentication.
|
187
|
+
test_files:
|
188
|
+
- spec/integration/controller_helpers_spec.rb
|
189
|
+
- spec/integration/membership_spec.rb
|
190
|
+
- spec/integration/route_spec.rb
|
191
|
+
- spec/integration/scope_spec.rb
|
192
|
+
- spec/integration/view_helpers_spec.rb
|
193
|
+
- spec/rails_app/app/controllers/scoped_controller.rb
|
194
|
+
- spec/rails_app/app/controllers/unscoped_controller.rb
|
195
|
+
- spec/rails_app/app/controllers/view_tests_controller.rb
|
196
|
+
- spec/rails_app/app/views/view_tests/authenticated.html.erb
|
197
|
+
- spec/rails_app/app/views/view_tests/user.html.erb
|
198
|
+
- spec/rails_app/config.ru
|
199
|
+
- spec/rails_app/config/application.rb
|
200
|
+
- spec/rails_app/config/boot.rb
|
201
|
+
- spec/rails_app/config/environment.rb
|
202
|
+
- spec/rails_app/config/environments/development.rb
|
203
|
+
- spec/rails_app/config/environments/production.rb
|
204
|
+
- spec/rails_app/config/environments/test.rb
|
205
|
+
- spec/rails_app/config/initializers/secret_token.rb
|
206
|
+
- spec/rails_app/config/initializers/session_store.rb
|
207
|
+
- spec/rails_app/config/initializers/warden_github_rails.rb
|
208
|
+
- spec/rails_app/config/initializers/wrap_parameters.rb
|
209
|
+
- spec/rails_app/config/routes.rb
|
210
|
+
- spec/rails_app/script/rails
|
211
|
+
- spec/spec_helper.rb
|
212
|
+
- spec/unit/config_spec.rb
|
213
|
+
- spec/unit/mock_user_spec.rb
|
214
|
+
- spec/unit/rails_spec.rb
|
215
|
+
- spec/unit/test_helpers_spec.rb
|