Sha256: 028a99e5456c225752183d4eea3fd607e62d9c7130085d676d714840e3e97ce2

Contents?: true

Size: 1.86 KB

Versions: 31

Compression:

Stored size: 1.86 KB

Contents

require 'rails_helper'

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

  let(:post_type) { Pulitzer::PostType.create(name: 'free as a bird', plural: true, kind: Pulitzer::PostType.kinds[:template]) }
  let(:post_type_version) {post_type.post_type_versions.create}
  let(:free_form_section_type) { post_type_version.free_form_section_types.create(name: 'main content') }

  describe "#amenities", type: :request do
    it "renders the new form" do
      post_type_version
      get pulitzer.new_free_form_section_type_path post_type_version_id: post_type_version.id
      expect(response.status).to eq 200
      expect(response.body).to match /free_form_section_type\[name\]/
    end

    it "creates a new free form section type" do
      post pulitzer.free_form_section_types_path free_form_section_type: {post_type_version_id: post_type_version.id, name: 'test sidebar'}
      expect(response.status).to eq 200
      ffst = Pulitzer::FreeFormSectionType.order(id: :desc).first
      expect(ffst.name).to eq "test sidebar"
    end

    it "edits an free_form_section_type" do
      get pulitzer.edit_free_form_section_type_path id: free_form_section_type.id
      expect(response.status).to eq 200
      
      expect(response.body).to match 'main content'
    end

    it "updates an free_form_section_type" do
      patch pulitzer.free_form_section_type_path id: free_form_section_type.id, free_form_section_type: {name: 'edited name'}
      expect(response.status).to eq 200
      expect(free_form_section_type.reload.name).to eq 'edited name'
    end

    it "deletes an free_form_section_type" do
      delete pulitzer.free_form_section_type_path id: free_form_section_type.id
      expect(response.status).to eq 200
      expect(Pulitzer::FreeFormSectionType.find_by(id: free_form_section_type.id)).to be nil
    end

  end # /search
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
pulitzer-0.15.31 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.30 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.29 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.28 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.27 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.26 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.25 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.24 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.23 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.22 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.21 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.20 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.19 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.18 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.17 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.16 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.15 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.14 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.13 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.15.12 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb