toolong-dontread 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6e7c47b921609c4a2182807e87905106f4d6726
4
- data.tar.gz: 2eba5da0c2e8b21ff6291a57d2389ea9e0391c1f
3
+ metadata.gz: 334a5eaa7b77d96f4fcac4946b0a30ecdc27d5cc
4
+ data.tar.gz: 7d8ae7cc323f655eec645cff52e05dfda404ebd6
5
5
  SHA512:
6
- metadata.gz: 4302692acbcf35cbc08177e25e1bf6ff77a6f57a06874b3eadbe50c8879a17fafea22dda0abd192feb77876ca51276a4b2bd3a4f889b5ef0eecb8a1284a2dcb8
7
- data.tar.gz: eb6c1e9ada0e11426d195e161fe54d0da4e7273130087c3a4df78d199bca97a61eb421ecd9a1bae961b827595cbcbc90726e7282db7ad954aa8925b6d13e2acf
6
+ metadata.gz: c3edb8ab3d5bf85b48eef622be3b76ceb74bfbaa4d00438725ca9ef9e31c998dc5d190ce19c9d167b757093422b40ebc68ca2a2a3789e079858506982739adba
7
+ data.tar.gz: 9fbc0b1ff8ecf601f90265f1e8bc7ce7fe2b3398c9a79f2d48e6ed6dcd5612fae64e5b17b5fea6b908f52e6b8bd463a9cf611850226e415e926568fbe18c2386
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tldr (0.0.1)
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.2)
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
- tldr!
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`
@@ -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
- unless Tldr::CancelledSubscription.exists? conditions
13
- Tldr::CancelledSubscription.create! conditions
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
@@ -2,6 +2,5 @@ require 'active_record'
2
2
 
3
3
  module Tldr
4
4
  class CancelledSubscription < ActiveRecord::Base
5
- attr_accessible :subscriber_id, :email_name
6
5
  end
7
6
  end
@@ -1,3 +1,3 @@
1
1
  module Tldr
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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(:exists?).returns(false)
13
- Tldr::CancelledSubscription.expects(:create!).with({subscriber_id: subscriber_id.to_s, email_name: email_name})
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(:create!).never
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(:exists?).returns(false)
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.3
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 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake