bookingsync-engine 0.4.6 → 0.5.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/README.md +3 -1
- data/lib/bookingsync/engine/model.rb +6 -2
- data/lib/bookingsync/engine/version.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +465 -55
- data/spec/dummy/log/test.log +6957 -2684
- data/spec/models/account_spec.rb +13 -3
- metadata +4 -5
- data/spec/dummy/db/development.sqlite3 +0 -0
data/spec/models/account_spec.rb
CHANGED
@@ -61,7 +61,7 @@ RSpec.describe Account, type: :model do
|
|
61
61
|
|
62
62
|
describe "#token" do
|
63
63
|
let(:expires_at) { 1.day.from_now.to_i }
|
64
|
-
let(:account) { Account.create!(uid: 123, oauth_access_token: "token",
|
64
|
+
let!(:account) { Account.create!(uid: 123, oauth_access_token: "token",
|
65
65
|
oauth_refresh_token: "refresh_token", oauth_expires_at: expires_at) }
|
66
66
|
|
67
67
|
context "when the stored token is fresh" do
|
@@ -72,6 +72,8 @@ RSpec.describe Account, type: :model do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
context "when the stored token is expired" do
|
75
|
+
self.use_transactional_fixtures = false
|
76
|
+
|
75
77
|
let(:expires_at) { 1.day.ago.to_i.to_s }
|
76
78
|
let(:new_expires_at) { 2.days.from_now.to_i.to_s }
|
77
79
|
let(:token) { double(expired?: true, refresh!: double(token: "refreshed_token",
|
@@ -84,13 +86,21 @@ RSpec.describe Account, type: :model do
|
|
84
86
|
refresh_token: "refresh_token", expires_at: expires_at) { token }
|
85
87
|
end
|
86
88
|
|
89
|
+
after do
|
90
|
+
Account.destroy_all
|
91
|
+
end
|
92
|
+
|
87
93
|
it "refreshes the token" do
|
88
94
|
expect(token).to receive(:refresh!)
|
89
95
|
account.token
|
90
96
|
end
|
91
97
|
|
92
|
-
it "stores the refreshed token" do
|
93
|
-
|
98
|
+
it "stores the refreshed token even with rollback" do
|
99
|
+
Account.transaction do
|
100
|
+
account.token
|
101
|
+
raise ActiveRecord::Rollback
|
102
|
+
end
|
103
|
+
|
94
104
|
account.reload
|
95
105
|
expect(account.oauth_access_token).to eq("refreshed_token")
|
96
106
|
expect(account.oauth_refresh_token).to eq("refreshed_refresh_token")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookingsync-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Grosjean
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -194,7 +194,6 @@ files:
|
|
194
194
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
195
195
|
- spec/dummy/config/locales/en.yml
|
196
196
|
- spec/dummy/config/routes.rb
|
197
|
-
- spec/dummy/db/development.sqlite3
|
198
197
|
- spec/dummy/db/migrate/20140522110326_create_accounts.rb
|
199
198
|
- spec/dummy/db/migrate/20140522110454_add_o_auth_fields_to_accounts.rb
|
200
199
|
- spec/dummy/db/schema.rb
|
@@ -237,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
236
|
version: '0'
|
238
237
|
requirements: []
|
239
238
|
rubyforge_project:
|
240
|
-
rubygems_version: 2.
|
239
|
+
rubygems_version: 2.2.2
|
241
240
|
signing_key:
|
242
241
|
specification_version: 4
|
243
242
|
summary: A Rails engine to simplify integration with BookingSync API
|
@@ -272,7 +271,6 @@ test_files:
|
|
272
271
|
- spec/dummy/config/locales/en.yml
|
273
272
|
- spec/dummy/config/routes.rb
|
274
273
|
- spec/dummy/config.ru
|
275
|
-
- spec/dummy/db/development.sqlite3
|
276
274
|
- spec/dummy/db/migrate/20140522110326_create_accounts.rb
|
277
275
|
- spec/dummy/db/migrate/20140522110454_add_o_auth_fields_to_accounts.rb
|
278
276
|
- spec/dummy/db/schema.rb
|
@@ -290,3 +288,4 @@ test_files:
|
|
290
288
|
- spec/routing/oauth_routing_spec.rb
|
291
289
|
- spec/spec_helper.rb
|
292
290
|
- spec/support/omniauth.rb
|
291
|
+
has_rdoc:
|
File without changes
|