plaid_rails 0.9.0 → 0.10.0
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 +4 -4
- data/app/assets/javascripts/plaid_rails/link.js +2 -1
- data/app/controllers/plaid_rails/link_controller.rb +20 -8
- data/app/models/plaid_rails/account.rb +35 -8
- data/app/views/plaid_rails/link/authenticate.js.erb +0 -3
- data/app/views/plaid_rails/link/update.js.erb +0 -3
- data/lib/plaid_rails/version.rb +1 -1
- data/spec/controllers/plaid_rails/link_controller_spec.rb +1 -1
- data/spec/dummy/log/test.log +1874 -12001
- data/spec/factories/account.rb +1 -0
- data/spec/models/plaid_rails/account_spec.rb +51 -28
- metadata +2 -2
data/spec/factories/account.rb
CHANGED
@@ -10,39 +10,62 @@ module PlaidRails
|
|
10
10
|
|
11
11
|
let(:account){FactoryGirl.create(:account)}
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
describe 'delete_connect' do
|
14
|
+
it "from destroy" do
|
15
|
+
expect(account).to receive(:delete_connect)
|
16
|
+
account.destroy
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
it "has error" do
|
20
|
+
account = FactoryGirl.create(:account)
|
21
|
+
expect(Plaid::User).to receive(:load).with(:connect, "test_wells").and_raise("boom")
|
22
|
+
expect(Rails.logger).to receive(:error).exactly(1).times
|
23
|
+
account.send(:delete_connect)
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
it "delete_connect" do
|
27
|
+
account = FactoryGirl.create(:account)
|
28
|
+
user = double
|
29
|
+
expect(Plaid::User).to receive(:load).with(:connect, "test_wells").and_return(user)
|
30
|
+
expect(user).to receive(:transactions).and_return([1])
|
31
|
+
expect(user).to receive(:delete)
|
32
|
+
account.send(:delete_connect)
|
33
|
+
end
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
35
|
+
it "does not delete_connect" do
|
36
|
+
FactoryGirl.create(:account)
|
37
|
+
expect(Plaid::User).to_not receive(:load).with(:connect, "test_wells").and_raise("boom")
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
it "does not delete_connect without transactions" do
|
41
|
+
user = double
|
42
|
+
expect(Plaid::User).to receive(:load).with(:connect, "test_wells").and_return(user)
|
43
|
+
expect(user).to receive(:transactions).and_return([])
|
44
|
+
account.update(access_token: 'foobar')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'does not delete_connect with same access_token' do
|
48
|
+
2.times{FactoryGirl.create(:account) }
|
49
|
+
expect(Plaid::User).to_not receive(:load).with(:connect, "test_wells")
|
50
|
+
Account.first.destroy
|
51
|
+
end
|
42
52
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
53
|
+
|
54
|
+
describe "delete_updated_token" do
|
55
|
+
it "before_update delete_updated_token" do
|
56
|
+
expect(account).to receive(:delete_updated_token)
|
57
|
+
account.update(access_token: 'foobar')
|
58
|
+
end
|
59
|
+
|
60
|
+
it "does not before_update delete_connect" do
|
61
|
+
expect(account).to_not receive(:delete_updated_token)
|
62
|
+
account.update(last_sync: Time.now)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'does delete_connect' do
|
66
|
+
expect(account).to receive(:delete_connect)
|
67
|
+
account.send(:delete_updated_token)
|
68
|
+
end
|
46
69
|
end
|
47
70
|
end
|
48
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plaid_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Curt Wilhelm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|