diff --git a/app/models/collection.rb b/app/models/collection.rb
index 325e51895fe..3a7a547b6c7 100755
--- a/app/models/collection.rb
+++ b/app/models/collection.rb
@@ -62,67 +62,67 @@ def ensure_associated
CHALLENGE_TYPE_OPTIONS = [
["", ""],
- [ts("Gift Exchange"), "GiftExchange"],
- [ts("Prompt Meme"), "PromptMeme"]
+ [human_attribute_name("gift_exchange"), "GiftExchange"],
+ [human_attribute_name("prompt_meme"), "PromptMeme"]
].freeze
validate :must_have_owners
def must_have_owners
# we have to use collection participants because the association may not exist until after
# the collection is saved
- errors.add(:base, ts("Collection has no valid owners.")) if (self.collection_participants + (self.parent ? self.parent.collection_participants : [])).select(&:is_owner?)
+ errors.add(:base, :it_has_no_owners) if (self.collection_participants + (self.parent ? self.parent.collection_participants : [])).select(&:is_owner?)
.empty?
end
validate :collection_depth
def collection_depth
- errors.add(:base, ts("Sorry, but %{name} is a subcollection, so it can't also be a parent collection.", name: parent.name)) if self.parent&.parent || (self.parent && !self.children.empty?) || (!self.children.empty? && !self.children.collect(&:children).flatten.empty?)
+ errors.add(:base, :subcollection_cant_be_parent_collection, name: parent.name) if self.parent&.parent || (self.parent && !self.children.empty?) || (!self.children.empty? && !self.children.collect(&:children).flatten.empty?)
end
validate :parent_exists
def parent_exists
- errors.add(:base, ts("We couldn't find a collection with name %{name}.", name: parent_name)) unless parent_name.blank? || Collection.find_by(name: parent_name)
+ errors.add(:base, :parent_doesnt_exist, name: parent_name) unless parent_name.blank? || Collection.find_by(name: parent_name)
end
validate :parent_is_allowed
def parent_is_allowed
if parent
if parent == self
- errors.add(:base, ts("You can't make a collection its own parent."))
+ errors.add(:base, :cant_be_its_own_parent)
elsif parent_id_changed? && !parent.user_is_maintainer?(User.current_user)
- errors.add(:base, ts("You have to be a maintainer of %{name} to make a subcollection.", name: parent.name))
+ errors.add(:base, :not_a_maintainer_of_parent, name: parent.name)
end
end
end
- validates :name, presence: { message: ts("Please enter a name for your collection.") }
- validates :name, uniqueness: { message: ts("Sorry, that name is already taken. Try again, please!") }
+ validates :name, presence: { message: :no_name_entered }
+ validates :name, uniqueness: { message: :taken }
validates :name,
length: { minimum: ArchiveConfig.TITLE_MIN,
- too_short: ts("must be at least %{min} characters long.", min: ArchiveConfig.TITLE_MIN) }
+ too_short: :too_short, min: ArchiveConfig.TITLE_MIN }
validates :name,
length: { maximum: ArchiveConfig.TITLE_MAX,
- too_long: ts("must be less than %{max} characters long.", max: ArchiveConfig.TITLE_MAX) }
+ too_long: :too_long, max: ArchiveConfig.TITLE_MAX }
validates :name,
- format: { message: ts("must begin and end with a letter or number; it may also contain underscores. It may not contain any other characters, including spaces."),
+ format: { message: :characters_used,
with: /\A[A-Za-z0-9]\w*[A-Za-z0-9]\Z/ }
validates :icon_alt_text, length: { allow_blank: true, maximum: ArchiveConfig.ICON_ALT_MAX,
- too_long: ts("must be less than %{max} characters long.", max: ArchiveConfig.ICON_ALT_MAX) }
+ too_long: :too_long, max: ArchiveConfig.ICON_ALT_MAX }
validates :icon_comment_text, length: { allow_blank: true, maximum: ArchiveConfig.ICON_COMMENT_MAX,
- too_long: ts("must be less than %{max} characters long.", max: ArchiveConfig.ICON_COMMENT_MAX) }
+ too_long: :too_long, max: ArchiveConfig.ICON_COMMENT_MAX }
validates :email, email_format: { allow_blank: true }
- validates :title, presence: { message: ts("Please enter a title to be displayed for your collection.") }
+ validates :title, presence: { message: :no_title_entered }
validates :title,
length: { minimum: ArchiveConfig.TITLE_MIN,
- too_short: ts("must be at least %{min} characters long.", min: ArchiveConfig.TITLE_MIN) }
+ too_short: :too_short, min: ArchiveConfig.TITLE_MIN }
validates :title,
length: { maximum: ArchiveConfig.TITLE_MAX,
- too_long: ts("must be less than %{max} characters long.", max: ArchiveConfig.TITLE_MAX) }
+ too_long: :too_long, max: ArchiveConfig.TITLE_MAX }
validate :no_reserved_strings
def no_reserved_strings
- errors.add(:title, ts("^Sorry, the ',' character cannot be in a collection Display Title.")) if
+ errors.add(:title, :comma_used) if
title.match(/,/)
end
@@ -134,14 +134,14 @@ def title
validates :description,
length: { allow_blank: true,
maximum: ArchiveConfig.SUMMARY_MAX,
- too_long: ts("must be less than %{max} characters long.", max: ArchiveConfig.SUMMARY_MAX) }
+ too_long: :too_long, max: ArchiveConfig.SUMMARY_MAX }
- validates :header_image_url, url_format: { allow_blank: true, message: ts("is not a valid URL.") }
+ validates :header_image_url, url_format: { allow_blank: true, message: :valid_url }
validates :header_image_url, format: { allow_blank: true, with: /\A\S+\.(png|gif|jpe?g)\z/, message: :file_format }
-
+
validates :tags_after_saving,
length: { maximum: ArchiveConfig.COLLECTION_TAGS_MAX,
- message: "^Sorry, a collection can only have %{count} tags." }
+ message: :too_many_tags, max: ArchiveConfig.COLLECTION_TAGS_MAX }
scope :top_level, -> { where(parent_id: nil) }
scope :closed, -> { joins(:collection_preference).where(collection_preferences: { closed: true }) }
diff --git a/config/locales/models/en.yml b/config/locales/models/en.yml
index a8f03c21410..6ed08141af1 100644
--- a/config/locales/models/en.yml
+++ b/config/locales/models/en.yml
@@ -26,7 +26,14 @@ en:
base: 'Invalid creator:'
pseud_id: Pseud
collection:
+ description: Description
+ gift_exchange: Gift Exchange
header_image_url: Header image URL
+ icon_alt_text: Icon alt text
+ icon_comment_text: Icon comment text
+ name: Name
+ prompt_meme: Prompt Meme
+ title: Title
creatorships:
base: 'Invalid creator:'
pseud_id: Pseud
@@ -120,8 +127,34 @@ en:
format: "%{message}"
collection:
attributes:
+ base:
+ cant_be_its_own_parent: You can't make a collection its own parent.
+ it_has_no_owners: Collection has no valid owners.
+ not_a_maintainer_of_parent: You have to be a maintainer of %{name} to make a subcollection.
+ parent_doesnt_exist: We couldn't find a collection with name %{name}.
+ subcollection_cant_be_parent_collection: Sorry, but %{name} is a subcollection, so it can't also be a parent collection.
+ description:
+ too_long: must be less than %{max} characters long.
header_image_url:
file_format: can only point to a gif, jpg, jpeg, or png file.
+ valid_url: is not a valid URL.
+ icon_alt_text:
+ too_long: must be less than %{max} characters long.
+ icon_comment_text:
+ too_long: must be less than %{max} characters long.
+ name:
+ characters_used: must begin and end with a letter or number; it may also contain underscores. It may not contain any other characters, including spaces.
+ no_name_entered: "^Please enter a name for your collection."
+ taken: Sorry, that name is already taken. Try again, please!
+ too_long: must be less than %{max} characters long.
+ too_short: must be at least %{min} characters long.
+ tags_after_saving:
+ too_many_tags: "^Sorry, a collection can only have %{max} tags."
+ title:
+ comma_used: "^Sorry, the ',' character cannot be in a collection Display Title."
+ no_title_entered: "^Please enter a title to be displayed for your collection."
+ too_long: must be less than %{max} characters long.
+ too_short: must be at least %{min} characters long.
collection_item:
attributes:
collection:
@@ -310,6 +343,9 @@ en:
character:
one: Character
other: Characters
+ collection:
+ one: Collection
+ other: Collections
comment: Comment
fandom:
one: Fandom
diff --git a/db/migrate/20260728014110_add_unique_index_to_collection_names.rb b/db/migrate/20260728014110_add_unique_index_to_collection_names.rb
new file mode 100644
index 00000000000..8069ba24297
--- /dev/null
+++ b/db/migrate/20260728014110_add_unique_index_to_collection_names.rb
@@ -0,0 +1,8 @@
+class AddUniqueIndexToCollectionNames < ActiveRecord::Migration[8.1]
+ uses_departure! if Rails.env.staging? || Rails.env.production?
+
+ def change
+ remove_index :collections, :name
+ add_index :collections, :name, unique: true
+ end
+end
diff --git a/features/collections/collection_create.feature b/features/collections/collection_create.feature
index d5fa8e2c005..42d3679f404 100755
--- a/features/collections/collection_create.feature
+++ b/features/collections/collection_create.feature
@@ -4,226 +4,221 @@ Feature: Collection
As a humble user
I want to create a collection and post to it
-Scenario: Create a collection
-
- Given I am logged in as "first_user"
- When I go to the collections page
- Then I should see "Collections in the "
- And I should not see "My Collection Thing"
- When I follow "New Collection"
- And I fill in "Display title" with "My Collection Thing"
- And I fill in "Collection name" with "collection_thing"
- And I fill in "Introduction" with "Welcome to the collection"
- And I fill in "FAQ" with "
- What is this thing?
- It's a collection
"
- And I fill in "Rules" with "Be nice to people"
- And I fill in "collection_tag_string" with "My New Fandom, My OC"
- And I check all the collection settings checkboxes
- And I submit
- Then I should see "Collection was successfully created"
- When I follow "Profile"
- Then I should see "Welcome to the collection" within "#intro"
- And I should see "What is this thing?" within "#faq"
- And I should see "It's a collection" within "#faq"
- And I should see "Be nice to people" within "#rules"
- And I should see "My New Fandom" within ".meta"
- And I should see "My OC" within ".meta"
- When I follow "Collection Settings"
- And I fill in "Collection name" with " "
- And I submit
- And I should see "Please enter a name for your collection"
- When I fill in "Collection name" with "collection_thing2"
- And I submit
- And I should see "Collection was successfully updated"
- And the name of the collection "My Collection Thing" should be "collection_thing2"
-
-Scenario: Post to collection from the work edit page
- Given the collection "My Collection Thing" with name "collection_thing"
- And I am logged in as "first_user"
- When I post the work "collect-y work"
- And I go to first_user's user page
- Then I should see "collect-y work"
- When I edit the work "collect-y work"
- And I fill in "work_collection_names" with "collection_thing"
- And I press "Preview"
- And I press "Update"
- Then I should see "collect-y work"
- And I should see "Collections: My Collection Thing"
-
-Scenario: Post to collection from the collection home page
-
- Given I have the collection "My Collection Thing" with name "collection_thing"
- And basic tags
- And I am logged in as "first_user"
- When I go to the collections page
- And I follow "My Collection Thing"
- And I follow "Post to Collection"
- Then I should see "Post New Work"
- And I should see "collection_thing" in the "Post to Collections / Challenges" input
- When I fill in the basic work information for "My Collected Work"
- And I press "Preview"
- Then I should see "My Collection Thing" within "dd.collections"
- When I press "Post"
- Then I should see "My Collected Work"
- And I should see "Collections: My Collection Thing"
-
-Scenario: Create a subcollection
-
- Given I am logged in as "first_user"
- And I create the collection "My Collection Thing" with name "collection_thing"
- When I go to the collections page
- And I follow "New Collection"
- And I fill in "collection_parent_name" with "collection_thing"
- And I fill in "Display title" with "My SubCollection"
- And I fill in "Collection name" with "subcollection_thing"
- And I submit
- Then I should see "Collection was successfully created"
-
-Scenario: Fill out new collection form with faulty data
-
- Given I am logged in as a random user
- And I am on the collections page
-
- When I follow "New Collection"
- And I fill in the following:
- | Collection name | faulty name |
- | Display title | Awesome Collection |
- | Collection email | fangirl@example.org |
- | Brief description | My Description |
- | Introduction | My Introduction |
- | FAQ | My FAQ |
- | Rules | My Rules |
- | Assignment notification message | My Message |
- | Gift notification message | My Other Message |
-
- And I check "This collection is closed"
- And I select "Gift Exchange" from "Type of challenge, if any"
- And I submit
-
- Then I should see a save error message
- And I should see "faulty name" in the "Collection name" input
- And I should see "Awesome Collection" in the "Display title" input
- And I should see "fangirl@example.org" in the "Collection email" input
- And I should see "My Description" in the "Brief description" input
- And I should see "My Introduction" in the "Introduction" input
- And I should see "My FAQ" in the "FAQ" input
- And I should see "My Rules" in the "Rules" input
- And I should see "My Message" in the "Assignment notification message" input
- And I should see "My Other Message" in the "Gift notification message" input
- And the "This collection is closed" checkbox should not be disabled
- And "Gift Exchange" should be selected within "Type of challenge, if any"
-
-Scenario: Create a collection with a malformed header URL
-
-Given I have the collection "Scotts Collection" with name "scotts_collection"
- And I am logged in as "moderator"
- And I am on "Scotts Collection" collection's page
- And I follow "Collection Settings"
- And I fill in "collection_header_image_url" with "fc00.deviantart.net/fs13/f/2007/004/a/7/Flooded_by_bingeling.jpg"
- And I press "Update"
- And I should see "Collection was successfully updated"
+ Scenario: Create a collection
+ Given I am logged in as "first_user"
+ When I go to the collections page
+ Then I should see "Collections in the "
+ And I should not see "My Collection Thing"
+ When I follow "New Collection"
+ And I fill in "Display title" with "My Collection Thing"
+ And I fill in "Collection name" with "collection_thing"
+ And I fill in "Introduction" with "Welcome to the collection"
+ And I fill in "FAQ" with "- What is this thing?
- It's a collection
"
+ And I fill in "Rules" with "Be nice to people"
+ And I fill in "collection_tag_string" with "My New Fandom, My OC"
+ And I check all the collection settings checkboxes
+ And I submit
+ Then I should see "Collection was successfully created"
+ When I follow "Profile"
+ Then I should see "Welcome to the collection" within "#intro"
+ And I should see "What is this thing?" within "#faq"
+ And I should see "It's a collection" within "#faq"
+ And I should see "Be nice to people" within "#rules"
+ And I should see "My New Fandom" within ".meta"
+ And I should see "My OC" within ".meta"
+ When I follow "Collection Settings"
+ And I fill in "Collection name" with " "
+ And I submit
+ And I should see "Please enter a name for your collection"
+ When I fill in "Collection name" with "collection_thing2"
+ And I submit
+ And I should see "Collection was successfully updated"
+ And the name of the collection "My Collection Thing" should be "collection_thing2"
+
+ Scenario: Post to collection from the work edit page
+ Given the collection "My Collection Thing" with name "collection_thing"
+ And I am logged in as "first_user"
+ When I post the work "collect-y work"
+ And I go to first_user's user page
+ Then I should see "collect-y work"
+ When I edit the work "collect-y work"
+ And I fill in "work_collection_names" with "collection_thing"
+ And I press "Preview"
+ And I press "Update"
+ Then I should see "collect-y work"
+ And I should see "Collections: My Collection Thing"
+
+ Scenario: Post to collection from the collection home page
+ Given I have the collection "My Collection Thing" with name "collection_thing"
+ And basic tags
+ And I am logged in as "first_user"
+ When I go to the collections page
+ And I follow "My Collection Thing"
+ And I follow "Post to Collection"
+ Then I should see "Post New Work"
+ And I should see "collection_thing" in the "Post to Collections / Challenges" input
+ When I fill in the basic work information for "My Collected Work"
+ And I press "Preview"
+ Then I should see "My Collection Thing" within "dd.collections"
+ When I press "Post"
+ Then I should see "My Collected Work"
+ And I should see "Collections: My Collection Thing"
+
+ Scenario: Create a subcollection
+ Given I am logged in as "first_user"
+ And I create the collection "My Collection Thing" with name "collection_thing"
+ When I go to the collections page
+ And I follow "New Collection"
+ And I fill in "collection_parent_name" with "collection_thing"
+ And I fill in "Display title" with "My SubCollection"
+ And I fill in "Collection name" with "subcollection_thing"
+ And I submit
+ Then I should see "Collection was successfully created"
+
+ Scenario: Fill out new collection form with faulty data
+ Given I am logged in as a random user
+ And I am on the collections page
+ When I follow "New Collection"
+ And I fill in the following:
+ | Collection name | faulty name |
+ | Display title | Awesome Collection |
+ | Collection email | fangirl@example.org |
+ | Brief description | My Description |
+ | Introduction | My Introduction |
+ | FAQ | My FAQ |
+ | Rules | My Rules |
+ | Assignment notification message | My Message |
+ | Gift notification message | My Other Message |
+ And I check "This collection is closed"
+ And I select "Gift Exchange" from "Type of challenge, if any"
+ And I submit
+ Then I should see a save error message
+ And I should see "faulty name" in the "Collection name" input
+ And I should see "Awesome Collection" in the "Display title" input
+ And I should see "fangirl@example.org" in the "Collection email" input
+ And I should see "My Description" in the "Brief description" input
+ And I should see "My Introduction" in the "Introduction" input
+ And I should see "My FAQ" in the "FAQ" input
+ And I should see "My Rules" in the "Rules" input
+ And I should see "My Message" in the "Assignment notification message" input
+ And I should see "My Other Message" in the "Gift notification message" input
+ And the "This collection is closed" checkbox should not be disabled
+ And "Gift Exchange" should be selected within "Type of challenge, if any"
+
+ Scenario: Create a collection with a malformed header URL
+ Given I have the collection "Scotts Collection" with name "scotts_collection"
+ And I am logged in as "moderator"
+ And I am on "Scotts Collection" collection's page
+ And I follow "Collection Settings"
+ And I fill in "collection_header_image_url" with "fc00.deviantart.net/fs13/f/2007/004/a/7/Flooded_by_bingeling.jpg"
+ And I press "Update"
+ And I should see "Collection was successfully updated"
Scenario: Update a collection with a HTTPS header URL
-
- Given I have the collection "Scotts Collection" with name "scotts_collection"
- When I am logged in as "moderator"
- And I am on "Scotts Collection" collection's page
- And I follow "Collection Settings"
- And I fill in "Custom header URL" with "https://example.com/image.png"
- And I press "Update"
- Then I should see "Collection was successfully updated"
- When I follow "Collection Settings"
- Then I should see "https://example.com/image.png" in the "Custom header URL" input
+ Given I have the collection "Scotts Collection" with name "scotts_collection"
+ When I am logged in as "moderator"
+ And I am on "Scotts Collection" collection's page
+ And I follow "Collection Settings"
+ And I fill in "Custom header URL" with "https://example.com/image.png"
+ And I press "Update"
+ Then I should see "Collection was successfully updated"
+ When I follow "Collection Settings"
+ Then I should see "https://example.com/image.png" in the "Custom header URL" input
Scenario: Delete a subcollection and then its parent collection
-
- Given I am logged in as "collector"
- And I create the collection "Temporary Top" with name "temporary_top_collection"
- When I go to the collections page
- And I follow "New Collection"
- And I fill in "collection_parent_name" with "temporary_top_collection"
- And I fill in "Display title" with "Temporary Subcollection"
- And I fill in "Collection name" with "temporary_subcollection"
- And I press "Submit"
- Then I should see "Collection was successfully created"
- When I follow "Collection Settings"
- And I follow "Delete Collection"
- And I press "Yes, Delete Collection"
- Then I should see "Collection was successfully deleted."
- And I should see "Temporary Top"
- When I follow "Temporary Top"
- And I follow "Collection Settings"
- When I follow "Delete Collection"
- And I press "Yes, Delete Collection"
- Then I should see "Collection was successfully deleted."
- And I should not see "Temporary Top"
+ Given I am logged in as "collector"
+ And I create the collection "Temporary Top" with name "temporary_top_collection"
+ When I go to the collections page
+ And I follow "New Collection"
+ And I fill in "collection_parent_name" with "temporary_top_collection"
+ And I fill in "Display title" with "Temporary Subcollection"
+ And I fill in "Collection name" with "temporary_subcollection"
+ And I press "Submit"
+ Then I should see "Collection was successfully created"
+ When I follow "Collection Settings"
+ And I follow "Delete Collection"
+ And I press "Yes, Delete Collection"
+ Then I should see "Collection was successfully deleted."
+ And I should see "Temporary Top"
+ When I follow "Temporary Top"
+ And I follow "Collection Settings"
+ When I follow "Delete Collection"
+ And I press "Yes, Delete Collection"
+ Then I should see "Collection was successfully deleted."
+ And I should not see "Temporary Top"
Scenario: Delete a collection that has subcollections
-
- Given I am logged in as "collector"
- And I create the collection "Parent" with name "parent_collection"
- When I go to the collections page
- And I follow "New Collection"
- And I fill in "collection_parent_name" with "parent_collection"
- And I fill in "Display title" with "Child"
- And I fill in "Collection name" with "child_collection"
- And I press "Submit"
- Then I should see "Collection was successfully created"
- When I go to the collections page
- And I follow "Parent"
- And I follow "Collection Settings"
- When I follow "Delete Collection"
- And I press "Yes, Delete Collection"
- Then I should see "Collection was successfully deleted."
- And I should not see "Parent"
-
- Scenario: Moderator cannot list one collection's subcollection as another
- collection's parent
-
- Given I am logged in as "collector"
- And I add the subcollection "Subcollection" to the parent collection named "parent_collection"
- When I go to the new collection page
- And I fill in "Parent collection (that you maintain)" with "subcollection"
- And I fill in "Display title" with "Sub-Subcollection"
- And I fill in "Collection name" with "sub_subcollection"
- And I press "Submit"
- Then I should see "Sorry, but Subcollection is a subcollection, so it can't also be a parent collection."
+ Given I am logged in as "collector"
+ And I create the collection "Parent" with name "parent_collection"
+ When I go to the collections page
+ And I follow "New Collection"
+ And I fill in "collection_parent_name" with "parent_collection"
+ And I fill in "Display title" with "Child"
+ And I fill in "Collection name" with "child_collection"
+ And I press "Submit"
+ Then I should see "Collection was successfully created"
+ When I go to the collections page
+ And I follow "Parent"
+ And I follow "Collection Settings"
+ When I follow "Delete Collection"
+ And I press "Yes, Delete Collection"
+ Then I should see "Collection was successfully deleted."
+ And I should not see "Parent"
+
+ Scenario: Moderator cannot list one collection's subcollection as another collection's parent
+ Given I am logged in as "collector"
+ And I add the subcollection "Subcollection" to the parent collection named "parent_collection"
+ When I go to the new collection page
+ And I fill in "Parent collection (that you maintain)" with "subcollection"
+ And I fill in "Display title" with "Sub-Subcollection"
+ And I fill in "Collection name" with "sub_subcollection"
+ And I press "Submit"
+ Then I should see "Sorry, but Subcollection is a subcollection, so it can't also be a parent collection."
Scenario: Moderator cannot specify a parent collection that does not exist
-
- Given I am logged in
- When I go to the new collection page
- And I fill in "Parent collection (that you maintain)" with "nonexistent_collection"
- And I fill in "Display title" with "Collection"
- And I fill in "Collection name" with "Collection"
- And I press "Submit"
- Then I should see "We couldn't find a collection with name nonexistent_collection."
+ Given I am logged in
+ When I go to the new collection page
+ And I fill in "Parent collection (that you maintain)" with "nonexistent_collection"
+ And I fill in "Display title" with "Collection"
+ And I fill in "Collection name" with "Collection"
+ And I press "Submit"
+ Then I should see "We couldn't find a collection with name nonexistent_collection."
Scenario: Moderator cannot make a collection its own parent
-
- Given I am logged in
- And I create the collection "Collection" with name "collection"
- When I go to "Collection" collection edit page
- And I fill in "Parent collection (that you maintain)" with "collection"
- And I press "Update"
- Then I should see "You can't make a collection its own parent."
+ Given I am logged in
+ And I create the collection "Collection" with name "collection"
+ When I go to "Collection" collection edit page
+ And I fill in "Parent collection (that you maintain)" with "collection"
+ And I press "Update"
+ Then I should see "You can't make a collection its own parent."
Scenario: Moderator cannot list a parent collection they do not own
-
- Given I am logged in as "collector"
- And I create the collection "Collection" with name "collection"
- When I am logged in as "other_collector"
- And I go to the new collection page
- And I fill in "Display title" with "Other Collection"
- And I fill in "Collection name" with "other_collection"
- And I fill in "Parent collection (that you maintain)" with "collection"
- And I press "Submit"
- Then I should see "You have to be a maintainer of collection to make a subcollection."
+ Given I am logged in as "collector"
+ And I create the collection "Collection" with name "collection"
+ When I am logged in as "other_collector"
+ And I go to the new collection page
+ And I fill in "Display title" with "Other Collection"
+ And I fill in "Collection name" with "other_collection"
+ And I fill in "Parent collection (that you maintain)" with "collection"
+ And I press "Submit"
+ Then I should see "You have to be a maintainer of collection to make a subcollection."
Scenario: Collection display title can't contain commas
-
- Given I am logged in
- And I am on the new collection page
- When I fill in "Display title" with "Hey, You"
- And I fill in "Collection name" with "hey_you"
- And I press "Submit"
- Then I should see "Sorry, the ',' character cannot be in a collection Display Title."
+ Given I am logged in
+ And I am on the new collection page
+ When I fill in "Display title" with "Hey, You"
+ And I fill in "Collection name" with "hey_you"
+ And I press "Submit"
+ Then I should see "Sorry, the ',' character cannot be in a collection Display Title."
+
+ Scenario: Error messages are accurate after entering nothing when creating a new collection
+ Given I am logged in
+ And I am on the new collection page
+ When I press "Submit"
+ Then I should see "Please enter a name for your collection."
+ And I should not see "Name Please enter a name for your collection."
+ And I should see "Name must be at least 1 characters long."
+ And I should see "Name must begin and end with a letter or number; it may also contain underscores. It may not contain any other characters, including spaces."
+ And I should see "Please enter a title to be displayed for your collection."
+ And I should not see "Title Please enter a title to be displayed for your collection."
+ And I should see "Title must be at least 1 characters long."