summaryrefslogtreecommitdiff
path: root/engines/support/test/integration
diff options
context:
space:
mode:
Diffstat (limited to 'engines/support/test/integration')
-rw-r--r--engines/support/test/integration/create_ticket_test.rb36
1 files changed, 36 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..0f8453c 100644
--- a/engines/support/test/integration/create_ticket_test.rb
+++ b/engines/support/test/integration/create_ticket_test.rb
@@ -20,9 +20,45 @@ class CreateTicketTest < BrowserIntegrationTest
click_on 'Get Help'
fill_in 'Subject', with: 'test ticket'
fill_in 'Email', with: 'invalid data'
+ fill_in 'Regarding user', with: 'some user'
fill_in 'Description', with: 'description of the problem goes here'
click_on 'Create Ticket'
assert page.has_content?("is invalid")
+ assert_equal 'invalid data', find_field('Email').value
+ assert_equal 'some user', find_field('Regarding user').value
+ end
+
+ test "prefills fields" 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
+ assert_equal @user.login, find_field('Regarding user').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
+ assert_equal @user.login, find_field('Regarding user').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'
+ ticket = Ticket.last
+ assert_equal "", ticket.email
+ ticket.destroy
end
end