Sha256: 51372bf408101c2ce361c3d726b29654b551168cb54b5d23c7ab5df9772394fd

Contents?: true

Size: 1.47 KB

Versions: 34

Compression:

Stored size: 1.47 KB

Contents

require 'rails_helper'

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

  let(:custom_option) {Pulitzer::CustomOption.find_by value: 'contactMgmt'}
  let(:custom_option_list) {custom_option.custom_option_list}
  let(:cet) {Pulitzer::ContentElementType.find_by name: 'Clickable'}
  let(:content_element) {Pulitzer::ContentElement.find_by content_element_type_id: cet.id}

  describe "content_elements", type: :request do
    it "updates a clickable with a custom option" do
      content_element.update body: 'remove me'
      expect(content_element.custom_option_id).not_to eq custom_option.id
      patch pulitzer.content_element_path(id: content_element.id, content_element:{
        clickable_kind: custom_option_list.gid, custom_option_id: custom_option.id
        })
      expect(response.status).to eq 200
      expect(content_element.reload.custom_option_id).to eq custom_option.id
      expect(content_element.body).to be nil
    end

    it "updates a clickable with a url" do
      content_element.update custom_option_id: custom_option.id
      expect(content_element.body).not_to eq 'http://google.com'
      patch pulitzer.content_element_path(id: content_element.id, content_element:{
        clickable_kind: 'url', body: 'http://google.com'
        })
      expect(response.status).to eq 200
      expect(content_element.reload.custom_option_id).to be nil
      expect(content_element.body).to eq 'http://google.com'
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

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