Sha256: 2faa93bb4d32b7363fc335fb6cd57422d4c6f8f91ca8dfdeeb43ec2cf0278652
Contents?: true
Size: 1.12 KB
Versions: 7
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require 'rails_helper' module Spina::Admin::Conferences::Blog RSpec.describe Post, type: :model do let(:post) { build(:spina_blog_post) } subject { post } it { is_expected.to be_valid } it { expect { post.save }.to change(Spina::Admin::Conferences::Blog::Post, :count).by(1) } context 'with invalid attributes' do let(:post) { build(:invalid_spina_blog_post) } it { is_expected.to_not be_valid } it { expect { post.save }.to_not change(Spina::Admin::Conferences::Blog::Post, :count) } end describe '.featured' do let!(:post) { create(:spina_blog_post, featured: true) } let!(:unfeatured) { create(:spina_blog_post) } it 'returns 1 result' do expect(Spina::Admin::Conferences::Blog::Post.featured).to match_array [post] end end describe '.unfeatured' do let!(:post) { create(:spina_blog_post, featured: true) } let!(:unfeatured) { create(:spina_blog_post) } it 'returns 1 result' do expect(Spina::Admin::Conferences::Blog::Post.unfeatured).to match_array [unfeatured] end end end end
Version data entries
7 entries across 7 versions & 1 rubygems