toolong-dontread 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +7 -0
- data/lib/tldr.rb +7 -2
- data/lib/tldr/cancelled_subscription.rb +0 -1
- data/lib/tldr/version.rb +1 -1
- data/spec/unsubscribe_spec.rb +8 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 334a5eaa7b77d96f4fcac4946b0a30ecdc27d5cc
|
4
|
+
data.tar.gz: 7d8ae7cc323f655eec645cff52e05dfda404ebd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3edb8ab3d5bf85b48eef622be3b76ceb74bfbaa4d00438725ca9ef9e31c998dc5d190ce19c9d167b757093422b40ebc68ca2a2a3789e079858506982739adba
|
7
|
+
data.tar.gz: 9fbc0b1ff8ecf601f90265f1e8bc7ce7fe2b3398c9a79f2d48e6ed6dcd5612fae64e5b17b5fea6b908f52e6b8bd463a9cf611850226e415e926568fbe18c2386
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
|
4
|
+
toolong-dontread (0.0.3)
|
5
5
|
activerecord
|
6
6
|
rake
|
7
7
|
|
@@ -31,7 +31,7 @@ GEM
|
|
31
31
|
minitest (4.7.5)
|
32
32
|
mocha (0.14.0)
|
33
33
|
metaclass (~> 0.0.1)
|
34
|
-
multi_json (1.8.
|
34
|
+
multi_json (1.8.4)
|
35
35
|
rake (10.1.1)
|
36
36
|
thread_safe (0.1.3)
|
37
37
|
atomic
|
@@ -42,4 +42,4 @@ PLATFORMS
|
|
42
42
|
|
43
43
|
DEPENDENCIES
|
44
44
|
mocha
|
45
|
-
|
45
|
+
toolong-dontread!
|
data/README.md
CHANGED
@@ -58,6 +58,13 @@ class AccountsController < ApplicationController
|
|
58
58
|
end
|
59
59
|
```
|
60
60
|
|
61
|
+
# Pushing a new gem
|
62
|
+
|
63
|
+
1. Bump the version number in `tldr\lib\version.rb`
|
64
|
+
1. `gem build tldr.gemspec`
|
65
|
+
1. `gem push toolong-dontread-<version-number>.gemspec`
|
66
|
+
1.
|
67
|
+
|
61
68
|
# Contributing
|
62
69
|
|
63
70
|
1. Clone the repository `git clone https://github.com/brilliantfantastic/tldr`
|
data/lib/tldr.rb
CHANGED
@@ -9,9 +9,14 @@ module Tldr
|
|
9
9
|
if values
|
10
10
|
conditions = {subscriber_id: values[:subscriber_id],
|
11
11
|
email_name: values[:email_name]}
|
12
|
-
|
13
|
-
|
12
|
+
subscription = Tldr::CancelledSubscription.where(conditions).first
|
13
|
+
unless subscription
|
14
|
+
subscription = Tldr::CancelledSubscription.new
|
15
|
+
subscription.subscriber_id = values[:subscriber_id]
|
16
|
+
subscription.email_name = values[:email_name]
|
17
|
+
subscription.save!
|
14
18
|
end
|
19
|
+
subscription
|
15
20
|
end
|
16
21
|
end
|
17
22
|
end
|
data/lib/tldr/version.rb
CHANGED
data/spec/unsubscribe_spec.rb
CHANGED
@@ -6,24 +6,25 @@ describe 'unsubscribe a user' do
|
|
6
6
|
|
7
7
|
before(:all) do
|
8
8
|
@token = Tldr::TokenGenerator.new(subscriber_id, email_name).token
|
9
|
+
@subscription = mock
|
10
|
+
@subscription.stubs(:subscriber_id=).with(subscriber_id.to_s)
|
11
|
+
@subscription.stubs(:email_name=).with(email_name)
|
9
12
|
end
|
10
13
|
|
11
14
|
it 'adds the subscriber to the CancelledSubscribers' do
|
12
|
-
Tldr::CancelledSubscription.expects(:
|
13
|
-
Tldr::CancelledSubscription.expects(:
|
15
|
+
Tldr::CancelledSubscription.expects(:where).returns([])
|
16
|
+
Tldr::CancelledSubscription.expects(:new).returns(@subscription)
|
17
|
+
@subscription.expects(:save!).returns(true)
|
14
18
|
Tldr.unsubscribe @token
|
15
19
|
end
|
16
20
|
|
17
21
|
it 'does not try to insert an invalid token' do
|
18
|
-
Tldr::CancelledSubscription.expects(:
|
22
|
+
Tldr::CancelledSubscription.expects(:new).never
|
19
23
|
Tldr.unsubscribe 'blah'
|
20
24
|
end
|
21
25
|
|
22
26
|
it 'does not unsubscribe twice' do
|
23
|
-
Tldr::CancelledSubscription.expects(:
|
24
|
-
Tldr::CancelledSubscription.expects(:create!).with({subscriber_id: subscriber_id.to_s, email_name: email_name}).once
|
25
|
-
Tldr.unsubscribe @token
|
26
|
-
Tldr::CancelledSubscription.expects(:exists?).returns(true)
|
27
|
+
Tldr::CancelledSubscription.expects(:where).returns([@subscription])
|
27
28
|
Tldr.unsubscribe @token
|
28
29
|
end
|
29
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toolong-dontread
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Wright
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|