bookingsync-engine 0.2.1 → 0.2.2

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: e039b4e380e28741a2c5e9260c43b65b0b8d383d
4
- data.tar.gz: cbea5209a017df774f61919b49a10d97c813fb95
3
+ metadata.gz: a10061247d2013c20e5e267dc1fa12dce0bba2fb
4
+ data.tar.gz: c902d94c3da6c8294010f2d489038574b118fcef
5
5
  SHA512:
6
- metadata.gz: c5ec5bc9e3b27cfb29ad156d4f28ee3713f24fa049198c727dd947f5d5933a3ec99c15f6848d11bc741d07f220bcdd320be3782555998ff982298251c0b67ba1
7
- data.tar.gz: 721ca0d730b5da027d317e6d5e28438d65bd7c080fd5658b59746007897142d70ef26b56b98e187f1327f8b56860fafbee2b658e7555197f872f365231e8273f
6
+ metadata.gz: 97d7a3ffe1aa7a996bc9da865392ad442701c82de557b6e8808259447a2cfccfab379fa802f8bf00ad19a37e8a5b3fe756526835c6ce3e0f83efc6d0dd0b3e7b
7
+ data.tar.gz: 5bfa84883d6cc90649e41e0d62a3adb068466770502857f2c4a6d6736744382c850558cb9632550f0776b20ce6df5aaa2edf058ae73774073892364b85bd184d
@@ -1,6 +1,10 @@
1
1
  module BookingSync::Engine::Model
2
2
  extend ActiveSupport::Concern
3
3
 
4
+ included do
5
+ validates :uid, uniqueness: true
6
+ end
7
+
4
8
  module ClassMethods
5
9
  def from_omniauth(auth)
6
10
  find_or_initialize_by(uid: auth.uid, provider: auth.provider).tap do |account|
@@ -1,3 +1,3 @@
1
1
  module BookingSync
2
- ENGINE_VERSION = "0.2.1"
2
+ ENGINE_VERSION = "0.2.2"
3
3
  end
@@ -512,3 +512,11 @@
512
512
   (0.1ms) SELECT version FROM "schema_migrations"
513
513
   (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140522110454')
514
514
   (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140522110326')
515
+  (1.0ms) CREATE TABLE "accounts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime, "provider" varchar(255), "uid" integer, "name" varchar(255), "oauth_access_token" varchar(255), "oauth_refresh_token" varchar(255), "oauth_expires_at" varchar(255)) 
516
+  (0.2ms) select sqlite_version(*)
517
+  (1.0ms) CREATE INDEX "index_accounts_on_uid" ON "accounts" ("uid")
518
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
519
+  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
520
+  (0.1ms) SELECT version FROM "schema_migrations"
521
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140522110454')
522
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140522110326')
@@ -7336,3 +7336,190 @@ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
7336
7336
   (0.4ms) rollback transaction
7337
7337
   (0.0ms) begin transaction
7338
7338
   (0.0ms) rollback transaction
7339
+  (0.2ms) begin transaction
7340
+ Processing by AuthenticatedController#index as JS
7341
+ Rendered text template (0.0ms)
7342
+ Filter chain halted as :authenticate_account! rendered or redirected
7343
+ Completed 401 Unauthorized in 6ms (Views: 6.2ms | ActiveRecord: 0.0ms)
7344
+  (0.1ms) rollback transaction
7345
+  (0.0ms) begin transaction
7346
+ Processing by AuthenticatedController#index as JS
7347
+ Filter chain halted as :authenticate_account! rendered or redirected
7348
+ Completed 401 Unauthorized in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms)
7349
+  (0.0ms) rollback transaction
7350
+  (0.0ms) begin transaction
7351
+ Processing by AuthenticatedController#index as HTML
7352
+ Redirected to http://test.host/auth/bookingsync/?account_id=
7353
+ Filter chain halted as :authenticate_account! rendered or redirected
7354
+ Completed 302 Found in 0ms (ActiveRecord: 0.0ms)
7355
+  (0.0ms) rollback transaction
7356
+  (0.0ms) begin transaction
7357
+ Processing by AuthenticatedController#index as HTML
7358
+ Filter chain halted as :authenticate_account! rendered or redirected
7359
+ Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
7360
+  (0.0ms) rollback transaction
7361
+  (0.0ms) begin transaction
7362
+ Processing by SessionsController#create as HTML
7363
+ Parameters: {"provider"=>"bookingsync"}
7364
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7365
+  (0.0ms) SAVEPOINT active_record_1
7366
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7367
+ SQL (0.4ms) INSERT INTO "accounts" ("created_at", "name", "oauth_access_token", "oauth_expires_at", "oauth_refresh_token", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.307624"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.307624"]]
7368
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7369
+ Redirected to http://test.host/
7370
+ Completed 302 Found in 25ms (ActiveRecord: 1.5ms)
7371
+  (0.6ms) rollback transaction
7372
+  (0.0ms) begin transaction
7373
+ Processing by SessionsController#create as HTML
7374
+ Parameters: {"provider"=>"bookingsync"}
7375
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7376
+  (0.0ms) SAVEPOINT active_record_1
7377
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7378
+ SQL (0.1ms) INSERT INTO "accounts" ("created_at", "name", "oauth_access_token", "oauth_expires_at", "oauth_refresh_token", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.313166"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.313166"]]
7379
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7380
+ Redirected to http://test.host/
7381
+ Completed 302 Found in 2ms (ActiveRecord: 0.3ms)
7382
+  (0.3ms) rollback transaction
7383
+  (0.0ms) begin transaction
7384
+ Processing by SessionsController#create as HTML
7385
+ Parameters: {"provider"=>"bookingsync"}
7386
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7387
+  (0.0ms) SAVEPOINT active_record_1
7388
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7389
+ SQL (0.1ms) INSERT INTO "accounts" ("created_at", "name", "oauth_access_token", "oauth_expires_at", "oauth_refresh_token", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.316699"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.316699"]]
7390
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7391
+ Redirected to http://test.host/admin
7392
+ Completed 302 Found in 2ms (ActiveRecord: 0.3ms)
7393
+  (0.2ms) rollback transaction
7394
+  (0.0ms) begin transaction
7395
+ Processing by SessionsController#destroy as HTML
7396
+ Redirected to http://test.host/signed_out
7397
+ Completed 302 Found in 0ms (ActiveRecord: 0.0ms)
7398
+  (0.0ms) rollback transaction
7399
+  (0.0ms) begin transaction
7400
+ Processing by SessionsController#destroy as HTML
7401
+ Redirected to http://test.host/
7402
+ Completed 302 Found in 0ms (ActiveRecord: 0.0ms)
7403
+  (0.0ms) rollback transaction
7404
+  (0.0ms) begin transaction
7405
+ Processing by SessionsController#failure as HTML
7406
+ Completed 200 OK in 2ms (Views: 2.3ms | ActiveRecord: 0.0ms)
7407
+  (0.1ms) rollback transaction
7408
+  (0.1ms) begin transaction
7409
+ Processing by SessionsController#failure as HTML
7410
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
7411
+  (0.0ms) rollback transaction
7412
+  (0.0ms) begin transaction
7413
+  (0.0ms) rollback transaction
7414
+  (0.0ms) begin transaction
7415
+ Account Load (0.2ms) SELECT "accounts".* FROM "accounts" ORDER BY "accounts"."id" ASC LIMIT 1
7416
+  (0.0ms) SAVEPOINT active_record_1
7417
+ SQL (0.3ms) INSERT INTO "accounts" ("created_at", "uid", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-11-21 22:27:09.336665"], ["uid", 0], ["updated_at", "2014-11-21 22:27:09.336665"]]
7418
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7419
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 0 LIMIT 1
7420
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 0 LIMIT 1
7421
+  (0.4ms) rollback transaction
7422
+  (0.1ms) begin transaction
7423
+  (0.0ms) SAVEPOINT active_record_1
7424
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 456 LIMIT 1
7425
+ SQL (0.2ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.346455"], ["provider", "bookingsync"], ["uid", 456], ["updated_at", "2014-11-21 22:27:09.346455"]]
7426
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7427
+  (0.1ms) SELECT COUNT(*) FROM "accounts"
7428
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7429
+  (0.0ms) SAVEPOINT active_record_1
7430
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7431
+ SQL (0.6ms) INSERT INTO "accounts" ("created_at", "name", "oauth_access_token", "oauth_expires_at", "oauth_refresh_token", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.350630"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.350630"]]
7432
+  (0.1ms) RELEASE SAVEPOINT active_record_1
7433
+  (0.1ms) SELECT COUNT(*) FROM "accounts"
7434
+  (0.4ms) rollback transaction
7435
+  (0.0ms) begin transaction
7436
+  (0.0ms) SAVEPOINT active_record_1
7437
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 456 LIMIT 1
7438
+ SQL (0.2ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.354448"], ["provider", "bookingsync"], ["uid", 456], ["updated_at", "2014-11-21 22:27:09.354448"]]
7439
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7440
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7441
+  (0.0ms) SAVEPOINT active_record_1
7442
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7443
+ SQL (0.2ms) INSERT INTO "accounts" ("created_at", "name", "oauth_access_token", "oauth_expires_at", "oauth_refresh_token", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.355947"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.355947"]]
7444
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7445
+  (0.4ms) rollback transaction
7446
+  (0.0ms) begin transaction
7447
+  (0.0ms) SAVEPOINT active_record_1
7448
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 456 LIMIT 1
7449
+ SQL (0.1ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.358004"], ["provider", "bookingsync"], ["uid", 456], ["updated_at", "2014-11-21 22:27:09.358004"]]
7450
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7451
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7452
+  (0.0ms) SAVEPOINT active_record_1
7453
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7454
+ SQL (0.2ms) INSERT INTO "accounts" ("created_at", "name", "oauth_access_token", "oauth_expires_at", "oauth_refresh_token", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.359284"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.359284"]]
7455
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7456
+  (0.4ms) rollback transaction
7457
+  (0.0ms) begin transaction
7458
+  (0.0ms) SAVEPOINT active_record_1
7459
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 456 LIMIT 1
7460
+ SQL (0.3ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.361258"], ["provider", "bookingsync"], ["uid", 456], ["updated_at", "2014-11-21 22:27:09.361258"]]
7461
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7462
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7463
+  (0.0ms) SAVEPOINT active_record_1
7464
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7465
+ SQL (0.3ms) INSERT INTO "accounts" ("created_at", "name", "oauth_access_token", "oauth_expires_at", "oauth_refresh_token", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.362894"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.362894"]]
7466
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7467
+  (0.3ms) rollback transaction
7468
+  (0.0ms) begin transaction
7469
+  (0.0ms) SAVEPOINT active_record_1
7470
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 456 LIMIT 1
7471
+ SQL (0.1ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.365187"], ["provider", "bookingsync"], ["uid", 456], ["updated_at", "2014-11-21 22:27:09.365187"]]
7472
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7473
+  (0.0ms) SAVEPOINT active_record_1
7474
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7475
+ SQL (0.3ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.366286"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.366286"]]
7476
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7477
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7478
+  (0.0ms) SAVEPOINT active_record_1
7479
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."uid" = 123 AND "accounts"."id" != 2) LIMIT 1
7480
+ SQL (0.1ms) UPDATE "accounts" SET "name" = ?, "oauth_access_token" = ?, "oauth_expires_at" = ?, "oauth_refresh_token" = ?, "updated_at" = ? WHERE "accounts"."id" = 2 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["updated_at", "2014-11-21 22:27:09.368479"]]
7481
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7482
+  (0.3ms) rollback transaction
7483
+  (0.0ms) begin transaction
7484
+  (0.0ms) SAVEPOINT active_record_1
7485
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 456 LIMIT 1
7486
+ SQL (0.2ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.370973"], ["provider", "bookingsync"], ["uid", 456], ["updated_at", "2014-11-21 22:27:09.370973"]]
7487
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7488
+  (0.0ms) SAVEPOINT active_record_1
7489
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7490
+ SQL (0.3ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.372306"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.372306"]]
7491
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7492
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7493
+  (0.0ms) SAVEPOINT active_record_1
7494
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."uid" = 123 AND "accounts"."id" != 2) LIMIT 1
7495
+ SQL (0.0ms) UPDATE "accounts" SET "name" = ?, "oauth_access_token" = ?, "oauth_expires_at" = ?, "oauth_refresh_token" = ?, "updated_at" = ? WHERE "accounts"."id" = 2 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["updated_at", "2014-11-21 22:27:09.373815"]]
7496
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7497
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = ? LIMIT 1 [["id", 2]]
7498
+  (0.4ms) rollback transaction
7499
+  (0.0ms) begin transaction
7500
+  (0.0ms) SAVEPOINT active_record_1
7501
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 456 LIMIT 1
7502
+ SQL (0.1ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.376125"], ["provider", "bookingsync"], ["uid", 456], ["updated_at", "2014-11-21 22:27:09.376125"]]
7503
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7504
+  (0.0ms) SAVEPOINT active_record_1
7505
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" = 123 LIMIT 1
7506
+ SQL (0.2ms) INSERT INTO "accounts" ("created_at", "provider", "uid", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.377146"], ["provider", "bookingsync"], ["uid", 123], ["updated_at", "2014-11-21 22:27:09.377146"]]
7507
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7508
+ Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."uid" = 123 AND "accounts"."provider" = 'bookingsync' LIMIT 1
7509
+  (0.0ms) SAVEPOINT active_record_1
7510
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."uid" = 123 AND "accounts"."id" != 2) LIMIT 1
7511
+ SQL (0.0ms) UPDATE "accounts" SET "name" = ?, "oauth_access_token" = ?, "oauth_expires_at" = ?, "oauth_refresh_token" = ?, "updated_at" = ? WHERE "accounts"."id" = 2 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires at"], ["oauth_refresh_token", "refresh token"], ["updated_at", "2014-11-21 22:27:09.378512"]]
7512
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7513
+ Account Load (0.0ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = ? LIMIT 1 [["id", 2]]
7514
+  (0.3ms) rollback transaction
7515
+  (0.0ms) begin transaction
7516
+  (0.0ms) SAVEPOINT active_record_1
7517
+ Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."uid" IS NULL LIMIT 1
7518
+ SQL (0.1ms) INSERT INTO "accounts" ("created_at", "oauth_access_token", "oauth_expires_at", "oauth_refresh_token", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-11-21 22:27:09.380596"], ["oauth_access_token", "token"], ["oauth_expires_at", "expires"], ["oauth_refresh_token", "refresh"], ["updated_at", "2014-11-21 22:27:09.380596"]]
7519
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7520
+  (0.0ms) SAVEPOINT active_record_1
7521
+ Account Exists (0.0ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."uid" IS NULL AND "accounts"."id" != 1) LIMIT 1
7522
+ SQL (0.3ms) UPDATE "accounts" SET "oauth_access_token" = ?, "oauth_expires_at" = ?, "oauth_refresh_token" = ?, "updated_at" = ? WHERE "accounts"."id" = 1 [["oauth_access_token", nil], ["oauth_expires_at", nil], ["oauth_refresh_token", nil], ["updated_at", "2014-11-21 22:27:09.381541"]]
7523
+  (0.0ms) RELEASE SAVEPOINT active_record_1
7524
+ Account Load (0.0ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = ? LIMIT 1 [["id", 1]]
7525
+  (0.4ms) rollback transaction
@@ -13,6 +13,10 @@ RSpec.describe Account, type: :model do
13
13
  end
14
14
  end
15
15
 
16
+ describe "validations" do
17
+ it { is_expected.to validate_uniqueness_of(:uid) }
18
+ end
19
+
16
20
  describe ".from_omniauth" do
17
21
  before { Account.create!(provider: "bookingsync", uid: 456) }
18
22
 
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ ENV['RAILS_ENV'] ||= 'test'
2
2
 
3
3
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
4
  require 'rspec/rails'
5
+ require 'shoulda/matchers'
5
6
  require 'pry-rails'
6
7
 
7
8
  # Load support files
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.2.1
4
+ version: 0.2.2
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-11-13 00:00:00.000000000 Z
12
+ date: 2014-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -123,6 +123,20 @@ dependencies:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: shoulda-matchers
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
126
140
  description: A Rails engine to simplify integration with BookingSync API
127
141
  email:
128
142
  - dev@bookingsync.com
@@ -212,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
226
  version: '0'
213
227
  requirements: []
214
228
  rubyforge_project:
215
- rubygems_version: 2.2.2
229
+ rubygems_version: 2.4.4
216
230
  signing_key:
217
231
  specification_version: 4
218
232
  summary: A Rails engine to simplify integration with BookingSync API