Sha256: 8b349c603dc06432f019185f09aea72be83556dcb4f0008d733dff19798caae5

Contents?: true

Size: 1.98 KB

Versions: 31

Compression:

Stored size: 1.98 KB

Contents

require 'rails_helper'

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

  let(:post_type) { Pulitzer::PostType.create(name: 'partial with various layout styles', kind: Pulitzer::PostType.kinds[:partial], plural: false) }
  let(:post_type_version) {post_type.post_type_versions.create}
  let(:arrangement_style) { post_type_version.arrangement_styles.create(display_name: 'White', view_file_name: 'white') }

  describe "arrangement_styles", type: :request do
    it "renders the new form" do
      get pulitzer.new_arrangement_style_path(arrangement_style: {post_type_version_id: post_type_version.id})
      expect(response.status).to eq 200
      expect(response.body).to match /arrangement_style\[display_name\]/
    end

    it "creates a new arrangement_style" do
      post pulitzer.arrangement_styles_path(
        arrangement_style: {
          post_type_version_id: post_type_version.id,
          view_file_name: 'pretty-arrangement',
          display_name: 'Pretty Arrangement'})
      expect(response.status).to eq 200
      bs = Pulitzer::ArrangementStyle.order(id: :desc).first
      expect(bs.view_file_name).to eq 'pretty-arrangement'
      expect(bs.display_name).to eq 'Pretty Arrangement'
    end

    it "edits an arrangement_style" do
      get pulitzer.edit_arrangement_style_path id: arrangement_style.id
      expect(response.status).to eq 200
      
      expect(response.body).to match 'White'
    end

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

    it "deletes an arrangement_style" do
      delete pulitzer.arrangement_style_path id: arrangement_style.id
      expect(response.status).to eq 200
      expect(Pulitzer::ArrangementStyle.find_by(id: arrangement_style.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/arrangement_styles_controller_spec.rb
pulitzer-0.15.30 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.29 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.28 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.27 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.26 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.25 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.24 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.23 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.22 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.21 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.20 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.19 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.18 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.17 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.16 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.15 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.14 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.13 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb
pulitzer-0.15.12 spec/controllers/pulitzer/arrangement_styles_controller_spec.rb