Sha256: 69a412081465184eb064491bcd3823ed8af6ebf5bba47ddfd1e10dc1db20d384

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

require 'rails_helper'

module Kawara
  RSpec.describe ArticlesTag, type: :model do

    describe 'associations' do
      it { should belong_to(:article) }
      it { should belong_to(:tag) }
    end

    describe 'validations' do
      it { should validate_presence_of(:article) }
      it { should validate_presence_of(:tag) }
    end

    describe 'counter cache' do
      subject { create :kawara_articles_tag, tag: tag }
      let(:tag) { create :kawara_tag }
      it { expect{subject}.to change{tag.articles_count}.from(nil).to(1) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kawara-0.2.0 spec/models/kawara/articles_tag_spec.rb
kawara-0.1.1 spec/models/kawara/articles_tag_spec.rb
kawara-0.1.0 spec/models/kawara/articles_tag_spec.rb