Sha256: 294ea0a3c4cd6609cc0c64126cb41dc73876cb7eea1f6c8666e3aeaa8816ee0d

Contents?: true

Size: 815 Bytes

Versions: 5

Compression:

Stored size: 815 Bytes

Contents

require 'spec_helper'

describe Post, type: :model do
  let(:user) { User.create }
  let(:post) { Post.create }

  describe 'instance methods' do
    it 'should be defined' do
      # :user resonates with :post by :like
      expect(post).not_to respond_to(:like)
      expect(post).not_to respond_to(:unlike)
      expect(post).not_to respond_to(:liking?)
      expect(post).not_to respond_to(:liking)
      expect(post).to respond_to(:liked_by?)
      expect(post).to respond_to(:likers)
    end
  end

  describe '#liked_by?' do
    before { user.like post }

    it 'should be liked by user' do
      expect(post).to be_liked_by(user)
    end
  end

  describe '#likers' do
    before { user.like post }

    it 'should be included user' do
      expect(post.likers).to be_exists(id: user.id)
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
resonance-0.4.1 spec/models/post_spec.rb
resonance-0.4.0 spec/models/post_spec.rb
resonance-0.3.3 spec/models/post_spec.rb
resonance-0.3.2 spec/models/post_spec.rb
resonate-0.3.1 spec/models/post_spec.rb