standardapi 5.0.0.1 → 5.0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6fb19acee2f7719925f317f6216eb76470595a9b
4
- data.tar.gz: 4cfcfe38537d730c751acf798b92d41e6cd0836e
3
+ metadata.gz: 31258d1d98bb1dae4beda05ea71721d674fc68c8
4
+ data.tar.gz: 7f74ae15f6e3c8eafc465f8e9cf3bbb3798757c3
5
5
  SHA512:
6
- metadata.gz: 9234d5aa1d3ffa61c938490d4d28a21761768218984361ec9f4484956f8fb97485ffce618c36f513bb9bf35e3814ac1cee92691c0ceef730fd80debd8d15a212
7
- data.tar.gz: 1defc2e8a650b15039b99696a7d9122c949456ab922067318c76626121014eeeec69931da7b4c146a224a9102431060b73104fbd98dbccc522dd77d209c248cf
6
+ metadata.gz: b2d47cccc926d26c23fce93e5ffcd3ef191690a6fe9c051e83239469ce9534b8a38fa605b4edb2ccd8a8684768c41dcf6ded2197076ce6eaed7053ce73fbf879
7
+ data.tar.gz: 3f54bef16897631aaaaa206ecdefb9c0435146ce21edf7aecb0b46c319906c2c13b2356bb885e81443e7cf53a674330eac2d1d953516e7e315f7d0bd86c2710b
@@ -55,7 +55,11 @@ module StandardAPI
55
55
  render :show, status: :created
56
56
  end
57
57
  else
58
- render :show, status: :bad_request
58
+ if request.format == :html
59
+ render :edit, status: :bad_request
60
+ else
61
+ render :show, status: :bad_request
62
+ end
59
63
  end
60
64
  end
61
65
 
@@ -71,6 +71,25 @@ module StandardAPI
71
71
  assert json['errors']
72
72
  end
73
73
  end
74
+
75
+ test '#create.html with invalid attributes renders edit action' do
76
+ trait = FactoryGirl.factories[singular_name].definition.defined_traits.any? { |x| x.name.to_s == 'invalid' }
77
+
78
+ if !trait
79
+ Rails.logger.try(:warn, "No invalid trait for #{model.name}. Skipping invalid tests")
80
+ warn("No invalid trait for #{model.name}. Skipping invalid tests")
81
+ return
82
+ end
83
+
84
+ attrs = attributes_for(singular_name, :invalid).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
85
+ create_webmocks(attrs)
86
+
87
+ assert_difference("#{model.name}.count", 0) do
88
+ post :create, params: {singular_name => attrs}, format: :html
89
+ assert_response :bad_request
90
+ assert_equal response.body, 'properties#edit.html'
91
+ end
92
+ end
74
93
 
75
94
  test '#create.json params[:include]' do
76
95
  travel_to Time.now do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standardapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.1
4
+ version: 5.0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails