notifiable-rails 0.19.9 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -11
- data/app/controllers/notifiable/device_tokens_controller.rb +1 -1
- data/{lib/generators/notifiable/install/templates/create_notifiable_apps.rb → db/migrate/20131210115648_create_notifiable_apps.rb} +0 -0
- data/{lib/generators/notifiable/install/templates/create_notifiable_device_tokens.rb → db/migrate/20131210115649_create_notifiable_device_tokens.rb} +0 -0
- data/{lib/generators/notifiable/install/templates/create_notifiable_notifications.rb → db/migrate/20131210115650_create_notifiable_notifications.rb} +0 -0
- data/{lib/generators/notifiable/install/templates/create_notifiable_statuses.rb → db/migrate/20131210115651_create_notifiable_statuses.rb} +0 -0
- data/lib/notifiable/engine.rb +10 -0
- data/lib/notifiable/version.rb +1 -1
- data/spec/controllers/device_tokens_controller_spec.rb +114 -105
- data/spec/controllers/notifications_controller_spec.rb +45 -45
- data/spec/model/notifiable_app_spec.rb +25 -0
- data/spec/model/notifiable_spec.rb +25 -0
- data/spec/model/notification_spec.rb +105 -0
- data/spec/model/notifier_base_spec.rb +18 -0
- data/spec/spec_helper.rb +15 -1
- data/spec/test_app/app/controllers/application_controller.rb +2 -0
- data/spec/test_app/config/database.yml +6 -0
- data/spec/test_app/db/development.sqlite3 +0 -0
- data/spec/test_app/db/migrate/{20131210115648_create_users.rb → 20131210115652_create_users.rb} +0 -0
- data/spec/test_app/db/schema.rb +2 -2
- data/spec/test_app/db/test.sqlite3 +0 -0
- data/spec/test_app/log/development.log +186 -0
- data/spec/test_app/log/test.log +33197 -0
- metadata +48 -70
- data/spec/notifiable_app_spec.rb +0 -24
- data/spec/notifiable_spec.rb +0 -20
- data/spec/notification_spec.rb +0 -119
- data/spec/notifier_base_spec.rb +0 -27
- data/spec/test_app/db/migrate/20131210115649_create_notifiable_apps.rb +0 -10
- data/spec/test_app/db/migrate/20131228225139_create_notifiable_device_tokens.rb +0 -18
- data/spec/test_app/db/migrate/20131228225140_create_notifiable_notifications.rb +0 -26
- data/spec/test_app/db/migrate/20131229104039_create_notifiable_statuses.rb +0 -12
data/spec/notifier_base_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Notifiable::NotifierBase do
|
4
|
-
|
5
|
-
let(:notifiable_app) { FactoryGirl.create(:app, :configuration => {:configurable_mock => {:use_sandbox => true}}) }
|
6
|
-
let(:notification) { FactoryGirl.create(:notification, :app => notifiable_app) }
|
7
|
-
let(:notifier) { ConfigurableMockNotifier.new(Rails.env, notification) }
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
ConfigurableMockNotifier.send(:public, *ConfigurableMockNotifier.protected_instance_methods)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "knows if the environment is test" do
|
14
|
-
notifier.test_env?.should == true
|
15
|
-
end
|
16
|
-
|
17
|
-
it "configures a notifier" do
|
18
|
-
notifiable_app.configure :configurable_mock, notifier
|
19
|
-
|
20
|
-
notifier.use_sandbox.should == true
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
class ConfigurableMockNotifier < Notifiable::NotifierBase
|
26
|
-
attr_accessor :use_sandbox
|
27
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
class CreateNotifiableDeviceTokens < ActiveRecord::Migration
|
2
|
-
|
3
|
-
def change
|
4
|
-
create_table :notifiable_device_tokens do |t|
|
5
|
-
t.string :token
|
6
|
-
t.string :provider
|
7
|
-
t.boolean :is_valid, :default => true
|
8
|
-
t.integer :user_id
|
9
|
-
t.references :app
|
10
|
-
|
11
|
-
t.timestamps
|
12
|
-
end
|
13
|
-
|
14
|
-
add_index :notifiable_device_tokens, :token
|
15
|
-
add_index :notifiable_device_tokens, :user_id
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
class CreateNotifiableNotifications < ActiveRecord::Migration
|
2
|
-
|
3
|
-
def change
|
4
|
-
create_table :notifiable_notifications do |t|
|
5
|
-
t.text :message
|
6
|
-
t.text :params
|
7
|
-
t.references :app
|
8
|
-
|
9
|
-
#stats
|
10
|
-
t.integer :sent_count, :default => 0
|
11
|
-
t.integer :gateway_accepted_count, :default => 0
|
12
|
-
t.integer :opened_count, :default => 0
|
13
|
-
|
14
|
-
# APNS - Optional
|
15
|
-
#t.integer :badge
|
16
|
-
#t.text :sound
|
17
|
-
#t.datetime :expiry
|
18
|
-
|
19
|
-
# MPNS - Optional
|
20
|
-
#t.text :title
|
21
|
-
|
22
|
-
t.timestamps
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|