Sha256: 3d188fa2bce85ffc49baa059b59e6d15939af08abc65d83e9e4bce2466a67b3a

Contents?: true

Size: 1.6 KB

Versions: 13

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe Notifiable::App do
  describe "#name" do
    context "missing" do
      subject { build(:app, name: nil) }
      it { is_expected.to_not be_valid }
    end
    
    context "blank" do
      subject { build(:app, name: "") }
      it { is_expected.to_not be_valid }
    end
  end
  
  describe "#notifications" do
    subject(:notifiable_app) { create(:app) }
    let!(:notification) { create(:notification, :app => notifiable_app) }
    
    it { expect(notification.app).to_not be_nil }
    it { expect(notifiable_app.notifications.count).to eq 1 }
  end
  
  describe "#configure" do
    let(:notification) { create(:notification, :app => notifiable_app) }
    let(:notifier) { ConfigurableMockNotifier.new(Rails.env, notification) }
    subject(:notifiable_app) { create(:app, :configuration => {:configurable_mock => {:use_sandbox => true}}) }
    
    before(:each) { notifiable_app.configure :configurable_mock, notifier }
    
    it { expect(notifier.use_sandbox).to eq true }
  end
  
  describe "#configuration" do
    let(:notification) { create(:notification, :app => notifiable_app) }
    let(:notifier) { ConfigurableMockNotifier.new(Rails.env, notification) }
    subject(:notifiable_app) { create(:app) }
        
    it { expect(notifiable_app.send(:configuration)).to eq :mock => {}, :configurable_mock=>{:use_sandbox=>nil} }
  end
  
  describe "define_configuration_accessors" do        
    it { expect(Notifiable::App.instance_methods).to include(:configurable_mock_use_sandbox) }
    it { expect(Notifiable::App.instance_methods).to include(:configurable_mock_use_sandbox=) }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
notifiable-rails-0.30.4 spec/notifiable/notifiable_app_spec.rb
notifiable-rails-0.30.3 spec/notifiable/notifiable_app_spec.rb
notifiable-rails-0.30.2 spec/notifiable/notifiable_app_spec.rb
notifiable-rails-0.30.1 spec/notifiable/notifiable_app_spec.rb
notifiable-rails-0.30.0 spec/notifiable/notifiable_app_spec.rb
notifiable-rails-0.29.0 spec/model/notifiable_app_spec.rb
notifiable-rails-0.28.1 spec/model/notifiable_app_spec.rb
notifiable-rails-0.28.0 spec/model/notifiable_app_spec.rb
notifiable-rails-0.27.1 spec/model/notifiable_app_spec.rb
notifiable-rails-0.27.0 spec/model/notifiable_app_spec.rb
notifiable-rails-0.26.3 spec/model/notifiable_app_spec.rb
notifiable-rails-0.26.1 spec/model/notifiable_app_spec.rb
notifiable-rails-0.26.0 spec/model/notifiable_app_spec.rb