Sha256: 607f423303a1f7208c414337bc47687798a64fb93bd67a2269fc7ca3ffc58a68

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

describe ActivityNotification::ActsAsTarget do
  let(:dummy_model_class) { Dummy::DummyBase }

  describe "as public class methods" do
    describe ".acts_as_target" do
      it "have not included Target before calling" do
        expect(dummy_model_class.respond_to?(:available_as_target?)).to be_falsey
      end

      it "includes Target" do
        dummy_model_class.acts_as_target
        expect(dummy_model_class.respond_to?(:available_as_target?)).to be_truthy
        expect(dummy_model_class.available_as_target?).to be_truthy
      end

      context "with no options" do
        it "returns hash of specified options" do
          expect(dummy_model_class.acts_as_target).to eq({})
        end
      end

      #TODO test other options
    end

    describe ".acts_as_notification_target" do
      it "is an alias of acts_as_target" do
        #TODO make better way to test alias
        #expect(dummy_model_class.acts_as_notification_target).to receive(:acts_as_target)
        expect(dummy_model_class.respond_to?(:acts_as_notification_target)).to be_truthy
      end
    end

    describe ".available_target_options" do
      it "returns list of available options in acts_as_target" do
        expect(dummy_model_class.available_target_options)
          .to eq([:email, :email_allowed, :devise_resource])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activity_notification-0.0.10 spec/roles/acts_as_target_spec.rb