standardapi 5.0.0.7 → 5.0.0.8

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: 063b813ac24cddfe25d10fc3a0feae1275f4a33c
4
- data.tar.gz: 1508403c873b4155d310a90899aaa24ee8b53adb
3
+ metadata.gz: 8abd5e5fd0edfe43cb7214d68a03ce4c891f055f
4
+ data.tar.gz: 30ff7a019df03bae07e7d3f71e1de0f9f6775938
5
5
  SHA512:
6
- metadata.gz: d957f41104edfbb811c394a0c2412b5733ea30ad17aff358180d205d1555b5c55723dabdc3785b47a13120f9fd942c9ec6026ffc064a6adfb696f3ceea4cf230
7
- data.tar.gz: ce04e41c9d05bfd6d481cd65a12a279c337d60f376d6b9d9757eef7f03571bdda5bd7a9168670bf0e7f61787ffb4ee8cf758df0c3ba6042a2be0f4434f11f862
6
+ metadata.gz: 1b69c45728b4bc4b8a4c63e43217be8f106f41e8a66c9265112a8615d5625bd871f0d0c6b795894b9503a0f25835d246cefa97a605fbba9c9b4c2dba7674ff37
7
+ data.tar.gz: 724a6de3959161f946c5d8f6d213a97dc602d85579f618e417cec449f39e763bafd9386666d443499d00b2eeefc206d8be8a306f6ee15dffee75f7bffa1e3ac1
@@ -60,7 +60,7 @@ module StandardAPI::TestCase
60
60
 
61
61
  def resource_path(action, options={})
62
62
  url_for({
63
- controller: model.model_name.plural, action: action
63
+ controller: controller_class.controller_path, action: action
64
64
  }.merge(options))
65
65
  # case action
66
66
  # when :index, :create
@@ -8,7 +8,7 @@ module StandardAPI
8
8
  create_webmocks(attrs)
9
9
 
10
10
  assert_difference("#{model.name}.count") do
11
- post resource_path(:create, singular_name => attrs, format: :json)
11
+ post resource_path(:create, format: :json), params: { singular_name => attrs }
12
12
  assert_response :created
13
13
  m = @controller.instance_variable_get("@#{singular_name}")
14
14
 
@@ -59,7 +59,7 @@ module StandardAPI
59
59
  create_webmocks(attrs)
60
60
 
61
61
  assert_difference("#{model.name}.count", 0) do
62
- post resource_path(:create, singular_name => attrs, format: :json)
62
+ post resource_path(:create, format: :json), params: { singular_name => attrs }
63
63
  assert_response :bad_request
64
64
  json = JSON.parse(response.body)
65
65
  assert json.is_a?(Hash)
@@ -82,7 +82,7 @@ module StandardAPI
82
82
  create_webmocks(attrs)
83
83
 
84
84
  assert_difference("#{model.name}.count", 0) do
85
- post resource_path(:create, singular_name => attrs, format: :html)
85
+ post resource_path(:create, format: :html), params: { singular_name => attrs }
86
86
  assert_response :bad_request
87
87
  assert_equal response.body, 'properties#edit.html'
88
88
  end
@@ -94,7 +94,7 @@ module StandardAPI
94
94
  create_webmocks(attrs)
95
95
 
96
96
  assert_difference("#{model.name}.count") do
97
- post resource_path(:create, singular_name => attrs, include: includes, format: :json)
97
+ post resource_path(:create, format: :json), params: { singular_name => attrs, include: includes }
98
98
  assert_response :created
99
99
  m = @controller.instance_variable_get("@#{singular_name}")
100
100
  assert m
@@ -124,7 +124,11 @@ module StandardAPI
124
124
 
125
125
  view_attributes(m2).each do |key, value|
126
126
  message = "Model / Attribute: #{m2.class.name}##{key}"
127
- assert_equal m_json[key.to_s], normalize_to_json(m2, key, value), message
127
+ if m_json[key.to_s].nil?
128
+ assert_nil normalize_to_json(m2, key, value), message
129
+ else
130
+ assert_equal m_json[key.to_s], normalize_to_json(m2, key, value), message
131
+ end
128
132
  end
129
133
 
130
134
  end
@@ -106,7 +106,11 @@ module StandardAPI
106
106
 
107
107
  view_attributes(m).each do |key, value|
108
108
  message = "Model / Attribute: #{m.class.name}##{key}"
109
- assert_equal m_json[key.to_s], normalize_to_json(m, key, value), message
109
+ if m_json[key.to_s].nil?
110
+ assert_nil normalize_to_json(m, key, value), message
111
+ else
112
+ assert_equal m_json[key.to_s], normalize_to_json(m, key, value), message
113
+ end
110
114
  end
111
115
 
112
116
  end
@@ -40,7 +40,11 @@ module StandardAPI
40
40
 
41
41
  view_attributes(m).each do |key, value|
42
42
  message = "Model / Attribute: #{m.class.name}##{key}"
43
- assert_equal m_json[key.to_s], normalize_to_json(m, key, value), message
43
+ if m_json[key.to_s].nil?
44
+ assert_nil normalize_to_json(m, key, value), message
45
+ else
46
+ assert_equal m_json[key.to_s], normalize_to_json(m, key, value), message
47
+ end
44
48
  end
45
49
 
46
50
  end
@@ -5,7 +5,7 @@ module StandardAPI
5
5
 
6
6
  test '#update.json' do
7
7
  m = create_model
8
- attrs = attributes_for(singular_name).select{|k,v| !model.readonly_attributes.include?(k.to_s) }
8
+ attrs = attributes_for(singular_name).select{ |k,v| !model.readonly_attributes.include?(k.to_s) }
9
9
  create_webmocks(attrs)
10
10
 
11
11
  put resource_path(:update, :id => m.id, :format => 'json'), params: { singular_name => attrs }
@@ -106,7 +106,11 @@ module StandardAPI
106
106
 
107
107
  view_attributes(m).each do |key, value|
108
108
  message = "Model / Attribute: #{m.class.name}##{key}"
109
- assert_equal m_json[key.to_s], normalize_to_json(m, key, value), message
109
+ if m_json[key.to_s].nil?
110
+ assert_nil normalize_to_json(m, key, value), message
111
+ else
112
+ assert_equal m_json[key.to_s], normalize_to_json(m, key, value), message
113
+ end
110
114
  end
111
115
 
112
116
  end
@@ -1,3 +1,3 @@
1
1
  module StandardAPI
2
- VERSION = '5.0.0.7'
2
+ VERSION = '5.0.0.8'
3
3
  end
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.7
4
+ version: 5.0.0.8
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-12-06 00:00:00.000000000 Z
11
+ date: 2016-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails