Sha256: 1ae5e1f08231374d7164b002e4eb5c43bbf1cb21406627ffc148420e45c19f50

Contents?: true

Size: 1.58 KB

Versions: 26

Compression:

Stored size: 1.58 KB

Contents

describe ActivityNotification::OptionalTarget::Base do
  let(:test_instance) {
    ActivityNotification::OptionalTarget::Base.new(skip_initializing_target: true)
  }

  describe "as public instance methods" do
    describe "#to_optional_target_name" do
      it "is return demodulized symbol class name" do
        expect(test_instance.to_optional_target_name).to eq(:base)
      end
    end

    describe "#initialize_target" do
      it "raises NotImplementedError" do
        expect { test_instance.initialize_target }
          .to raise_error(NotImplementedError, /You have to implement ActivityNotification::OptionalTarget::Base#initialize_target/)
      end
    end

    describe "#notify" do
      it "raises NotImplementedError" do
        expect { test_instance.notify(create(:notification)) }
          .to raise_error(NotImplementedError, /You have to implement ActivityNotification::OptionalTarget::Base#notify/)
      end
    end
  end

  describe "as protected instance methods" do
    describe "#render_notification_message" do
      context "as default" do
        it "renders notification message with default template" do
          expect(test_instance.send(:render_notification_message, create(:notification))).to be_include("Move to notified") 
        end
      end

      context "with unexisting template as fallback option" do
        it "raise ActionView::MissingTemplate" do
          expect { expect(test_instance.send(:render_notification_message, create(:notification), fallback: :hoge)) }
            .to raise_error(ActionView::MissingTemplate)
        end
      end
    end
  end
  
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
activity_notification-2.3.2 spec/optional_targets/base_spec.rb
activity_notification-2.3.1 spec/optional_targets/base_spec.rb
activity_notification-2.3.0 spec/optional_targets/base_spec.rb
activity_notification-2.2.4 spec/optional_targets/base_spec.rb
activity_notification-2.2.3 spec/optional_targets/base_spec.rb
activity_notification-2.2.2 spec/optional_targets/base_spec.rb
activity_notification-2.2.1 spec/optional_targets/base_spec.rb
activity_notification-2.2.0 spec/optional_targets/base_spec.rb
activity_notification-2.1.4 spec/optional_targets/base_spec.rb
activity_notification-2.1.3 spec/optional_targets/base_spec.rb
activity_notification-2.1.2 spec/optional_targets/base_spec.rb
activity_notification-2.1.1 spec/optional_targets/base_spec.rb
activity_notification-2.1.0 spec/optional_targets/base_spec.rb
activity_notification-2.0.0 spec/optional_targets/base_spec.rb
activity_notification-1.7.1 spec/optional_targets/base_spec.rb
activity_notification-1.7.0 spec/optional_targets/base_spec.rb
activity_notification-1.6.1 spec/optional_targets/base_spec.rb
activity_notification-1.6.0 spec/optional_targets/base_spec.rb
activity_notification-1.5.1 spec/optional_targets/base_spec.rb
activity_notification-1.5.0 spec/optional_targets/base_spec.rb