Skip to content

Commit

Permalink
Call supersede method
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasleese authored and kevindew committed Dec 21, 2016
1 parent e237a2d commit 814ac6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/commands/v2/unpublish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module V2
class Unpublish < BaseCommand
def call
validate
previous_item.update_attributes!(state: 'superseded') if previous_item
previous_item.supersede if previous_item
transition_state

after_transaction_commit do
Expand Down
9 changes: 6 additions & 3 deletions spec/commands/v2/unpublish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,18 @@

context "when the system is in an inconsistent state" do
let!(:published_item) do
FactoryGirl.create(:live_content_item,
FactoryGirl.create(:superseded_content_item,
content_id: content_id,
base_path: "/different",
user_facing_version: 2,
state: "superseded",
)
end
before do
published_item.update_columns(state: "published", base_path: base_path)
published_item.update_columns(
state: "published",
content_store: "live",
base_path: base_path
)
end

it "raises an error stating the inconsistency" do
Expand Down

0 comments on commit 814ac6b

Please sign in to comment.