bookingsync-engine 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Account, type: :model do
4
+ shared_examples "it takes attributes from auth" do
5
+ it "sets name" do
6
+ expect(account.name).to eq "business name"
7
+ end
8
+
9
+ it "sets token" do
10
+ expect(account.oauth_access_token).to eql("token")
11
+ expect(account.oauth_refresh_token).to eql("refresh token")
12
+ expect(account.oauth_expires_at).to eql("expires at")
13
+ end
14
+ end
15
+
4
16
  describe ".from_omniauth" do
17
+ before { Account.create!(provider: "bookingsync", uid: 456) }
18
+
5
19
  let(:auth) { OmniAuth.config.mock_auth[:bookingsync] }
6
20
 
7
21
  context "when account exists" do
@@ -11,17 +25,32 @@ RSpec.describe Account, type: :model do
11
25
  expect(Account.from_omniauth(auth)).to eql(account)
12
26
  end
13
27
 
14
- it "updates account's name" do
15
- Account.from_omniauth(auth)
16
- expect(account.reload.name).to eql("business name")
28
+ describe "the updated account" do
29
+ before do
30
+ Account.from_omniauth(auth)
31
+ account.reload
32
+ end
33
+
34
+ it_behaves_like "it takes attributes from auth"
35
+ end
36
+ end
37
+
38
+ context "when account doesn't exist" do
39
+ it "creates new account" do
40
+ expect {
41
+ Account.from_omniauth(auth)
42
+ }.to change { Account.count }.by(1)
17
43
  end
18
44
 
19
- it "updates account's token" do
20
- Account.from_omniauth(auth)
21
- account.reload
22
- expect(account.oauth_access_token).to eql("token")
23
- expect(account.oauth_refresh_token).to eql("refresh token")
24
- expect(account.oauth_expires_at).to eql("expires at")
45
+ describe "the newly created account" do
46
+ let!(:account) { Account.from_omniauth(auth) }
47
+
48
+ it "sets uid and provider from auth" do
49
+ expect(account.uid).to eq 123
50
+ expect(account.provider).to eq "bookingsync"
51
+ end
52
+
53
+ it_behaves_like "it takes attributes from auth"
25
54
  end
26
55
  end
27
56
  end
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.1.2
4
+ version: 0.1.3
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: 2014-09-17 00:00:00.000000000 Z
12
+ date: 2014-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -163,13 +163,11 @@ files:
163
163
  - spec/dummy/config/initializers/wrap_parameters.rb
164
164
  - spec/dummy/config/locales/en.yml
165
165
  - spec/dummy/config/routes.rb
166
- - spec/dummy/db/development.sqlite3
167
166
  - spec/dummy/db/migrate/20140522110326_create_accounts.rb
168
167
  - spec/dummy/db/migrate/20140522110454_add_o_auth_fields_to_accounts.rb
169
168
  - spec/dummy/db/schema.rb
170
169
  - spec/dummy/db/test.sqlite3
171
170
  - spec/dummy/log/development.log
172
- - spec/dummy/log/newrelic_agent.log
173
171
  - spec/dummy/log/test.log
174
172
  - spec/dummy/public/404.html
175
173
  - spec/dummy/public/422.html
@@ -233,13 +231,11 @@ test_files:
233
231
  - spec/dummy/config/locales/en.yml
234
232
  - spec/dummy/config/routes.rb
235
233
  - spec/dummy/config.ru
236
- - spec/dummy/db/development.sqlite3
237
234
  - spec/dummy/db/migrate/20140522110326_create_accounts.rb
238
235
  - spec/dummy/db/migrate/20140522110454_add_o_auth_fields_to_accounts.rb
239
236
  - spec/dummy/db/schema.rb
240
237
  - spec/dummy/db/test.sqlite3
241
238
  - spec/dummy/log/development.log
242
- - spec/dummy/log/newrelic_agent.log
243
239
  - spec/dummy/log/test.log
244
240
  - spec/dummy/public/404.html
245
241
  - spec/dummy/public/422.html
@@ -251,3 +247,4 @@ test_files:
251
247
  - spec/models/account_spec.rb
252
248
  - spec/spec_helper.rb
253
249
  - spec/support/omniauth.rb
250
+ has_rdoc:
Binary file
@@ -1,21 +0,0 @@
1
- # Logfile created on 2014-05-22 13:00:58 +0200 by logger.rb/44203
2
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] INFO : Starting the New Relic agent in "development" environment.
3
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] INFO : To prevent agent startup add a NEWRELIC_ENABLE=false environment variable or modify the "development" section of your newrelic.yml.
4
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] INFO : Reading configuration from
5
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] ERROR : Unable to read configuration file : Is a directory @ io_fread - /Users/grk/code/bookingsync-engine/spec/dummy
6
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] INFO : Enabling the Request Sampler.
7
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] INFO : Environment: development
8
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] INFO : No known dispatcher detected.
9
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] INFO : Application: development
10
- [05/22/14 13:00:58 +0200 hrmps.local (18337)] WARN : No license key found in newrelic.yml config. This often means your newrelic.yml is missing a section for the running environment 'development'
11
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing ActiveRecord instrumentation
12
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing middleware-based Excon instrumentation
13
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing Dalli Memcache instrumentation
14
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing Mongo instrumentation
15
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing Net instrumentation
16
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing deferred Rack instrumentation
17
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing Resque instrumentation
18
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing Rails 3 Controller instrumentation
19
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing Rails 3.1/3.2 view instrumentation
20
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Installing Rails3 Error instrumentation
21
- [05/22/14 13:00:59 +0200 hrmps.local (18337)] INFO : Finished instrumentation