notifiable-rails 0.22.0 → 0.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/migrate/20131210115653_add_name_to_notifiable_device_tokens.rb +7 -0
- data/lib/notifiable/version.rb +1 -1
- data/lib/notifiable.rb +1 -1
- data/spec/controllers/device_tokens_controller_spec.rb +2 -1
- data/spec/model/device_token_spec.rb +6 -0
- data/spec/test_app/db/development.sqlite3 +0 -0
- data/spec/test_app/db/schema.rb +1 -0
- data/spec/test_app/db/test.sqlite3 +0 -0
- data/spec/test_app/log/development.log +60 -0
- data/spec/test_app/log/test.log +15917 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b109b7e4229eae4cc3b4033b5443695cf79efa1c
|
4
|
+
data.tar.gz: 94a994b5dccaac5d746602c77e15a4c13b1d3ec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67da3afd51f2d586796dea736ffec204ae6787a7293e66ab491afbb6265bc66cb00201534039d6c9285307b32f8bbdef9a12491341907fc174f949c80974f25d
|
7
|
+
data.tar.gz: ff2c59f101908c96f1cfca9d16b396e9e068ed64c57d1922307b6c871d13e2f1f29e96cbf9fa8eb2906d7bf04792b07c75495be90ebc74c02594660078bd2596
|
data/lib/notifiable/version.rb
CHANGED
data/lib/notifiable.rb
CHANGED
@@ -14,7 +14,7 @@ module Notifiable
|
|
14
14
|
mattr_accessor :api_controller_class
|
15
15
|
|
16
16
|
mattr_accessor :api_device_token_params
|
17
|
-
@@api_device_token_params = [:token, :provider, :app_id, :locale]
|
17
|
+
@@api_device_token_params = [:token, :provider, :app_id, :locale, :name]
|
18
18
|
|
19
19
|
mattr_accessor :locales
|
20
20
|
@@locales = [:en]
|
@@ -12,12 +12,13 @@ describe Notifiable::DeviceTokensController do
|
|
12
12
|
let(:user1) { create(:user) }
|
13
13
|
let(:app) { create(:app) }
|
14
14
|
|
15
|
-
before(:each) { post :create, :token => "ABC123", :user_email => user1.email, :provider => :apns, :app_id => app.id }
|
15
|
+
before(:each) { post :create, :token => "ABC123", :name => "Matt's iPhone", :user_email => user1.email, :provider => :apns, :app_id => app.id }
|
16
16
|
|
17
17
|
it { expect(response.status).to eq 200 }
|
18
18
|
it { expect(json['id']).to_not be_nil }
|
19
19
|
it { expect(Notifiable::DeviceToken.count).to eq 1 }
|
20
20
|
it { expect(Notifiable::DeviceToken.first.token).to eq "ABC123" }
|
21
|
+
it { expect(Notifiable::DeviceToken.first.name).to eq "Matt's iPhone" }
|
21
22
|
it { expect(Notifiable::DeviceToken.first.provider).to eq "apns" }
|
22
23
|
it { expect(Notifiable::DeviceToken.first.app).to eq app }
|
23
24
|
it { expect(User.first.device_tokens.count).to eq 1 }
|
@@ -8,6 +8,12 @@ describe Notifiable::DeviceToken do
|
|
8
8
|
it { expect(token.locale).to eq 'en' }
|
9
9
|
end
|
10
10
|
|
11
|
+
describe "#name" do
|
12
|
+
subject(:token) { create(:mock_token, :name => "Matt's iPhone") }
|
13
|
+
|
14
|
+
it { expect(token.name).to eq "Matt's iPhone" }
|
15
|
+
end
|
16
|
+
|
11
17
|
describe "#notification_statuses" do
|
12
18
|
subject(:token) { create(:mock_token, :notification_statuses => create_list(:notification_status, 2)) }
|
13
19
|
|
Binary file
|
data/spec/test_app/db/schema.rb
CHANGED
Binary file
|
@@ -1646810,3 +1646810,63 @@ Migrating to CreateUsers (20131210115652)
|
|
1646810
1646810
|
WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
|
1646811
1646811
|
|
1646812
1646812
|
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1646813
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1646814
|
+
Migrating to AddNameToNotifiableDeviceTokens (20131210115653)
|
1646815
|
+
[1m[35m (0.1ms)[0m begin transaction
|
1646816
|
+
[1m[36m (0.7ms)[0m [1mALTER TABLE "notifiable_device_tokens" ADD "name" varchar(255)[0m
|
1646817
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131210115653"]]
|
1646818
|
+
[1m[36m (0.9ms)[0m [1mcommit transaction[0m
|
1646819
|
+
Migrating to CreateUsers (20131210115660)
|
1646820
|
+
[1m[35m (0.0ms)[0m begin transaction
|
1646821
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL) [0m
|
1646822
|
+
SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL)
|
1646823
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
1646824
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1646825
|
+
Migrating to CreateUsers (20131210115660)
|
1646826
|
+
[1m[35m (0.0ms)[0m begin transaction
|
1646827
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL) [0m
|
1646828
|
+
SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL)
|
1646829
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1646830
|
+
[1m[36m (1.1ms)[0m [1mCREATE TABLE "notifiable_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "configuration" text, "created_at" datetime, "updated_at" datetime) [0m
|
1646831
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "notifiable_device_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "token" varchar(255), "provider" varchar(255), "locale" varchar(255), "name" varchar(255), "is_valid" boolean DEFAULT 't', "user_id" integer, "app_id" integer, "created_at" datetime, "updated_at" datetime)
|
1646832
|
+
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
1646833
|
+
[1m[35m (0.6ms)[0m CREATE UNIQUE INDEX "index_notifiable_device_tokens_on_token" ON "notifiable_device_tokens" ("token")
|
1646834
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
1646835
|
+
FROM sqlite_master
|
1646836
|
+
WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
|
1646837
|
+
UNION ALL
|
1646838
|
+
SELECT sql
|
1646839
|
+
FROM sqlite_temp_master
|
1646840
|
+
WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
|
1646841
|
+
[0m
|
1646842
|
+
[1m[35m (0.6ms)[0m CREATE INDEX "index_notifiable_device_tokens_on_user_id" ON "notifiable_device_tokens" ("user_id")
|
1646843
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "notifiable_localized_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "message" text, "params" text, "locale" varchar(255), "notification_id" integer, "created_at" datetime, "updated_at" datetime) [0m
|
1646844
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "notifiable_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "app_id" integer, "sent_count" integer DEFAULT 0, "gateway_accepted_count" integer DEFAULT 0, "opened_count" integer DEFAULT 0, "created_at" datetime, "updated_at" datetime)
|
1646845
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "notifiable_statuses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "localized_notification_id" integer, "device_token_id" integer, "status" integer, "created_at" datetime) [0m
|
1646846
|
+
[1m[35m (0.7ms)[0m CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL)
|
1646847
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
1646848
|
+
[1m[35m (0.6ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
1646849
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
1646850
|
+
[1m[35m (0.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20131210115660')
|
1646851
|
+
[1m[36m (0.9ms)[0m [1mCREATE TABLE "notifiable_apps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "configuration" text, "created_at" datetime, "updated_at" datetime) [0m
|
1646852
|
+
[1m[35m (0.7ms)[0m CREATE TABLE "notifiable_device_tokens" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "token" varchar(255), "provider" varchar(255), "locale" varchar(255), "name" varchar(255), "is_valid" boolean DEFAULT 't', "user_id" integer, "app_id" integer, "created_at" datetime, "updated_at" datetime)
|
1646853
|
+
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
1646854
|
+
[1m[35m (0.6ms)[0m CREATE UNIQUE INDEX "index_notifiable_device_tokens_on_token" ON "notifiable_device_tokens" ("token")
|
1646855
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
1646856
|
+
FROM sqlite_master
|
1646857
|
+
WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
|
1646858
|
+
UNION ALL
|
1646859
|
+
SELECT sql
|
1646860
|
+
FROM sqlite_temp_master
|
1646861
|
+
WHERE name='index_notifiable_device_tokens_on_token' AND type='index'
|
1646862
|
+
[0m
|
1646863
|
+
[1m[35m (0.6ms)[0m CREATE INDEX "index_notifiable_device_tokens_on_user_id" ON "notifiable_device_tokens" ("user_id")
|
1646864
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "notifiable_localized_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "message" text, "params" text, "locale" varchar(255), "notification_id" integer, "created_at" datetime, "updated_at" datetime) [0m
|
1646865
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "notifiable_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "app_id" integer, "sent_count" integer DEFAULT 0, "gateway_accepted_count" integer DEFAULT 0, "opened_count" integer DEFAULT 0, "created_at" datetime, "updated_at" datetime)
|
1646866
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "notifiable_statuses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "localized_notification_id" integer, "device_token_id" integer, "status" integer, "created_at" datetime) [0m
|
1646867
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL)
|
1646868
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
1646869
|
+
[1m[35m (0.6ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
1646870
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
1646871
|
+
[1m[35m (0.5ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20131210115660')
|
1646872
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|