Commit b00143d8b2e437da185d49c00197d839d50b5f14
1 parent
5218ff47
Exists in
web_steps_improvements
and in
8 other branches
put environment boxes test in the correct place
Showing
2 changed files
with
4 additions
and
17 deletions
Show diff stats
test/unit/api/boxes_test.rb
@@ -6,12 +6,12 @@ class BoxesTest < ActiveSupport::TestCase | @@ -6,12 +6,12 @@ class BoxesTest < ActiveSupport::TestCase | ||
6 | login_api | 6 | login_api |
7 | end | 7 | end |
8 | 8 | ||
9 | - kinds= %w[Profile Community Person Enterprise] | 9 | + kinds= %w[Profile Community Person Enterprise Environment] |
10 | kinds.each do |kind| | 10 | kinds.each do |kind| |
11 | should "get_boxes_from_#{kind.downcase.pluralize}" do | 11 | should "get_boxes_from_#{kind.downcase.pluralize}" do |
12 | - profile_obj = fast_create(kind.constantize) | ||
13 | - box = fast_create(Box, :owner_id => profile_obj.id, :owner_type => "Profile") | ||
14 | - get "/api/v1/#{kind.downcase.pluralize}/#{profile_obj.id}/boxes?#{params.to_query}" | 12 | + context_obj = fast_create(kind.constantize) |
13 | + box = fast_create(Box, :owner_id => context_obj.id, :owner_type => (kind == 'Environment') ? 'Environment' : 'Profile') | ||
14 | + get "/api/v1/#{kind.downcase.pluralize}/#{context_obj.id}/boxes?#{params.to_query}" | ||
15 | json = JSON.parse(last_response.body) | 15 | json = JSON.parse(last_response.body) |
16 | assert_equal box.id, json["boxes"].first["id"] | 16 | assert_equal box.id, json["boxes"].first["id"] |
17 | end | 17 | end |
test/unit/api/environment_test.rb
@@ -35,17 +35,4 @@ class EnvironmentTest < ActiveSupport::TestCase | @@ -35,17 +35,4 @@ class EnvironmentTest < ActiveSupport::TestCase | ||
35 | assert_equal context_env.id, json['id'] | 35 | assert_equal context_env.id, json['id'] |
36 | end | 36 | end |
37 | 37 | ||
38 | - should 'return environment boxes' do | ||
39 | - environment = Environment.default | ||
40 | - environment.boxes << Box.new | ||
41 | - box = environment.boxes.last | ||
42 | - environment.boxes[0].blocks << Block.new | ||
43 | - environment.save! | ||
44 | - assert !environment.boxes.empty? | ||
45 | - get "/api/v1/environments/#{environment.id}/boxes" | ||
46 | - json = JSON.parse(last_response.body) | ||
47 | - assert_equal "boxes", json.first[0] | ||
48 | - assert_equal box.id, json['boxes'].first['id'] | ||
49 | - end | ||
50 | - | ||
51 | end | 38 | end |