standardapi 5.0.0.9 → 5.0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11bb8361f273e8435fece56039550dd3b81e0354
|
4
|
+
data.tar.gz: bc79398e3dff4a6bee4f06b2aa2a778c725e4eed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10d26d53f1f7e04bd783b54c50e9479420bc91eefba5695418f085da96b10edc14396a11f9062f44eea56c6d284fee90d633e373d504683c399de1c479f753b5
|
7
|
+
data.tar.gz: e3ef82a580eb62192b229e997ab0af4f35a133ec6f78e558c49658edc77f33f144cf0576479664885d7e083d9f4b8c6217fd2ebc0c09b875803d02a0798bf798
|
@@ -7,8 +7,14 @@ module StandardAPI
|
|
7
7
|
attrs = attributes_for(singular_name, :nested).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
|
8
8
|
create_webmocks(attrs)
|
9
9
|
|
10
|
+
file_upload = attrs.any? { |k, v| v.is_a?(Rack::Test::UploadedFile) }
|
11
|
+
as = file_upload ? nil : :json
|
12
|
+
|
10
13
|
assert_difference("#{model.name}.count") do
|
11
|
-
post resource_path(:create
|
14
|
+
post resource_path(:create), params: { singular_name => attrs }, as: as
|
15
|
+
|
16
|
+
break if as != :json
|
17
|
+
|
12
18
|
assert_response :created
|
13
19
|
m = @controller.instance_variable_get("@#{singular_name}")
|
14
20
|
|
@@ -30,8 +36,14 @@ module StandardAPI
|
|
30
36
|
attrs = attributes_for(singular_name, :nested).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
|
31
37
|
create_webmocks(attrs)
|
32
38
|
|
39
|
+
file_upload = attrs.any? { |k, v| v.is_a?(Rack::Test::UploadedFile) }
|
40
|
+
as = file_upload ? nil : :json
|
41
|
+
|
33
42
|
assert_difference("#{model.name}.count") do
|
34
|
-
post resource_path(:create
|
43
|
+
post resource_path(:create), params: {singular_name => attrs}, as: as
|
44
|
+
|
45
|
+
break if as != :json
|
46
|
+
|
35
47
|
assert_response :created
|
36
48
|
m = @controller.instance_variable_get("@#{singular_name}")
|
37
49
|
assert m
|
@@ -58,8 +70,11 @@ module StandardAPI
|
|
58
70
|
attrs = attributes_for(singular_name, :invalid).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
|
59
71
|
create_webmocks(attrs)
|
60
72
|
|
73
|
+
file_upload = attrs.any? { |k, v| v.is_a?(Rack::Test::UploadedFile) }
|
74
|
+
as = file_upload ? nil : :json
|
75
|
+
|
61
76
|
assert_difference("#{model.name}.count", 0) do
|
62
|
-
post resource_path(:create
|
77
|
+
post resource_path(:create), params: { singular_name => attrs }, as: as
|
63
78
|
assert_response :bad_request
|
64
79
|
json = JSON.parse(response.body)
|
65
80
|
assert json.is_a?(Hash)
|
@@ -82,7 +97,7 @@ module StandardAPI
|
|
82
97
|
create_webmocks(attrs)
|
83
98
|
|
84
99
|
assert_difference("#{model.name}.count", 0) do
|
85
|
-
post resource_path(:create
|
100
|
+
post resource_path(:create), params: { singular_name => attrs }, as: :html
|
86
101
|
assert_response :bad_request
|
87
102
|
assert_equal response.body, 'properties#edit.html'
|
88
103
|
end
|
@@ -93,8 +108,14 @@ module StandardAPI
|
|
93
108
|
attrs = attributes_for(singular_name, :nested).select{ |k,v| !model.readonly_attributes.include?(k.to_s) }
|
94
109
|
create_webmocks(attrs)
|
95
110
|
|
111
|
+
file_upload = attrs.any? { |k, v| v.is_a?(Rack::Test::UploadedFile) }
|
112
|
+
as = file_upload ? nil : :json
|
113
|
+
|
96
114
|
assert_difference("#{model.name}.count") do
|
97
|
-
post resource_path(:create
|
115
|
+
post resource_path(:create), params: { singular_name => attrs, include: includes }, as: as
|
116
|
+
|
117
|
+
break if as != :json
|
118
|
+
|
98
119
|
assert_response :created
|
99
120
|
m = @controller.instance_variable_get("@#{singular_name}")
|
100
121
|
assert m
|
@@ -5,10 +5,15 @@ module StandardAPI
|
|
5
5
|
|
6
6
|
test '#update.json' do
|
7
7
|
m = create_model
|
8
|
+
|
8
9
|
attrs = attributes_for(singular_name).select{ |k,v| !model.readonly_attributes.include?(k.to_s) }
|
9
10
|
create_webmocks(attrs)
|
10
11
|
|
11
|
-
|
12
|
+
file_upload = attrs.any? { |k, v| v.is_a?(Rack::Test::UploadedFile) }
|
13
|
+
as = file_upload ? nil : :json
|
14
|
+
format = as ? nil : :json
|
15
|
+
|
16
|
+
put resource_path(:update, :id => m.id, format: format), params: { singular_name => attrs }, as: as
|
12
17
|
assert_response :ok, "Updating #{m.class.name} with #{attrs.inspect}"
|
13
18
|
|
14
19
|
view_attributes(m.reload).select { |x| attrs.keys.map(&:to_s).include?(x) }.each do |key, value|
|
@@ -43,7 +48,11 @@ module StandardAPI
|
|
43
48
|
attrs = attributes_for(singular_name, :nested).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
|
44
49
|
create_webmocks(attrs)
|
45
50
|
|
46
|
-
|
51
|
+
file_upload = attrs.any? { |k, v| v.is_a?(Rack::Test::UploadedFile) }
|
52
|
+
as = file_upload ? nil : :json
|
53
|
+
format = as ? nil : :json
|
54
|
+
|
55
|
+
put resource_path(:update, id: m.id, format: format), params: { singular_name => attrs }, as: as
|
47
56
|
assert_response :ok, "Updating #{m.class.name} with #{attrs.inspect}"
|
48
57
|
|
49
58
|
# (m.attribute_names & attrs.keys.map(&:to_s)).each do |test_key|
|
@@ -78,7 +87,11 @@ module StandardAPI
|
|
78
87
|
attrs = attributes_for(singular_name, :nested).select{|k,v| !model.readonly_attributes.include?(k) }
|
79
88
|
create_webmocks(attrs)
|
80
89
|
|
81
|
-
|
90
|
+
file_upload = attrs.any? { |k, v| v.is_a?(Rack::Test::UploadedFile) }
|
91
|
+
as = file_upload ? nil : :json
|
92
|
+
format = as ? nil : :json
|
93
|
+
|
94
|
+
put resource_path(:update, :id => m.id, format: format), params: { include: includes, singular_name => attrs }, as: as
|
82
95
|
assert_response :ok, "Updating #{m.class.name} with #{attrs.inspect}"
|
83
96
|
|
84
97
|
controller_model = @controller.instance_variable_get("@#{singular_name}")
|
data/lib/standard_api/version.rb
CHANGED