hancock-client 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'spec/rake/spectask'
6
6
  require 'cucumber/rake/task'
7
7
 
8
8
  GEM = "hancock-client"
9
- GEM_VERSION = "0.0.6"
9
+ GEM_VERSION = "0.0.7"
10
10
  AUTHOR = "Corey Donohoe"
11
11
  EMAIL = ['atmos@atmos.org', 'tim@spork.in']
12
12
  HOMEPAGE = "http://github.com/atmos/hancock-client"
@@ -25,9 +25,9 @@ spec = Gem::Specification.new do |s|
25
25
  s.homepage = HOMEPAGE
26
26
 
27
27
  # Uncomment this to add a dependency
28
- s.add_dependency "sinatra", ">=0.9.1.3"
29
- s.add_dependency "ruby-openid", ">=2.1.6"
30
-
28
+ s.add_dependency "sinatra", "~>0.9.2"
29
+ s.add_dependency "ruby-openid", "~>2.1.6"
30
+ s.add_dependency "haml", "~>2.0.9"
31
31
  s.require_path = 'lib'
32
32
  s.autorequire = GEM
33
33
  s.files = %w(LICENSE README.md Rakefile) + Dir.glob("{lib,spec}/**/*")
@@ -61,8 +61,6 @@ end
61
61
  Cucumber::Rake::Task.new(:features) do |t|
62
62
  t.libs << 'lib'
63
63
  t.cucumber_opts = "--format pretty"
64
- t.step_list = 'spec/features/**/*.rb'
65
- t.feature_list = 'spec/features/**/*.feature'
66
64
  t.rcov = true
67
65
  t.rcov_opts << '--text-summary'
68
66
  t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
@@ -1,5 +1,4 @@
1
- gem 'sinatra', '~>0.9.1.3'
2
- require 'rack'
1
+ gem 'sinatra', '~>0.9.2'
3
2
  require 'sinatra/base'
4
3
 
5
4
  gem 'ruby-openid', '>=2.1.6'
@@ -15,13 +14,13 @@ module Hancock
15
14
  class Default < ::Sinatra::Base
16
15
  enable :sessions
17
16
  disable :raise_errors
17
+ disable :show_exceptions
18
18
 
19
19
  set :sso_url, nil
20
20
 
21
21
  def sso_url=(url)
22
22
  options.sso_url = url
23
23
  end
24
-
25
24
  register Sinatra::Hancock::SSO
26
25
  end
27
26
  end
File without changes
@@ -19,6 +19,11 @@ module Sinatra
19
19
  def self.registered(app)
20
20
  app.use(Rack::OpenID)
21
21
  app.helpers Hancock::SSO::Helpers
22
+
23
+ app.not_found do
24
+ next if session[:user_id]
25
+ end
26
+
22
27
  app.before do
23
28
  next if request.path_info == '/sso/login'
24
29
  next if request.path_info == '/sso/logout'
@@ -9,26 +9,14 @@ describe Sinatra::Hancock::SSO do
9
9
  last_response.headers['Location'].should eql('http://localhost:20000/login?return_to=http://example.org/sso/login')
10
10
  end
11
11
 
12
- it "should protect the root url from HTTP post" do
13
- post '/'
14
- last_response.headers['Location'].should eql('/sso/login')
15
- end
16
-
17
- it "should protect the root url from HTTP head" do
18
- head '/'
19
- last_response.headers['Location'].should eql('/sso/login')
12
+ %w(get post put head delete).each do |verb|
13
+ it "should protect the root url from HTTP #{verb}" do
14
+ send(verb, '/')
15
+ last_response.headers['Location'].should eql('/sso/login')
16
+ get last_response.headers['Location']
17
+ last_response.headers['Location'].should eql('http://localhost:20000/login?return_to=http://example.org/sso/login')
18
+ end
20
19
  end
21
-
22
- it "should protect the root url from HTTP put" do
23
- put '/'
24
- last_response.headers['Location'].should eql('/sso/login')
25
- end
26
-
27
- it "should protect the root url from HTTP delete" do
28
- delete '/'
29
- last_response.headers['Location'].should eql('/sso/login')
30
- end
31
-
32
20
  it "should greet the user when authenticated" do
33
21
  pending
34
22
  get '/'
data/spec/spec_helper.rb CHANGED
@@ -7,10 +7,8 @@ gem 'webrat', '~>0.4.2'
7
7
  require 'webrat'
8
8
  require 'dm-sweatshop'
9
9
 
10
- gem 'sinatra', '~>0.9.1.3'
11
- require 'sinatra/base'
12
10
  require 'sinatra/hancock/sso'
13
- gem 'rack-test', '~>0.1.0'
11
+ gem 'rack-test', '~>0.3.0'
14
12
  require 'rack/test'
15
13
 
16
14
  require 'hancock-client'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hancock-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Donohoe
@@ -9,7 +9,7 @@ autorequire: hancock-client
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-01 00:00:00 -06:00
12
+ date: 2009-06-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,9 +18,9 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.1.3
23
+ version: 0.9.2
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ruby-openid
@@ -28,10 +28,20 @@ dependencies:
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.1.6
34
34
  version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: haml
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 2.0.9
44
+ version:
35
45
  description: Hancock SSO rack middleware written in sinatra
36
46
  email:
37
47
  - atmos@atmos.org
@@ -51,13 +61,8 @@ files:
51
61
  - lib/rack-openid.rb
52
62
  - lib/sinatra
53
63
  - lib/sinatra/hancock
64
+ - lib/sinatra/hancock/mock.rb
54
65
  - lib/sinatra/hancock/sso.rb
55
- - spec/features
56
- - spec/features/signing_up.feature
57
- - spec/features/step_definitions
58
- - spec/features/step_definitions/signup_steps.rb
59
- - spec/features/support
60
- - spec/features/support/env.rb
61
66
  - spec/hancock_sinatra_spec.rb
62
67
  - spec/spec_helper.rb
63
68
  has_rdoc: true
@@ -1,17 +0,0 @@
1
- Feature: Signing Up for an SSO Account
2
- In order to get users involved
3
- As a new user
4
- Scenario: Signing Up
5
- When I request a page on the Site
6
- And I am redirected to the SSO Server
7
- Then I should click the signup button
8
- When the page loads I should see a signup form
9
- Then I fill out the required information
10
- And click submit
11
- Then I should receive a registration URL
12
- When I click on the registration URL
13
- Then I should be prompted to enter my new password
14
- When I provide a new password
15
- And click Am I Done Yet?
16
- Then I should be redirected back to the consumer application
17
- Then I should know a little bit about myself as a user
@@ -1,62 +0,0 @@
1
- When /^I request a page on the Site$/ do
2
- browser.goto('http://localhost:4567/sso/logout')
3
- browser.goto('http://localhost:4567/')
4
- end
5
-
6
- And /^I am redirected to the SSO Server$/ do
7
- true
8
- end
9
-
10
- Then /^I should click the signup button$/ do
11
- browser.link(:url, "#{sso_server}/signup").click
12
- end
13
-
14
- When /^the page loads I should see a signup form$/ do
15
- browser.html.should have_selector("input[type='text'][name='first_name']")
16
- end
17
-
18
- Then /^I fill out the required information$/ do
19
- @email = /\w+@\w+\.\w{2,3}/.gen.downcase
20
- @first_name, @last_name = /\w+/.gen.capitalize, /\w+/.gen.capitalize
21
- browser.text_field(:name, :first_name).set(@first_name)
22
- browser.text_field(:name, :last_name).set(@last_name)
23
- browser.text_field(:name, :email).set(@email)
24
- end
25
-
26
- And /^click submit$/ do
27
- browser.button(:value, 'Signup').click
28
- end
29
-
30
- Then /^I should receive a registration URL$/ do
31
- @register_url = browser.html.match(%r!#{sso_server}/register/\w{40}!).to_s
32
- @register_url.should_not eql('')
33
- @password = /\w+{9,32}/.gen
34
- end
35
-
36
- When /^I click on the registration URL$/ do
37
- browser.goto(@register_url)
38
- end
39
-
40
- Then /^I should be prompted to enter my new password$/ do
41
- true
42
- end
43
-
44
- When /^I provide a new password$/ do
45
- browser.text_field(:name, :password).set(@password)
46
- browser.text_field(:name, :password_confirmation).set(@password)
47
- end
48
-
49
- And /^click Am I Done Yet\?$/ do
50
- browser.button(:value, 'Am I Done Yet?').click
51
- end
52
-
53
- Then /^I should be redirected back to the consumer application$/ do
54
- true
55
- end
56
-
57
- Then /^I should know a little bit about myself as a user$/ do
58
- browser.html.should have_selector "h1:contains('Hancock Client: Sinatra')"
59
- browser.have_selector "td:contains('#{@email}')"
60
- browser.have_selector "td:contains('#{@first_name}')"
61
- browser.have_selector "td:contains('#{@last_name}')"
62
- end
@@ -1,21 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__)+'/../../spec_helper')
2
- gem 'safariwatir', '~>0.3.3'
3
- require 'safariwatir'
4
-
5
- World do
6
- def sso_server
7
- @sso_server ||= 'http://hancock.atmos.org/sso'
8
- end
9
- def browser
10
- @browser ||= Watir::Safari.new
11
- end
12
-
13
- def app
14
- @app = Rack::Builder.new do
15
- run Hancock::Spec::Client
16
- end
17
- end
18
- include Rack::Test::Methods
19
- include Webrat::Methods
20
- include Webrat::Matchers
21
- end