Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/views/prompts/_prompt_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
%>
<dt><%= form.label :anonymous, ts("Semi-anonymous Prompt?") %></dt>
<dd>
<%= form.check_box :anonymous, :checked => @collection.challenge.anonymous? ? true : form.object.anonymous %>
<%# Default to the prompt's original anonymity value, unless we're making a new prompt and the challenge is anonymous. %>
<%= form.check_box :anonymous, checked: form.object.anonymous? || (form.object.new_record? && @collection.challenge.anonymous?) %>
<p class="footnote"><%= ts("(Note: This is not totally secure, and is still guessable in some places.)") %></p>
</dd>
<% end %>
Expand Down
30 changes: 27 additions & 3 deletions features/prompt_memes_c/challenge_promptmeme_claims.feature
Original file line number Diff line number Diff line change
Expand Up @@ -399,17 +399,41 @@ Feature: Prompt Meme Challenge
When I go to the "Battle 12" requests page
Then I should not see "Download (CSV)"

Scenario: Validation error doesn't cause semi-anon ticky to lose state (Issue 2617)
Scenario: Validation error doesn't cause semi-anon ticky to lose state (default non-anonymous) (Issue 2617)
Given I set up an anon promptmeme "Scotts Prompt" with name "scotts_prompt"
And I am logged in as "Scott" with password "password"
And I go to "Scotts Prompt" collection's page
And I follow "Prompt Form"
And I check "Semi-anonymous Prompt"
And I press "Submit"
When I press "Submit"
Then I should see "There were some problems with this submission. Please correct the mistakes below."
And I should see "Your Request must include between 1 and 2 fandom tags, but you have included 0 fandom tags in your current Request."
And the "Semi-anonymous Prompt" checkbox should be checked

Scenario: Editing prompt form doesn't cause semi-anon ticky to lose state (default semi-anonymous)
Given I set up an anon promptmeme "Scotts Prompt" with name "scotts_prompt" that is semi-anon
And a canonical fandom "Stargate Atlantis"
And I am logged in as "Scott" with password "password"
And I go to "Scotts Prompt" collection's page
And I follow "Prompt Form"
And I fill in the 1st field with id matching "fandom_tagnames" with "Stargate Atlantis"
And I uncheck "challenge_signup_requests_attributes_0_anonymous"
And I press "Submit"
Then I should see "Sign-up was successfully created."
And I should see "Request 1 by Scott"
When I follow "Edit Sign-up"
Then the "challenge_signup_requests_attributes_0_anonymous" checkbox should not be checked
When I follow "My Prompts"
And I follow "Add Prompt"
When I fill in the 1st field with id matching "fandom_tagnames" with "Stargate Atlantis"
And I press "Submit"
Then I should see "Prompt was successfully added."
And I should see "Request 1 by Scott"
And I should see "Request 2 by Anonymous"
When I follow "Edit Sign-up"
Then the "challenge_signup_requests_attributes_0_anonymous" checkbox should not be checked
And the "challenge_signup_requests_attributes_1_anonymous" checkbox should be checked

Scenario: Dates should be correctly set on PromptMemes
Given it is currently 2015-09-21 12:40 AM
And I am logged in as "mod1"
Expand Down Expand Up @@ -453,4 +477,4 @@ Feature: Prompt Meme Challenge
When I am logged in as "myname1"
And I claim a prompt from "Battle 12"
And I fulfill my claim
Then I should see "In response to a prompt by myname4 in the Battle 12 collection"
Then I should see "In response to a prompt by myname4 in the Battle 12 collection"
3 changes: 2 additions & 1 deletion features/step_definitions/challenge_promptmeme_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
step %{I claim a prompt from "Battle 12"}
end

When /^I set up an?(?: ([^"]*)) promptmeme "([^\"]*)"(?: with name "([^"]*)")?$/ do |type, title, name|
When /^I set up an?(?: ([^"]*)) promptmeme "([^"]*)"(?: with name "([^"]*)")?(?: that is ([^"]*))?$/ do |type, title, name, semianon| # rubocop:disable Cucumber/RegexStepName
step %{I am logged in as "mod1"}
visit new_collection_path
if name.nil?
Expand All @@ -100,6 +100,7 @@
fill_in("prompt_meme_request_restriction_attributes_fandom_num_allowed", with: 2)
fill_in("Sign-up opens:", with: Date.yesterday)
fill_in("Sign-up closes:", with: Date.tomorrow)
check("Prompts anonymous by default?") if semianon == "semi-anon"
step %{I submit}
step "I should see \"Challenge was successfully created\""
end
Expand Down
Loading