Sha256: 0aa54551f39c1cfd6095fb41abf0776bc5c0a67d4467b7d162eb35207402476a

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

if Rails::VERSION::MAJOR >= 5
  require 'activity_notification/optional_targets/action_cable_api_channel'
  describe ActivityNotification::OptionalTarget::ActionCableApiChannel do
    let(:test_instance) { ActivityNotification::OptionalTarget::ActionCableApiChannel.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(:action_cable_api_channel)
        end
      end

      describe "#initialize_target" do
        it "does not raise NotImplementedError" do
          test_instance.initialize_target
        end
      end

      describe "#notify" do
        it "does not raise NotImplementedError" do
          test_instance.notify(create(:notification))
        end
      end
    end

    describe "as protected instance methods" do
      describe "#render_notification_message" do
        context "as default" do
          it "renders notification message as formatted JSON" do
            expect(test_instance.send(:render_notification_message, create(:notification)).with_indifferent_access[:notification].has_key?(:id)).to be_truthy
          end
        end
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activity_notification-2.1.4 spec/optional_targets/action_cable_api_channel_spec.rb
activity_notification-2.1.3 spec/optional_targets/action_cable_api_channel_spec.rb
activity_notification-2.1.2 spec/optional_targets/action_cable_api_channel_spec.rb
activity_notification-2.1.1 spec/optional_targets/action_cable_api_channel_spec.rb
activity_notification-2.1.0 spec/optional_targets/action_cable_api_channel_spec.rb