summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/support/app/models/ticket.rb6
-rw-r--r--engines/support/test/functional/tickets_controller_test.rb4
-rw-r--r--engines/support/test/unit/ticket_test.rb4
-rw-r--r--test/functional/v1/services_controller_test.rb6
4 files changed, 11 insertions, 9 deletions
diff --git a/engines/support/app/models/ticket.rb b/engines/support/app/models/ticket.rb
index d5a0b5d..bf5df53 100644
--- a/engines/support/app/models/ticket.rb
+++ b/engines/support/app/models/ticket.rb
@@ -98,7 +98,11 @@ class Ticket < CouchRest::Model::Base
end
def created_by_user
- User.find(self.created_by) || AnonymousUser.new
+ if self.created_by
+ User.find(self.created_by) || AnonymousUser.new
+ else
+ AnonymousUser.new
+ end
end
def regarding_user_actual_user
diff --git a/engines/support/test/functional/tickets_controller_test.rb b/engines/support/test/functional/tickets_controller_test.rb
index d746b59..fc4a6f8 100644
--- a/engines/support/test/functional/tickets_controller_test.rb
+++ b/engines/support/test/functional/tickets_controller_test.rb
@@ -85,7 +85,7 @@ class TicketsControllerTest < ActionController::TestCase
test "should create authenticated ticket" do
- params = {:subject => "auth ticket test subject", :comments_attributes => {"0" => {"body" =>"body of test ticket"}}}
+ params = {:subject => "auth ticket test subject",:email => "", :comments_attributes => {"0" => {"body" =>"body of test ticket"}}}
login
@@ -97,7 +97,7 @@ class TicketsControllerTest < ActionController::TestCase
assert_not_nil assigns(:ticket).created_by
assert_equal assigns(:ticket).created_by, @current_user.id
- assert_equal assigns(:ticket).email, @current_user.email_address
+ assert_equal "", assigns(:ticket).email
assert_equal 1, assigns(:ticket).comments.count
assert_not_nil assigns(:ticket).comments.first.posted_by
diff --git a/engines/support/test/unit/ticket_test.rb b/engines/support/test/unit/ticket_test.rb
index f5e6ea7..678d8dc 100644
--- a/engines/support/test/unit/ticket_test.rb
+++ b/engines/support/test/unit/ticket_test.rb
@@ -27,10 +27,10 @@ class TicketTest < ActiveSupport::TestCase
end
test "creation validated" do
+ user = FactoryGirl.create :user
@sample = Ticket.new
assert !@sample.is_creator_validated?
- #p current_user
- @sample.created_by = 22 #current_user
+ @sample.created_by = user.id
assert @sample.is_creator_validated?
end
diff --git a/test/functional/v1/services_controller_test.rb b/test/functional/v1/services_controller_test.rb
index e4058c0..cde7d9f 100644
--- a/test/functional/v1/services_controller_test.rb
+++ b/test/functional/v1/services_controller_test.rb
@@ -21,10 +21,8 @@ class V1::ServicesControllerTest < ActionController::TestCase
test "user can see their service info" do
login
get :show, format: :json
- assert_json_response name: 'free',
- eip_rate_limit: true,
- description: 'free account, with rate limited VPN',
- storage: 100
+ default_level = APP_CONFIG[:default_service_level]
+ assert_json_response APP_CONFIG[:service_levels][default_level]
end
end