keymail 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,6 +18,12 @@ describe 'Feature Integration' do
18
18
  page.must_have_content 'success'
19
19
  end
20
20
 
21
+ it 'only works once' do
22
+ current_email.first(:link).click
23
+ current_email.first(:link).click
24
+ page.must_have_content 'failed'
25
+ end
26
+
21
27
  # it 'logs in a user with an optional passcode'
22
28
 
23
29
  end
@@ -4,12 +4,18 @@ module Keymail
4
4
  describe Authentication do
5
5
  context '.request' do
6
6
 
7
+ let(:email) { 'test@email.com' }
8
+
7
9
  it 'creates a new token' do
8
- -> { Authentication.request('test@email.com') }.must_change 'Token.count', +1
10
+ -> { Authentication.request(email) }.must_change 'Token.count', +1
11
+ end
12
+
13
+ it 'returns the token on success' do
14
+ Authentication.request(email).must_be_kind_of Token
9
15
  end
10
16
 
11
17
  it 'sends an email' do
12
- -> { Authentication.request('test@email.com') }.must_change 'ActionMailer::Base.deliveries.count', +1
18
+ -> { Authentication.request(email) }.must_change 'ActionMailer::Base.deliveries.count', +1
13
19
  end
14
20
 
15
21
  it 'raises an error if email is nil' do
data/test/test_helper.rb CHANGED
@@ -70,10 +70,5 @@ class AcceptanceSpec < MiniTest::Spec
70
70
  include Rails.application.routes.url_helpers
71
71
  include Capybara::DSL
72
72
  include Capybara::Email::DSL
73
-
74
- # before do
75
- # @routes = Rails.application.routes
76
- # end
77
-
78
73
  end
79
74
  MiniTest::Spec.register_spec_type(/Integration$/, AcceptanceSpec)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keymail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alcesleo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-28 00:00:00.000000000 Z
11
+ date: 2014-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -50,6 +50,7 @@ files:
50
50
  - test/dummy/Rakefile
51
51
  - test/dummy/app/controllers/application_controller.rb
52
52
  - test/dummy/app/controllers/auth_controller.rb
53
+ - test/dummy/app/views/auth/fail.html.erb
53
54
  - test/dummy/app/views/auth/new.html.erb
54
55
  - test/dummy/app/views/auth/request_email.html.erb
55
56
  - test/dummy/app/views/auth/success.html.erb
@@ -91,7 +92,6 @@ files:
91
92
  - test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
92
93
  - test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
93
94
  - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
94
- - test/dummy/tmp/pids/server.pid
95
95
  - test/factories.rb
96
96
  - test/integration/feature_test.rb
97
97
  - test/keymail_test.rb
@@ -127,6 +127,7 @@ test_files:
127
127
  - test/dummy/Rakefile
128
128
  - test/dummy/app/controllers/application_controller.rb
129
129
  - test/dummy/app/controllers/auth_controller.rb
130
+ - test/dummy/app/views/auth/fail.html.erb
130
131
  - test/dummy/app/views/auth/new.html.erb
131
132
  - test/dummy/app/views/auth/request_email.html.erb
132
133
  - test/dummy/app/views/auth/success.html.erb
@@ -168,7 +169,6 @@ test_files:
168
169
  - test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
169
170
  - test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
170
171
  - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
171
- - test/dummy/tmp/pids/server.pid
172
172
  - test/factories.rb
173
173
  - test/integration/feature_test.rb
174
174
  - test/keymail_test.rb
@@ -1 +0,0 @@
1
- 95672