Sha256: 4a0eb1832891bea53f913924a2fa95c1372cc0ca4b88316b4a85f406293ffe92

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

module Feeder
  describe Item do
    it_behaves_like "a filterable"

    describe "#type" do
      it "returns the lowercase version of the feedable's type, separating words with an underscore" do
        subject.stub(:feedable_type).and_return "SomeFeedable"
        expect(subject.type).to eq "some_feedable"
      end

      context "when the feedable is namespaced" do
        it "splits each namespace with a forward slash" do
          subject.stub(:feedable_type).and_return "CoolApp::SomeFeedable"
          expect(subject.type).to eq "cool_app/some_feedable"
        end
      end
    end

    describe "#report" do
      subject { create :feeder_item, reported: false }

      it "ensures the item is reported" do
        subject.report
        expect(subject).to be_reported
      end
    end

    describe "#block" do
      subject { create :feeder_item, blocked: false }

      it "ensures the item is blocked" do
        subject.block
        expect(subject).to be_blocked
      end
    end

    describe "#unreport" do
      subject { create :feeder_item, reported: true }

      it "ensures the item is not reported" do
        subject.unreport
        expect(subject).not_to be_reported
      end
    end

    describe "#unblock" do
      subject { create :feeder_item, blocked: true }

      it "ensures the item is not blocked" do
        subject.unblock
        expect(subject).not_to be_blocked
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feeder-0.5.1 spec/models/feeder/item_spec.rb