summaryrefslogtreecommitdiff
path: root/engines/support/test
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-13 13:52:16 +0200
committerAzul <azul@leap.se>2014-05-13 14:02:15 +0200
commit81a4a0527639fe4b560b8d98f977f6dbac67bb41 (patch)
tree725b9effd20be6d9d62e5f0e5443c7e4c5398fcf /engines/support/test
parent84ce597ad0516b92d6633c1f81c03517b5d74004 (diff)
prefill ticket form from the model - fixes #5657
email and regarding user fields can be set to defaults based on created_by user. If these fields are emptied by the submitting user they will be set to whereas they are nil if they have not been initialized. In that case we will use meaningful defaults from the user who created the ticket.
Diffstat (limited to 'engines/support/test')
-rw-r--r--engines/support/test/integration/create_ticket_test.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/support/test/integration/create_ticket_test.rb b/engines/support/test/integration/create_ticket_test.rb
index 59b263e..0f8453c 100644
--- a/engines/support/test/integration/create_ticket_test.rb
+++ b/engines/support/test/integration/create_ticket_test.rb
@@ -20,18 +20,22 @@ 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 email when user has email service" do
+ 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
@@ -40,6 +44,7 @@ class CreateTicketTest < BrowserIntegrationTest
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
@@ -51,6 +56,9 @@ class CreateTicketTest < BrowserIntegrationTest
fill_in 'Email', with: ''
fill_in 'Description', with: 'description of the problem goes here'
click_on 'Create Ticket'
- assert_nil Ticket.last.email
+ ticket = Ticket.last
+ assert_equal "", ticket.email
+ ticket.destroy
end
+
end