Skip to content
This repository has been archived by the owner on Feb 13, 2018. It is now read-only.

Commit

Permalink
Can't create new edition if scheduled
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinay Patel committed Mar 7, 2014
1 parent 4bb4d42 commit 1d2ce35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/edition.rb
Expand Up @@ -98,7 +98,7 @@ def in_progress_sibling
end

def can_create_new_edition?
subsequent_siblings.in_progress.empty?
!scheduled_for_publishing? && subsequent_siblings.in_progress.empty?
end

def meta_data
Expand Down
9 changes: 7 additions & 2 deletions test/models/edition_scheduled_for_publishing_test.rb
Expand Up @@ -63,12 +63,17 @@ class EditionScheduledForPublishingTest < ActiveSupport::TestCase
end

should "return false for #can_destroy?" do
edition = FactoryGirl.create(:edition, :scheduled_for_publishing)
edition = FactoryGirl.build(:edition, :scheduled_for_publishing)
refute edition.can_destroy?
end

should "return false for #can_create_new_edition?" do
edition = FactoryGirl.build(:edition, :scheduled_for_publishing)
refute edition.can_create_new_edition?
end

should "allow transition to published state" do
edition = FactoryGirl.create(:edition, :scheduled_for_publishing)
edition = FactoryGirl.build(:edition, :scheduled_for_publishing)
assert edition.can_publish?
end
end
Expand Down

0 comments on commit 1d2ce35

Please sign in to comment.