Sha256: a26b1fed530ac42d62a08e850e58be0c5b0c3037abb9bb56e8b220c5e00d039d

Contents?: true

Size: 641 Bytes

Versions: 23

Compression:

Stored size: 641 Bytes

Contents

require 'rails_helper'

describe Pulitzer::Post do
  let(:post) { build :post }

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

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

  describe "ActiveRecord associations" do
    it { should belong_to(:post_type) }
  end

  describe "Generate a slug" do
    let(:post) { create :post }

    it 'for a new post' do
      expect(post.slug).to match 'winterfell-news-'
    end

    it 'updating a post' do
      post.update title: 'The new King in the North'
      expect(post.slug).to eq 'the-new-king-in-the-north'
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
pulitzer-0.4.6 spec/models/post_spec.rb
pulitzer-0.4.5 spec/models/post_spec.rb
pulitzer-0.4.4 spec/models/post_spec.rb
pulitzer-0.4.3 spec/models/post_spec.rb
pulitzer-0.4.2 spec/models/post_spec.rb
pulitzer-0.4.1 spec/models/post_spec.rb
pulitzer-0.4.0 spec/models/post_spec.rb
pulitzer-0.3.9 spec/models/post_spec.rb
pulitzer-0.3.8 spec/models/post_spec.rb
pulitzer-0.3.7 spec/models/post_spec.rb
pulitzer-0.3.6 spec/models/post_spec.rb
pulitzer-0.3.5 spec/models/post_spec.rb
pulitzer-0.3.4 spec/models/post_spec.rb
pulitzer-0.3.3 spec/models/post_spec.rb
pulitzer-0.3.2 spec/models/post_spec.rb
pulitzer-0.3.1 spec/models/post_spec.rb
pulitzer-0.3.0 spec/models/post_spec.rb
pulitzer-0.2.2 spec/models/post_spec.rb
pulitzer-0.2.1 spec/models/post_spec.rb
pulitzer-0.2.0 spec/models/post_spec.rb