Sha256: 18b638995b96f8427e9ccdd313fddf3c4f5bfc0f31912b800cf954ea9d95d2a3

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

require 'rails_helper'

describe Pulitzer::UpdateVersionStatus do
  let(:version)     { create(:version, :with_content_elements) }
  let(:post)        { version.post }
  it 'activates a version' do
    expect(version.status).to eq 'preview'
    Pulitzer::UpdateVersionStatus.new(version,:active).call
    expect(post.active_version.id).to eq version.id
    expect(post.preview_version).to be_instance_of Pulitzer::Version
    expect(post.preview_version.id).not_to eq version.id
    expect(post.preview_version.content_elements.count).to eq 3
  end

  it 'abandons a version' do
    expect(version.status).to eq 'preview'
    Pulitzer::UpdateVersionStatus.new(version,:active).call
    version.reload
    expect(version.status).to eq 'active'
    preview = post.preview_version
    Pulitzer::UpdateVersionStatus.new(preview,:abandoned).call
    preview.reload
    abandoned = preview
    expect(abandoned.status).to eq 'abandoned'
    expect(post.preview_version).to be_instance_of Pulitzer::Version
    expect(post.preview_version.id).not_to eq abandoned.id
    expect(post.preview_version.content_elements.count).to eq 3
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pulitzer-0.3.7 spec/interactions/update_version_status_spec.rb
pulitzer-0.3.6 spec/interactions/update_version_status_spec.rb
pulitzer-0.3.5 spec/interactions/update_version_status_spec.rb
pulitzer-0.3.4 spec/interactions/update_version_status_spec.rb
pulitzer-0.3.3 spec/interactions/update_version_status_spec.rb
pulitzer-0.3.2 spec/interactions/update_version_status_spec.rb
pulitzer-0.3.1 spec/interactions/update_version_status_spec.rb
pulitzer-0.3.0 spec/interactions/update_version_status_spec.rb
pulitzer-0.2.2 spec/interactions/update_version_status_spec.rb
pulitzer-0.2.1 spec/interactions/update_version_status_spec.rb
pulitzer-0.2.0 spec/interactions/update_version_status_spec.rb