summaryrefslogtreecommitdiff
path: root/engines/support/test/integration/create_ticket_test.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-13 10:52:55 +0200
committerAzul <azul@leap.se>2014-05-13 10:52:55 +0200
commit0261e82686ec4fcfc8b633664fadb1dd6d9c8070 (patch)
tree7c8401d59f2bccf5c9e46263e89be26afcea4857 /engines/support/test/integration/create_ticket_test.rb
parent86eb9062f1e81302647bf18ce0f5fd981202b68a (diff)
keep empty email field if user removed prefill
We should respect the users choice. We can still get their email from the user id if we really need to.
Diffstat (limited to 'engines/support/test/integration/create_ticket_test.rb')
-rw-r--r--engines/support/test/integration/create_ticket_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/engines/support/test/integration/create_ticket_test.rb b/engines/support/test/integration/create_ticket_test.rb
index 2583fc7..59b263e 100644
--- a/engines/support/test/integration/create_ticket_test.rb
+++ b/engines/support/test/integration/create_ticket_test.rb
@@ -25,4 +25,32 @@ class CreateTicketTest < BrowserIntegrationTest
assert page.has_content?("is invalid")
end
+ test "prefills email when user has email service" do
+ login FactoryGirl.create(:premium_user)
+ visit '/'
+ click_on "Support Tickets"
+ click_on "New Ticket"
+ email = "#{@user.login}@#{APP_CONFIG[:domain]}"
+ assert_equal email, find_field('Email').value
+ end
+
+ test "no prefill of email without email service" do
+ login
+ visit '/'
+ click_on "Support Tickets"
+ click_on "New Ticket"
+ assert_equal "", find_field('Email').value
+ end
+
+ test "cleared email field should remain clear" do
+ login FactoryGirl.create(:premium_user)
+ visit '/'
+ click_on "Support Tickets"
+ click_on "New Ticket"
+ fill_in 'Subject', with: 'test ticket'
+ fill_in 'Email', with: ''
+ fill_in 'Description', with: 'description of the problem goes here'
+ click_on 'Create Ticket'
+ assert_nil Ticket.last.email
+ end
end