diff --git a/test/unit/api/boxes_test.rb b/test/unit/api/boxes_test.rb index a8e83bb..289c597 100644 --- a/test/unit/api/boxes_test.rb +++ b/test/unit/api/boxes_test.rb @@ -6,12 +6,12 @@ class BoxesTest < ActiveSupport::TestCase login_api end - kinds= %w[Profile Community Person Enterprise] + kinds= %w[Profile Community Person Enterprise Environment] kinds.each do |kind| should "get_boxes_from_#{kind.downcase.pluralize}" do - profile_obj = fast_create(kind.constantize) - box = fast_create(Box, :owner_id => profile_obj.id, :owner_type => "Profile") - get "/api/v1/#{kind.downcase.pluralize}/#{profile_obj.id}/boxes?#{params.to_query}" + context_obj = fast_create(kind.constantize) + box = fast_create(Box, :owner_id => context_obj.id, :owner_type => (kind == 'Environment') ? 'Environment' : 'Profile') + get "/api/v1/#{kind.downcase.pluralize}/#{context_obj.id}/boxes?#{params.to_query}" json = JSON.parse(last_response.body) assert_equal box.id, json["boxes"].first["id"] end diff --git a/test/unit/api/environment_test.rb b/test/unit/api/environment_test.rb index f80ce61..315e9bf 100644 --- a/test/unit/api/environment_test.rb +++ b/test/unit/api/environment_test.rb @@ -35,17 +35,4 @@ class EnvironmentTest < ActiveSupport::TestCase assert_equal context_env.id, json['id'] end - should 'return environment boxes' do - environment = Environment.default - environment.boxes << Box.new - box = environment.boxes.last - environment.boxes[0].blocks << Block.new - environment.save! - assert !environment.boxes.empty? - get "/api/v1/environments/#{environment.id}/boxes" - json = JSON.parse(last_response.body) - assert_equal "boxes", json.first[0] - assert_equal box.id, json['boxes'].first['id'] - end - end -- libgit2 0.21.2