devise_capturable 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d35e33d8a0bbb3e0bc3f1c3c3673f399668b23ed
4
+ data.tar.gz: 15d157ef99560f9e250099df336c08ebad8adb41
5
+ SHA512:
6
+ metadata.gz: 77e7dac34ed01b8310cf43a641a0556ba8495ad0a3640f0dd800781a0136f07565e25641da2f488eec912e8111c5890d54b6fad36795c59de61c4851820877e4
7
+ data.tar.gz: 144cddbc639f09c62aada71287460ab9915b0f7a0fe95a717248e0b48debbe7ae8b7453987bd0e87695f00003be1c1141ccd5f2bcfbf3d920c6eabe1f1cfa58a
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .DS_Store
19
+ .ruby-version
data/README.md CHANGED
@@ -161,12 +161,6 @@ Devise.setup do |config|
161
161
  end
162
162
  ```
163
163
 
164
- ## Example Application
165
-
166
- I've made an example application that demonstrates how to integrate this gem with Rails. You can find it here.
167
-
168
- [Rails Capturable Example](https://github.com/runemadsen/capture_example)
169
-
170
164
  ## Running the Tests
171
165
 
172
166
  Run the tests with the `rspec` command.
@@ -13,10 +13,10 @@ module Devise
13
13
  end
14
14
 
15
15
  def authenticate!
16
+
16
17
  klass = mapping.to
17
18
 
18
19
  begin
19
-
20
20
  token = Devise::Capturable::API.token(params[:code])
21
21
  fail!(:capturable_invalid) unless token['stat'] == 'ok'
22
22
 
@@ -28,11 +28,10 @@ module Devise
28
28
  else
29
29
  user = klass.new
30
30
  user.before_capturable_create(entity["result"], params)
31
- user.save
31
+ user.save!
32
32
  end
33
33
 
34
34
  success!(user)
35
-
36
35
  rescue Exception => e
37
36
  fail!(:capturable_invalid)
38
37
  end
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Capturable
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -13,23 +13,23 @@ describe 'Devise::Capturable' do
13
13
 
14
14
  before(:each) do
15
15
  @strategy = Devise::Capturable::Strategies::Capturable.new
16
- @mapping = mock(:mapping)
17
- @mapping.should_receive(:to).and_return(User)
18
- @strategy.should_receive(:mapping).and_return(@mapping)
19
- @strategy.should_receive(:params).at_least(1).and_return(PARAMS)
16
+ @mapping = double(:mapping)
20
17
  @user = User.new
21
- Devise::Capturable::API.stub(:token).and_return(TOKEN)
22
- Devise::Capturable::API.stub(:entity).and_return(ENTITY)
18
+ expect(@mapping).to receive(:to).and_return(User)
19
+ expect(@strategy).to receive(:mapping).and_return(@mapping)
20
+ expect(@strategy).to receive(:params).at_least(:once).and_return(PARAMS)
21
+ allow(Devise::Capturable::API).to receive(:token).and_return(TOKEN)
22
+ allow(Devise::Capturable::API).to receive(:entity).and_return(ENTITY)
23
23
  end
24
24
 
25
25
  describe "for an existing user" do
26
26
 
27
- it "should call #before_capturable_sign_in and authenticate" do
28
- @user.stub(:save).and_return(true)
29
- User.should_receive(:find_with_capturable_params).with(ENTITY["result"]).and_return(@user)
30
- @user.should_receive(:before_capturable_sign_in).with(ENTITY["result"], PARAMS).and_return(true)
31
- @strategy.should_receive(:"success!").with(@user).and_return(true)
32
- lambda { @strategy.authenticate! }.should_not raise_error
27
+ it "should authenticate" do
28
+ expect(User).to receive(:find_with_capturable_params).with(ENTITY["result"]).and_return(@user)
29
+ expect(@user).to receive(:before_capturable_sign_in).with(ENTITY["result"], PARAMS)
30
+ expect(@user).to_not receive(:save!)
31
+ expect(@strategy).to receive(:success!).with(@user)
32
+ expect { @strategy.authenticate! }.to_not raise_error
33
33
  end
34
34
 
35
35
  end
@@ -37,21 +37,23 @@ describe 'Devise::Capturable' do
37
37
  describe 'for a new user' do
38
38
 
39
39
  before(:each) do
40
- User.should_receive(:find_with_capturable_params).and_return(nil)
41
- User.should_receive(:new).and_return(@user)
40
+ expect(User).to receive(:find_with_capturable_params).and_return(nil)
41
+ expect(User).to receive(:new).and_return(@user)
42
+ expect(@user).to receive(:before_capturable_create).with(ENTITY["result"], PARAMS)
42
43
  end
43
44
 
44
- it "should call #before_capturable_create and fail is unsuccessful" do
45
- @user.should_receive(:"before_capturable_create").with(ENTITY["result"], PARAMS).and_return(false)
46
- @strategy.should_receive(:"fail!").with(:capturable_invalid).and_return(true)
47
- lambda { @strategy.authenticate! }.should_not raise_error
45
+ it "should fail if unsuccessful" do
46
+ expect(@user).to receive(:save!).and_raise(Exception)
47
+ expect(@strategy).to_not receive(:success!)
48
+ expect(@strategy).to receive(:fail!).with(:capturable_invalid)
49
+ expect { @strategy.authenticate! }.to_not raise_error
48
50
  end
49
51
 
50
- it "should call #before_capturable_create and succeed if successful" do
51
- @user.should_receive(:"before_capturable_create").with(ENTITY["result"], PARAMS).and_return(true)
52
- @user.should_receive(:save).and_return(true)
53
- @strategy.should_receive(:"success!").with(@user).and_return(true)
54
- lambda { @strategy.authenticate! }.should_not raise_error
52
+ it "should succeed if successful" do
53
+ expect(@user).to receive(:save!).and_return(true)
54
+ expect(@strategy).to receive(:success!).with(@user)
55
+ expect(@strategy).to_not receive(:fail!)
56
+ expect { @strategy.authenticate! }.to_not raise_error
55
57
  end
56
58
  end
57
59
 
@@ -9,7 +9,7 @@ describe 'View Helpers' do
9
9
  end
10
10
  test = Testing.new
11
11
  link = test.link_to_capturable("Login")
12
- link.should == '<a href="#" class="capture_modal_open" id="capture_signin_link">Login</a>'
12
+ link.should == '<a class="capture_modal_open" href="#" id="capture_signin_link">Login</a>'
13
13
  end
14
14
 
15
15
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_capturable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
5
- prerelease:
4
+ version: 0.0.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Rune Skjoldborg Madsen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-27 00:00:00.000000000 Z
11
+ date: 2013-12-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: devise
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rails
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Devise::Capturable is a gem that makes it possible to use the Janrain
@@ -105,31 +96,29 @@ files:
105
96
  - spec/view_helpers_spec.rb
106
97
  homepage: ''
107
98
  licenses: []
99
+ metadata: {}
108
100
  post_install_message:
109
101
  rdoc_options: []
110
102
  require_paths:
111
103
  - lib
112
104
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
105
  requirements:
115
- - - ! '>='
106
+ - - '>='
116
107
  - !ruby/object:Gem::Version
117
108
  version: '0'
118
109
  required_rubygems_version: !ruby/object:Gem::Requirement
119
- none: false
120
110
  requirements:
121
- - - ! '>='
111
+ - - '>='
122
112
  - !ruby/object:Gem::Version
123
113
  version: '0'
124
114
  requirements: []
125
115
  rubyforge_project:
126
- rubygems_version: 1.8.24
116
+ rubygems_version: 2.0.14
127
117
  signing_key:
128
- specification_version: 3
118
+ specification_version: 4
129
119
  summary: Janrain Capture for Devise
130
120
  test_files:
131
121
  - spec/api_spec.rb
132
122
  - spec/spec_helper.rb
133
123
  - spec/strategy_spec.rb
134
124
  - spec/view_helpers_spec.rb
135
- has_rdoc: