spec/model/notifier_base_spec.rb in notifiable-rails-0.23.0 vs spec/model/notifier_base_spec.rb in notifiable-rails-0.24.0
- old
+ new
@@ -1,19 +1,35 @@
require 'spec_helper'
describe Notifiable::NotifierBase do
before(:each) { ConfigurableMockNotifier.send(:public, *ConfigurableMockNotifier.protected_instance_methods) }
+ let(:notification) { FactoryGirl.create(:notification, :app => notifiable_app) }
describe "#test_env?" do
let(:notifiable_app) { FactoryGirl.create(:app, :configuration => {:configurable_mock => {:use_sandbox => true}}) }
- let(:notification) { FactoryGirl.create(:notification, :app => notifiable_app) }
subject(:notifier) { ConfigurableMockNotifier.new(Rails.env, notification) }
it { expect(notifier.test_env?).to eq true }
end
+ describe "#notifier_attributes" do
+ let(:notifiable_app) { FactoryGirl.create(:app, :configuration => {:configurable_mock => {:use_sandbox => true}}) }
+ subject { ConfigurableMockNotifier.new(Rails.env, notification) }
+
+ context "single" do
+ it { expect(ConfigurableMockNotifier.notifier_attributes).to eq [:use_sandbox]}
+ end
+
+ context "set" do
+ before(:each) { ConfigurableMockNotifier.new(Rails.env, notification) }
+
+ it { expect(ConfigurableMockNotifier.notifier_attributes).to eq [:use_sandbox]}
+ end
+
+ end
+
describe "#processed" do
let(:notification) { FactoryGirl.create(:notification_with_en_localization, :app => notifiable_app) }
let(:device_token1) { FactoryGirl.create(:device_token, :app => notifiable_app, :locale => 'en') }
let(:device_token2) { FactoryGirl.create(:device_token, :app => notifiable_app, :locale => 'en') }
@@ -47,12 +63,6 @@
it { expect(Notifiable::NotificationStatus.count).to eq 0 }
it { expect(Notifiable::Notification.first.sent_count).to eq 2 }
end
end
-
-
-end
-
-class ConfigurableMockNotifier < Notifiable::NotifierBase
- attr_accessor :use_sandbox
end
\ No newline at end of file