Sha256: 0c30e01471cd35ee1b4a36585a234d36a278f60dfc11285f37b2ec6a40a1fef8

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

require 'rails_helper'

describe Pulitzer::PostTypesController do
  routes { Pulitzer::Engine.routes }
  render_views

  describe "#create", type: :request do
    it "Creates a plural post type without an intial post" do
      post pulitzer.post_types_path post_type: { name: 'Flock of birds', kind: 'template', plural: '1' }
      expect(response.status).to eq 200
      expect(response.body).to match /Flock of birds/
      post_type = Pulitzer::PostType.find_by(name: 'Flock of birds')
      post_type_version = post_type.post_type_versions.first
      expect(post_type_version.posts.any?).to be false
    end

    it "Creates a single post type with an intial post" do
      post pulitzer.post_types_path post_type: { name: 'Crow', kind: 'template', plural: '0' }
      post_type = Pulitzer::PostType.find_by(name: 'Crow')
      post_type_version = post_type.post_type_versions.first
      expect(response.status).to eq 200
      expect(response.body).to match post_type_version.name
      expect(post_type_version.posts.count).to eq 1
      expect(post_type_version.posts.first.title).to eq post_type_version.name
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pulitzer-0.15.12 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.11 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.10 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.9 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.8 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.7 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.6 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.5 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.4 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.3 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.2 spec/controllers/pulitzer/post_types_controller_spec.rb
pulitzer-0.15.1 spec/controllers/pulitzer/post_types_controller_spec.rb