aylien_news_api 0.1.0 → 0.2.0

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -4
  3. data/README.md +8 -7
  4. data/aylien_news_api.gemspec +15 -2
  5. data/docs/CategoryLinks.md +2 -2
  6. data/docs/Coverages.md +1 -0
  7. data/docs/DefaultApi.md +315 -252
  8. data/docs/Media.md +1 -1
  9. data/docs/RelatedStories.md +1 -0
  10. data/docs/Scope.md +4 -4
  11. data/docs/Story.md +5 -5
  12. data/lib/aylien_news_api/api/default_api.rb +615 -549
  13. data/lib/aylien_news_api/api_client.rb +2 -2
  14. data/lib/aylien_news_api/configuration.rb +8 -0
  15. data/lib/aylien_news_api/models/author.rb +25 -6
  16. data/lib/aylien_news_api/models/autocomplete.rb +23 -5
  17. data/lib/aylien_news_api/models/autocompletes.rb +21 -4
  18. data/lib/aylien_news_api/models/category.rb +57 -12
  19. data/lib/aylien_news_api/models/category_links.rb +25 -7
  20. data/lib/aylien_news_api/models/coverages.rb +45 -12
  21. data/lib/aylien_news_api/models/entities.rb +23 -5
  22. data/lib/aylien_news_api/models/entity.rb +49 -8
  23. data/lib/aylien_news_api/models/entity_links.rb +21 -4
  24. data/lib/aylien_news_api/models/error.rb +31 -9
  25. data/lib/aylien_news_api/models/error_links.rb +21 -4
  26. data/lib/aylien_news_api/models/errors.rb +21 -4
  27. data/lib/aylien_news_api/models/histogram_interval.rb +23 -5
  28. data/lib/aylien_news_api/models/histograms.rb +29 -8
  29. data/lib/aylien_news_api/models/location.rb +25 -6
  30. data/lib/aylien_news_api/models/media.rb +50 -9
  31. data/lib/aylien_news_api/models/related_stories.rb +43 -11
  32. data/lib/aylien_news_api/models/scope.rb +57 -14
  33. data/lib/aylien_news_api/models/sentiment.rb +69 -8
  34. data/lib/aylien_news_api/models/sentiments.rb +23 -5
  35. data/lib/aylien_news_api/models/share_count.rb +23 -5
  36. data/lib/aylien_news_api/models/share_counts.rb +27 -7
  37. data/lib/aylien_news_api/models/source.rb +31 -9
  38. data/lib/aylien_news_api/models/stories.rb +25 -6
  39. data/lib/aylien_news_api/models/story.rb +64 -28
  40. data/lib/aylien_news_api/models/story_cluster.rb +29 -8
  41. data/lib/aylien_news_api/models/story_links.rb +25 -6
  42. data/lib/aylien_news_api/models/summary.rb +21 -4
  43. data/lib/aylien_news_api/models/time_series.rb +23 -5
  44. data/lib/aylien_news_api/models/time_series_list.rb +27 -7
  45. data/lib/aylien_news_api/models/trend.rb +23 -5
  46. data/lib/aylien_news_api/models/trends.rb +23 -5
  47. data/lib/aylien_news_api/version.rb +1 -1
  48. data/spec/api_client_spec.rb +306 -0
  49. data/spec/configuration_spec.rb +39 -0
  50. data/spec/spec_helper.rb +113 -0
  51. metadata +34 -49
  52. data/Rakefile +0 -8
  53. data/aylien_news_api-0.0.1.gem +0 -0
@@ -15,6 +15,7 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class Trends
19
20
  # An array of trends
20
21
  attr_accessor :trends
@@ -22,6 +23,7 @@ module AylienNewsApi
22
23
  # The field of trends
23
24
  attr_accessor :field
24
25
 
26
+
25
27
  # Attribute mapping from ruby-style variable name to JSON key.
26
28
  def self.attribute_map
27
29
  {
@@ -46,18 +48,33 @@ module AylienNewsApi
46
48
  # convert string to symbol for hash key
47
49
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
50
 
49
- if attributes[:'trends']
51
+ if attributes.has_key?(:'trends')
50
52
  if (value = attributes[:'trends']).is_a?(Array)
51
53
  self.trends = value
52
54
  end
53
55
  end
54
- if attributes[:'field']
56
+
57
+ if attributes.has_key?(:'field')
55
58
  self.field = attributes[:'field']
56
59
  end
60
+
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properies with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ return invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return true
57
74
  end
58
75
 
59
76
  # Checks equality by comparing each attribute.
60
- # @param [Object] Object to be compared
77
+ # @param [Object] Object to be compared
61
78
  def ==(o)
62
79
  return true if self.equal?(o)
63
80
  self.class == o.class &&
@@ -66,7 +83,7 @@ module AylienNewsApi
66
83
  end
67
84
 
68
85
  # @see the `==` method
69
- # @param [Object] Object to be compared
86
+ # @param [Object] Object to be compared
70
87
  def eql?(o)
71
88
  self == o
72
89
  end
@@ -165,7 +182,7 @@ module AylienNewsApi
165
182
 
166
183
  # Outputs non-array value in the form of hash
167
184
  # For object, use to_hash. Otherwise, just return the value
168
- # @param [Object] value Any valid value
185
+ # @param [Object] value Any valid value
169
186
  # @return [Hash] Returns the value in the form of hash
170
187
  def _to_hash(value)
171
188
  if value.is_a?(Array)
@@ -182,4 +199,5 @@ module AylienNewsApi
182
199
  end
183
200
 
184
201
  end
202
+
185
203
  end
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module AylienNewsApi
16
- VERSION = "0.1.0"
16
+ VERSION = "0.2.0"
17
17
  end
@@ -0,0 +1,306 @@
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'spec_helper'
16
+
17
+ describe AylienNewsApi::ApiClient do
18
+ context 'initialization' do
19
+ context 'URL stuff' do
20
+ context 'host' do
21
+ it 'removes http from host' do
22
+ AylienNewsApi.configure { |c| c.host = 'http://example.com' }
23
+ expect(AylienNewsApi::Configuration.default.host).to eq('example.com')
24
+ end
25
+
26
+ it 'removes https from host' do
27
+ AylienNewsApi.configure { |c| c.host = 'https://wookiee.com' }
28
+ expect(AylienNewsApi::ApiClient.default.config.host).to eq('wookiee.com')
29
+ end
30
+
31
+ it 'removes trailing path from host' do
32
+ AylienNewsApi.configure { |c| c.host = 'hobo.com/v4' }
33
+ expect(AylienNewsApi::Configuration.default.host).to eq('hobo.com')
34
+ end
35
+ end
36
+
37
+ context 'base_path' do
38
+ it "prepends a slash to base_path" do
39
+ AylienNewsApi.configure { |c| c.base_path = 'v4/dog' }
40
+ expect(AylienNewsApi::Configuration.default.base_path).to eq('/v4/dog')
41
+ end
42
+
43
+ it "doesn't prepend a slash if one is already there" do
44
+ AylienNewsApi.configure { |c| c.base_path = '/v4/dog' }
45
+ expect(AylienNewsApi::Configuration.default.base_path).to eq('/v4/dog')
46
+ end
47
+
48
+ it "ends up as a blank string if nil" do
49
+ AylienNewsApi.configure { |c| c.base_path = nil }
50
+ expect(AylienNewsApi::Configuration.default.base_path).to eq('')
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ describe "#update_params_for_auth!" do
57
+ it "sets header api-key parameter with prefix" do
58
+ AylienNewsApi.configure do |c|
59
+ c.api_key_prefix['X-AYLIEN-NewsAPI-Application-ID'] = 'PREFIX'
60
+ c.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'special-key'
61
+ end
62
+
63
+ api_client = AylienNewsApi::ApiClient.new
64
+
65
+ config2 = AylienNewsApi::Configuration.new do |c|
66
+ c.api_key_prefix['X-AYLIEN-NewsAPI-Application-ID'] = 'PREFIX2'
67
+ c.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'special-key2'
68
+ end
69
+ api_client2 = AylienNewsApi::ApiClient.new(config2)
70
+
71
+ auth_names = ['app_id']
72
+
73
+ header_params = {}
74
+ query_params = {}
75
+ api_client.update_params_for_auth! header_params, query_params, auth_names
76
+ expect(header_params).to eq({'X-AYLIEN-NewsAPI-Application-ID' => 'PREFIX special-key'})
77
+ expect(query_params).to eq({})
78
+
79
+ header_params = {}
80
+ query_params = {}
81
+ api_client2.update_params_for_auth! header_params, query_params, auth_names
82
+ expect(header_params).to eq({'X-AYLIEN-NewsAPI-Application-ID' => 'PREFIX2 special-key2'})
83
+ expect(query_params).to eq({})
84
+ end
85
+
86
+ it "sets header api-key parameter without prefix" do
87
+ AylienNewsApi.configure do |c|
88
+ c.api_key_prefix['X-AYLIEN-NewsAPI-Application-ID'] = nil
89
+ c.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'special-key'
90
+ end
91
+
92
+ api_client = AylienNewsApi::ApiClient.new
93
+
94
+ header_params = {}
95
+ query_params = {}
96
+ auth_names = ['app_id']
97
+ api_client.update_params_for_auth! header_params, query_params, auth_names
98
+ expect(header_params).to eq({'X-AYLIEN-NewsAPI-Application-ID' => 'special-key'})
99
+ expect(query_params).to eq({})
100
+ end
101
+ end
102
+
103
+ describe "params_encoding in #build_request" do
104
+ let(:config) { AylienNewsApi::Configuration.new }
105
+ let(:api_client) { AylienNewsApi::ApiClient.new(config) }
106
+
107
+ it "defaults to multi" do
108
+ expect(AylienNewsApi::Configuration.default.params_encoding).to eq(:multi)
109
+ expect(config.params_encoding).to eq(:multi)
110
+
111
+ request = api_client.build_request(:get, '/test')
112
+ expect(request.options[:params_encoding]).to eq(:multi)
113
+ end
114
+
115
+ it "can be customized" do
116
+ config.params_encoding = nil
117
+ request = api_client.build_request(:get, '/test')
118
+ expect(request.options[:params_encoding]).to eq(nil)
119
+ end
120
+ end
121
+
122
+ describe "timeout in #build_request" do
123
+ let(:config) { AylienNewsApi::Configuration.new }
124
+ let(:api_client) { AylienNewsApi::ApiClient.new(config) }
125
+
126
+ it "defaults to 0" do
127
+ expect(AylienNewsApi::Configuration.default.timeout).to eq(0)
128
+ expect(config.timeout).to eq(0)
129
+
130
+ request = api_client.build_request(:get, '/test')
131
+ expect(request.options[:timeout]).to eq(0)
132
+ end
133
+
134
+ it "can be customized" do
135
+ config.timeout = 100
136
+ request = api_client.build_request(:get, '/test')
137
+ expect(request.options[:timeout]).to eq(100)
138
+ end
139
+ end
140
+
141
+ describe "#deserialize" do
142
+ it "handles Array<Integer>" do
143
+ api_client = AylienNewsApi::ApiClient.new
144
+ headers = {'Content-Type' => 'application/json'}
145
+ response = double('response', headers: headers, body: '[12, 34]')
146
+ data = api_client.deserialize(response, 'Array<Integer>')
147
+ expect(data).to be_instance_of(Array)
148
+ expect(data).to eq([12, 34])
149
+ end
150
+
151
+ it "handles Array<Array<Integer>>" do
152
+ api_client = AylienNewsApi::ApiClient.new
153
+ headers = {'Content-Type' => 'application/json'}
154
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
155
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
156
+ expect(data).to be_instance_of(Array)
157
+ expect(data).to eq([[12, 34], [56]])
158
+ end
159
+
160
+ it "handles Hash<String, String>" do
161
+ api_client = AylienNewsApi::ApiClient.new
162
+ headers = {'Content-Type' => 'application/json'}
163
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
164
+ data = api_client.deserialize(response, 'Hash<String, String>')
165
+ expect(data).to be_instance_of(Hash)
166
+ expect(data).to eq({:message => 'Hello'})
167
+ end
168
+
169
+ it "handles Hash<String, Story>" do
170
+ api_client = AylienNewsApi::ApiClient.new
171
+ headers = {'Content-Type' => 'application/json'}
172
+ response = double('response', headers: headers, body: '{"story": {"id": 1}}')
173
+ data = api_client.deserialize(response, 'Hash<String, Story>')
174
+ expect(data).to be_instance_of(Hash)
175
+ expect(data.keys).to eq([:story])
176
+
177
+ story = data[:story]
178
+ expect(story).to be_instance_of(AylienNewsApi::Story)
179
+ expect(story.id).to eq(1)
180
+ end
181
+
182
+ it "handles Hash<String, Hash<String, Story>>" do
183
+ api_client = AylienNewsApi::ApiClient.new
184
+ headers = {'Content-Type' => 'application/json'}
185
+ response = double('response', headers: headers, body: '{"data": {"story": {"id": 1}}}')
186
+ result = api_client.deserialize(response, 'Hash<String, Hash<String, Story>>')
187
+ expect(result).to be_instance_of(Hash)
188
+ expect(result.keys).to match_array([:data])
189
+
190
+ data = result[:data]
191
+ expect(data).to be_instance_of(Hash)
192
+ expect(data.keys).to match_array([:story])
193
+
194
+ story = data[:story]
195
+ expect(story).to be_instance_of(AylienNewsApi::Story)
196
+ expect(story.id).to eq(1)
197
+ end
198
+ end
199
+
200
+ describe "#object_to_hash" do
201
+ it "ignores nils and includes empty arrays" do
202
+ api_client = AylienNewsApi::ApiClient.new
203
+ story = AylienNewsApi::Story.new
204
+ story.id = 1
205
+ story.title = ''
206
+ story.published_at = nil
207
+ story.body = nil
208
+ story.hashtags = []
209
+ expected = {id: 1, title: '', hashtags: []}
210
+ expect(api_client.object_to_hash(story)).to eq(expected)
211
+ end
212
+ end
213
+
214
+ describe "#build_collection_param" do
215
+ let(:param) { ['aa', 'bb', 'cc'] }
216
+ let(:api_client) { AylienNewsApi::ApiClient.new }
217
+
218
+ it "works for csv" do
219
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
220
+ end
221
+
222
+ it "works for ssv" do
223
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
224
+ end
225
+
226
+ it "works for tsv" do
227
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
228
+ end
229
+
230
+ it "works for pipes" do
231
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
232
+ end
233
+
234
+ it "works for multi" do
235
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
236
+ end
237
+
238
+ it "fails for invalid collection format" do
239
+ expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
240
+ end
241
+ end
242
+
243
+ describe "#json_mime?" do
244
+ let(:api_client) { AylienNewsApi::ApiClient.new }
245
+
246
+ it "works" do
247
+ expect(api_client.json_mime?(nil)).to eq false
248
+ expect(api_client.json_mime?('')).to eq false
249
+
250
+ expect(api_client.json_mime?('application/json')).to eq true
251
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
252
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
253
+
254
+ expect(api_client.json_mime?('application/xml')).to eq false
255
+ expect(api_client.json_mime?('text/plain')).to eq false
256
+ expect(api_client.json_mime?('application/jsonp')).to eq false
257
+ end
258
+ end
259
+
260
+ describe "#select_header_accept" do
261
+ let(:api_client) { AylienNewsApi::ApiClient.new }
262
+
263
+ it "works" do
264
+ expect(api_client.select_header_accept(nil)).to be_nil
265
+ expect(api_client.select_header_accept([])).to be_nil
266
+
267
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
268
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
269
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
270
+
271
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
272
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
273
+ end
274
+ end
275
+
276
+ describe "#select_header_content_type" do
277
+ let(:api_client) { AylienNewsApi::ApiClient.new }
278
+
279
+ it "works" do
280
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
281
+ expect(api_client.select_header_content_type([])).to eq('application/json')
282
+
283
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
284
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
285
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
286
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
287
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
288
+ end
289
+ end
290
+
291
+ describe "#sanitize_filename" do
292
+ let(:api_client) { AylienNewsApi::ApiClient.new }
293
+
294
+ it "works" do
295
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
296
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
297
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
298
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
299
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
300
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
301
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
302
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
303
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
304
+ end
305
+ end
306
+ end
@@ -0,0 +1,39 @@
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'spec_helper'
16
+
17
+ describe AylienNewsApi::Configuration do
18
+ let(:config) { AylienNewsApi::Configuration.default }
19
+
20
+ before(:each) do
21
+ AylienNewsApi.configure do |c|
22
+ c.host = 'api.newsapi.aylien.com'
23
+ c.base_path = 'v1'
24
+ end
25
+ end
26
+
27
+ describe '#base_url' do
28
+ it 'should have the default value' do
29
+ expect(config.base_url).to eq('https://api.newsapi.aylien.com/v1')
30
+ end
31
+
32
+ it 'should remove trailing slashes' do
33
+ [nil, '', '/', '//'].each do |base_path|
34
+ config.base_path = base_path
35
+ expect(config.base_url).to eq('https://api.newsapi.aylien.com')
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,113 @@
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # load the gem
16
+ require 'aylien_news_api'
17
+
18
+ # The following was generated by the `rspec --init` command. Conventionally, all
19
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
20
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
21
+ # this file to always be loaded, without a need to explicitly require it in any
22
+ # files.
23
+ #
24
+ # Given that it is always loaded, you are encouraged to keep this file as
25
+ # light-weight as possible. Requiring heavyweight dependencies from this file
26
+ # will add to the boot time of your test suite on EVERY test run, even for an
27
+ # individual file that may not need all of that loaded. Instead, consider making
28
+ # a separate helper file that requires the additional dependencies and performs
29
+ # the additional setup, and require it from the spec files that actually need
30
+ # it.
31
+ #
32
+ # The `.rspec` file also contains a few flags that are not defaults but that
33
+ # users commonly want.
34
+ #
35
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
36
+ RSpec.configure do |config|
37
+ # rspec-expectations config goes here. You can use an alternate
38
+ # assertion/expectation library such as wrong or the stdlib/minitest
39
+ # assertions if you prefer.
40
+ config.expect_with :rspec do |expectations|
41
+ # This option will default to `true` in RSpec 4. It makes the `description`
42
+ # and `failure_message` of custom matchers include text for helper methods
43
+ # defined using `chain`, e.g.:
44
+ # be_bigger_than(2).and_smaller_than(4).description
45
+ # # => "be bigger than 2 and smaller than 4"
46
+ # ...rather than:
47
+ # # => "be bigger than 2"
48
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
49
+ end
50
+
51
+ # rspec-mocks config goes here. You can use an alternate test double
52
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
53
+ config.mock_with :rspec do |mocks|
54
+ # Prevents you from mocking or stubbing a method that does not exist on
55
+ # a real object. This is generally recommended, and will default to
56
+ # `true` in RSpec 4.
57
+ mocks.verify_partial_doubles = true
58
+ end
59
+
60
+ # The settings below are suggested to provide a good initial experience
61
+ # with RSpec, but feel free to customize to your heart's content.
62
+ =begin
63
+ # These two settings work together to allow you to limit a spec run
64
+ # to individual examples or groups you care about by tagging them with
65
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
66
+ # get run.
67
+ config.filter_run :focus
68
+ config.run_all_when_everything_filtered = true
69
+
70
+ # Allows RSpec to persist some state between runs in order to support
71
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
72
+ # you configure your source control system to ignore this file.
73
+ config.example_status_persistence_file_path = "spec/examples.txt"
74
+
75
+ # Limits the available syntax to the non-monkey patched syntax that is
76
+ # recommended. For more details, see:
77
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
78
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
79
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
80
+ config.disable_monkey_patching!
81
+
82
+ # This setting enables warnings. It's recommended, but in some cases may
83
+ # be too noisy due to issues in dependencies.
84
+ config.warnings = true
85
+
86
+ # Many RSpec users commonly either run the entire suite or an individual
87
+ # file, and it's useful to allow more verbose output when running an
88
+ # individual spec file.
89
+ if config.files_to_run.one?
90
+ # Use the documentation formatter for detailed output,
91
+ # unless a formatter has already been configured
92
+ # (e.g. via a command-line flag).
93
+ config.default_formatter = 'doc'
94
+ end
95
+
96
+ # Print the 10 slowest examples and example groups at the
97
+ # end of the spec run, to help surface which specs are running
98
+ # particularly slow.
99
+ config.profile_examples = 10
100
+
101
+ # Run specs in random order to surface order dependencies. If you find an
102
+ # order dependency and want to debug it, you can fix the order by providing
103
+ # the seed, which is printed after each run.
104
+ # --seed 1234
105
+ config.order = :random
106
+
107
+ # Seed global randomization in this process using the `--seed` CLI option.
108
+ # Setting this allows you to use `--seed` to deterministically reproduce
109
+ # test failures related to randomization by passing the same `--seed` value
110
+ # as the one that triggered the failure.
111
+ Kernel.srand config.seed
112
+ =end
113
+ end