Sha256: 907b34e79921812492fd2d1fb4a60c2a2bee660a9c55e5396fd756aa2d4c71b6

Contents?: true

Size: 1.04 KB

Versions: 47

Compression:

Stored size: 1.04 KB

Contents

require 'rails_helper'

describe Pulitzer::Version do
  let(:version) { build :version }

  it 'has a valid factory' do
    expect(version).to be_valid
  end

  describe "Active Model validations" do
    it { should validate_presence_of(:status) }
    it { should validate_presence_of(:post_id) }
  end

  describe "ActiveRecord associations" do
    it { should have_many(:content_elements).dependent(:destroy) }
    it { should have_many(:post_tags).dependent(:destroy) }
    it { should belong_to(:post) }
  end

  describe 'ActiveRecord enums' do
    it { should define_enum_for(:status).
      with([:preview, :active, :archived, :abandoned, :processing, :processing_failed]) }
  end

  describe 'post tag filters' do
    it "has post tag filter methods" do
      label = create :tag
      version.save
      version.post_tags.create label: label
      expect(version.has_label_type(label.class.name)).to be true
      expect(version.has_label(label)).to be true
      expect(version.post_tags_for(label.class.name).map(&:label)).to include label
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
pulitzer-0.5.5 spec/models/version_spec.rb
pulitzer-0.5.4 spec/models/version_spec.rb
pulitzer-0.5.3 spec/models/version_spec.rb
pulitzer-0.5.2 spec/models/version_spec.rb
pulitzer-0.5.1 spec/models/version_spec.rb
pulitzer-0.5.0 spec/models/version_spec.rb
pulitzer-0.4.16 spec/models/version_spec.rb
pulitzer-0.4.15 spec/models/version_spec.rb
pulitzer-0.4.14 spec/models/version_spec.rb
pulitzer-0.4.13 spec/models/version_spec.rb
pulitzer-0.4.12 spec/models/version_spec.rb
pulitzer-0.4.11 spec/models/version_spec.rb
pulitzer-0.4.10 spec/models/version_spec.rb
pulitzer-0.4.9 spec/models/version_spec.rb
pulitzer-0.4.8 spec/models/version_spec.rb
pulitzer-0.4.7 spec/models/version_spec.rb
pulitzer-0.4.6 spec/models/version_spec.rb
pulitzer-0.4.5 spec/models/version_spec.rb
pulitzer-0.4.4 spec/models/version_spec.rb
pulitzer-0.4.3 spec/models/version_spec.rb