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.1.10 spec/models/post_spec.rb
pulitzer-0.1.9 spec/models/post_spec.rb
pulitzer-0.1.8 spec/models/post_spec.rb