Sha256: 63481f34f927addec2616412ca227d4959ffa1b5c93588a53fecf87e429b7aaf
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' ### # Shared examples for FollowSystem::Followee ### shared_examples_for FollowSystem::Followee do ### # Let followee be DummyFollowee.create ### let(:followee) { DummyFollowee.create } ### # Let follower be DummyFollower.create ### let(:follower) { DummyFollower.create } ### # Describes associations ### describe "associations" do ### # Should have many followers ### it "should have many followers" do should have_many(:followers) end end ### # Describes class methods ### describe "class methods" do ### # Should be a followee ### it "should be a followee" do expect(followee.is_followee?).to equal(true) end ### # Should be followed by a follower ### it "should specify if is followed by a follower" do expect(FollowSystem::Follow).to receive(:follows?).with(follower, followee) { true } expect(followee.followed_by?(follower)).to equal(true) end ### # Should scope followers filtered by follower type ### it "should scope followers filtered by follower type" do scope = FollowSystem::Follow.scope_by_followee(followee).scope_by_follower_type(DummyFollower) expect(followee.followers_by(DummyFollower)).to eq(scope) end end end ### # Describes DummyFollowee ### describe DummyFollowee, type: :model do ### # It behaves like FollowSystem::Followee ### it_behaves_like FollowSystem::Followee end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
follow_system-0.2.0 | spec/follow_system/followee_spec.rb |