Sha256: fb15e97fd9767e3ed7e43c919f3967f4a3c745dc6817c66234ff8b059b4c58b9

Contents?: true

Size: 1.58 KB

Versions: 45

Compression:

Stored size: 1.58 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(:free_form_section_type) { post_type.free_form_section_types.create(name: 'main content') }

  describe "#amenities" do
    it "renders the new form" do
      post_type
      get :new, post_type_id: post_type.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 :create, free_form_section_type: {post_type_id: post_type.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 :edit, 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 :update, 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 :destroy, 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

45 entries across 45 versions & 1 rubygems

Version Path
pulitzer-0.12.5 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.12.4 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.12.3 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.12.2 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.12.1 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.12.0 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.11.3 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.11.2 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.11.1 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.11.0 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.10.3 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.10.2 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.10.1 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.10.0 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.5.14 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.5.13 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.5.11 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.5.10 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.5.9 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb
pulitzer-0.5.8 spec/controllers/pulitzer/free_form_section_types_controller_spec.rb