Sha256: 2b4ee3f29c9269732c132ac72ef52443a8aa6a47bb3928aafe7bc058bf367bc4

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

require 'rails_helper'

describe Pulitzer::CloneVersion do
  let(:version)     { create(:version, :with_content_elements) }

  it 'Clones version content elements' do
    expect(version.content_elements.size).to eq 3
    version.post.create_processing_version
    new_version = Pulitzer::CloneVersion.new(version).call
    expect(new_version.content_elements.size).to eq 3
  end

  it 'Clones version free form sections' do
    ff_version = create(:version, :with_free_form_sections)
    expect(ff_version.free_form_sections.size).to eq 3
    ff_version.post.create_processing_version
    new_version = Pulitzer::CloneVersion.new(ff_version).call
    expect(new_version.free_form_sections.size).to eq 3
  end

  it 'Clones a valid content element' do
    version.post.create_processing_version
    new_version = Pulitzer::CloneVersion.new(version).call
    content_element = new_version.content_elements.first
    expect(content_element.title).to eq "Night's Watch"
    expect(content_element.label).to match "Slide 1 content element"
    expect(content_element.body).to match "I pledge my life"
    expect(content_element.type.to_s).to match "text"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pulitzer-0.4.8 spec/interactions/clone_version_spec.rb
pulitzer-0.4.7 spec/interactions/clone_version_spec.rb
pulitzer-0.4.6 spec/interactions/clone_version_spec.rb
pulitzer-0.4.5 spec/interactions/clone_version_spec.rb
pulitzer-0.4.4 spec/interactions/clone_version_spec.rb
pulitzer-0.4.3 spec/interactions/clone_version_spec.rb
pulitzer-0.4.2 spec/interactions/clone_version_spec.rb
pulitzer-0.4.1 spec/interactions/clone_version_spec.rb
pulitzer-0.4.0 spec/interactions/clone_version_spec.rb