standardapi 5.0.0.8 → 5.0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/standard_api/test_case/update_tests.rb +7 -7
- data/lib/standard_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 355b1eac6c6248800da339a3a9c40088d9869c4f
|
4
|
+
data.tar.gz: 4b2cf5c1701c9e186114791a815e26b6050c47f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a7d60767625e7c510f78abb320ea3b2318140aa74dfbc59cb71d8232faa70267d0a61bb02613dcc4f5e67d2ec42ee980c1e6fd06ecd65b7a204ecd383b1821a
|
7
|
+
data.tar.gz: fbab67ec986066f5b0b33644276d08b4ff9df6769fbd2aefd5a386b5b0d2832edf172ad120c985d54132747fd65ad660831f6a4d6303d28e7b20256c1d5bd9b4
|
@@ -8,7 +8,7 @@ module StandardAPI
|
|
8
8
|
attrs = attributes_for(singular_name).select{ |k,v| !model.readonly_attributes.include?(k.to_s) }
|
9
9
|
create_webmocks(attrs)
|
10
10
|
|
11
|
-
put resource_path(:update, :id => m.id
|
11
|
+
put resource_path(:update, :id => m.id), params: { singular_name => attrs }, as: :json
|
12
12
|
assert_response :ok, "Updating #{m.class.name} with #{attrs.inspect}"
|
13
13
|
|
14
14
|
view_attributes(m.reload).select { |x| attrs.keys.map(&:to_s).include?(x) }.each do |key, value|
|
@@ -26,14 +26,14 @@ module StandardAPI
|
|
26
26
|
m = create_model
|
27
27
|
|
28
28
|
# This is just to instance @controller
|
29
|
-
get resource_path(:show, id: m.id,
|
29
|
+
get resource_path(:show, id: m.id), as: :json
|
30
30
|
|
31
31
|
return if @controller.method(:update).owner != StandardAPI
|
32
32
|
|
33
33
|
attrs = attributes_for(singular_name).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
|
34
34
|
create_webmocks(attrs)
|
35
35
|
|
36
|
-
put resource_path(:update, :id => m.id
|
36
|
+
put resource_path(:update, :id => m.id), params: { singular_name => attrs }
|
37
37
|
|
38
38
|
assert_redirected_to m
|
39
39
|
end
|
@@ -43,7 +43,7 @@ module StandardAPI
|
|
43
43
|
attrs = attributes_for(singular_name, :nested).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
|
44
44
|
create_webmocks(attrs)
|
45
45
|
|
46
|
-
put resource_path(:update, :id => m.id
|
46
|
+
put resource_path(:update, :id => m.id), params: { singular_name => attrs }, as: :json
|
47
47
|
assert_response :ok, "Updating #{m.class.name} with #{attrs.inspect}"
|
48
48
|
|
49
49
|
# (m.attribute_names & attrs.keys.map(&:to_s)).each do |test_key|
|
@@ -67,7 +67,7 @@ module StandardAPI
|
|
67
67
|
attrs = attributes_for(singular_name, :invalid).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
|
68
68
|
create_webmocks(attrs)
|
69
69
|
|
70
|
-
put resource_path(:update, :id => m.id
|
70
|
+
put resource_path(:update, :id => m.id), params: { singular_name => attrs }, as: :json
|
71
71
|
assert_response :bad_request, "Updating #{m.class.name} with invalid attributes #{attrs.inspect}"
|
72
72
|
assert JSON.parse(@response.body)['errors']
|
73
73
|
end
|
@@ -78,7 +78,7 @@ module StandardAPI
|
|
78
78
|
attrs = attributes_for(singular_name, :nested).select{|k,v| !model.readonly_attributes.include?(k) }
|
79
79
|
create_webmocks(attrs)
|
80
80
|
|
81
|
-
put resource_path(:update, :id => m.id
|
81
|
+
put resource_path(:update, :id => m.id), params: { include: includes, singular_name => attrs }, as: :json
|
82
82
|
assert_response :ok, "Updating #{m.class.name} with #{attrs.inspect}"
|
83
83
|
|
84
84
|
controller_model = @controller.instance_variable_get("@#{singular_name}")
|
@@ -130,7 +130,7 @@ module StandardAPI
|
|
130
130
|
|
131
131
|
@controller.current_mask[plural_name] = { id: m.id + 1 }
|
132
132
|
assert_raises(ActiveRecord::RecordNotFound) do
|
133
|
-
put resource_path(:update, :id => m.id, :
|
133
|
+
put resource_path(:update, :id => m.id), as: :json
|
134
134
|
end
|
135
135
|
@controller.current_mask.delete(plural_name)
|
136
136
|
end
|
data/lib/standard_api/version.rb
CHANGED