consadole_aggregator 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,16 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'consadole_aggregator'
5
-
6
- # Requires supporting files with custom matchers and macros, etc,
7
- # in ./support/ and its subdirectories.
8
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
-
1
+ require "consadole_aggregator"
2
+ # This file was generated by the `rspec --init` command. Conventionally, all
3
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
4
+ # Require this file using `require "spec_helper.rb"` to ensure that it is only
5
+ # loaded once.
6
+ #
7
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
10
8
  RSpec.configure do |config|
9
+ config.treat_symbols_as_metadata_keys_with_true_values = true
10
+ config.run_all_when_everything_filtered = true
11
+ config.filter_run :focus
12
+ end
11
13
 
14
+ def ext_path file
15
+ File.join(File.expand_path(File.dirname(__FILE__)), 'ext', file)
12
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consadole_aggregator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,45 +9,59 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-24 00:00:00.000000000 +09:00
13
- default_executable: consadole_aggregator
12
+ date: 2012-04-29 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
- name: nokogiri
17
- requirement: &2162193580 !ruby/object:Gem::Requirement
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
21
20
  - !ruby/object:Gem::Version
22
21
  version: '0'
23
- type: :runtime
22
+ type: :development
24
23
  prerelease: false
25
- version_requirements: *2162193580
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
26
30
  - !ruby/object:Gem::Dependency
27
- name: oauth
28
- requirement: &2162192700 !ruby/object:Gem::Requirement
31
+ name: guard
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
- type: :runtime
38
+ type: :development
35
39
  prerelease: false
36
- version_requirements: *2162192700
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
37
46
  - !ruby/object:Gem::Dependency
38
- name: rubytter
39
- requirement: &2162191980 !ruby/object:Gem::Requirement
47
+ name: guard-rspec
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
50
  requirements:
42
51
  - - ! '>='
43
52
  - !ruby/object:Gem::Version
44
53
  version: '0'
45
- type: :runtime
54
+ type: :development
46
55
  prerelease: false
47
- version_requirements: *2162191980
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
48
62
  - !ruby/object:Gem::Dependency
49
- name: bundler
50
- requirement: &2162191340 !ruby/object:Gem::Requirement
63
+ name: ruby_gntp
64
+ requirement: !ruby/object:Gem::Requirement
51
65
  none: false
52
66
  requirements:
53
67
  - - ! '>='
@@ -55,73 +69,103 @@ dependencies:
55
69
  version: '0'
56
70
  type: :development
57
71
  prerelease: false
58
- version_requirements: *2162191340
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
59
78
  - !ruby/object:Gem::Dependency
60
- name: rcov
61
- requirement: &2162190520 !ruby/object:Gem::Requirement
79
+ name: nokogiri
80
+ requirement: !ruby/object:Gem::Requirement
62
81
  none: false
63
82
  requirements:
64
83
  - - ! '>='
65
84
  - !ruby/object:Gem::Version
66
85
  version: '0'
67
- type: :development
86
+ type: :runtime
68
87
  prerelease: false
69
- version_requirements: *2162190520
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
70
94
  - !ruby/object:Gem::Dependency
71
- name: rspec
72
- requirement: &2162189760 !ruby/object:Gem::Requirement
95
+ name: eventmachine
96
+ requirement: !ruby/object:Gem::Requirement
73
97
  none: false
74
98
  requirements:
75
99
  - - ! '>='
76
100
  - !ruby/object:Gem::Version
77
101
  version: '0'
78
- type: :development
102
+ type: :runtime
79
103
  prerelease: false
80
- version_requirements: *2162189760
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
81
110
  - !ruby/object:Gem::Dependency
82
- name: jeweler
83
- requirement: &2162189100 !ruby/object:Gem::Requirement
111
+ name: twitter
112
+ requirement: !ruby/object:Gem::Requirement
84
113
  none: false
85
114
  requirements:
86
115
  - - ! '>='
87
116
  - !ruby/object:Gem::Version
88
117
  version: '0'
89
- type: :development
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: httpclient
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :runtime
90
135
  prerelease: false
91
- version_requirements: *2162189100
92
- description: ! ' It aggregates infomation of ''Consadole Sapporo'' '
93
- email: niku@niku.name
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ description:
143
+ email:
144
+ - niku@niku.name
94
145
  executables:
95
146
  - consadole_aggregator
96
147
  extensions: []
97
- extra_rdoc_files:
98
- - LICENSE.txt
99
- - README.rdoc
148
+ extra_rdoc_files: []
100
149
  files:
101
- - .document
150
+ - .gitignore
102
151
  - .rspec
152
+ - .rvmrc
153
+ - .travis.yml
103
154
  - Gemfile
104
155
  - Gemfile.lock
105
- - LICENSE.txt
106
- - README.rdoc
156
+ - Guardfile
107
157
  - Rakefile
108
- - VERSION
109
- - account.yaml
110
158
  - bin/consadole_aggregator
111
159
  - consadole_aggregator.gemspec
112
- - db/.gitignore
113
160
  - lib/consadole_aggregator.rb
114
- - lib/consadole_aggregator/aggregatable.rb
115
161
  - lib/consadole_aggregator/helper.rb
116
162
  - lib/consadole_aggregator/live.rb
117
- - lib/consadole_aggregator/live/timeline.rb
118
163
  - lib/consadole_aggregator/news.rb
119
- - log/.gitignore
120
- - spec/consadole_aggregator/aggregatable_spec.rb
164
+ - lib/consadole_aggregator/version.rb
121
165
  - spec/consadole_aggregator/helper_spec.rb
122
- - spec/consadole_aggregator/live/timeline_spec.rb
123
166
  - spec/consadole_aggregator/live_spec.rb
124
167
  - spec/consadole_aggregator/news_spec.rb
168
+ - spec/consadole_aggregator_spec.rb
125
169
  - spec/ext/asahi.txt
126
170
  - spec/ext/clubconsadole.txt
127
171
  - spec/ext/consaburn.txt
@@ -254,12 +298,9 @@ files:
254
298
  - spec/ext/live/s674.html.98
255
299
  - spec/ext/live/s674.html.99
256
300
  - spec/ext/nikkansports.txt
257
- - spec/spec.opts
258
301
  - spec/spec_helper.rb
259
- has_rdoc: true
260
- homepage: http://github.com/niku/consadole_aggregator
261
- licenses:
262
- - MIT
302
+ homepage: https://github.com/niku/consadole_aggregator
303
+ licenses: []
263
304
  post_install_message:
264
305
  rdoc_options: []
265
306
  require_paths:
@@ -270,9 +311,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
311
  - - ! '>='
271
312
  - !ruby/object:Gem::Version
272
313
  version: '0'
273
- segments:
274
- - 0
275
- hash: -1076847756677944312
276
314
  required_rubygems_version: !ruby/object:Gem::Requirement
277
315
  none: false
278
316
  requirements:
@@ -280,9 +318,146 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
318
  - !ruby/object:Gem::Version
281
319
  version: '0'
282
320
  requirements: []
283
- rubyforge_project:
284
- rubygems_version: 1.6.2
321
+ rubyforge_project: consadole_aggregator
322
+ rubygems_version: 1.8.23
285
323
  signing_key:
286
324
  specification_version: 3
287
- summary: It aggregates infomation of 'Consadole Sapporo'
288
- test_files: []
325
+ summary: aggregates infomation of 'Consadole Sapporo'
326
+ test_files:
327
+ - spec/consadole_aggregator/helper_spec.rb
328
+ - spec/consadole_aggregator/live_spec.rb
329
+ - spec/consadole_aggregator/news_spec.rb
330
+ - spec/consadole_aggregator_spec.rb
331
+ - spec/ext/asahi.txt
332
+ - spec/ext/clubconsadole.txt
333
+ - spec/ext/consaburn.txt
334
+ - spec/ext/consaclub.txt
335
+ - spec/ext/consadolenews.txt
336
+ - spec/ext/consadolephotos.txt
337
+ - spec/ext/forzaconsadole.txt
338
+ - spec/ext/hochiyomiuri.txt
339
+ - spec/ext/jsgoalnews.txt
340
+ - spec/ext/jsgoalphotos.txt
341
+ - spec/ext/live/s674.html
342
+ - spec/ext/live/s674.html.1
343
+ - spec/ext/live/s674.html.10
344
+ - spec/ext/live/s674.html.100
345
+ - spec/ext/live/s674.html.101
346
+ - spec/ext/live/s674.html.102
347
+ - spec/ext/live/s674.html.103
348
+ - spec/ext/live/s674.html.104
349
+ - spec/ext/live/s674.html.105
350
+ - spec/ext/live/s674.html.106
351
+ - spec/ext/live/s674.html.107
352
+ - spec/ext/live/s674.html.108
353
+ - spec/ext/live/s674.html.109
354
+ - spec/ext/live/s674.html.11
355
+ - spec/ext/live/s674.html.110
356
+ - spec/ext/live/s674.html.111
357
+ - spec/ext/live/s674.html.112
358
+ - spec/ext/live/s674.html.113
359
+ - spec/ext/live/s674.html.114
360
+ - spec/ext/live/s674.html.115
361
+ - spec/ext/live/s674.html.116
362
+ - spec/ext/live/s674.html.117
363
+ - spec/ext/live/s674.html.118
364
+ - spec/ext/live/s674.html.119
365
+ - spec/ext/live/s674.html.12
366
+ - spec/ext/live/s674.html.120
367
+ - spec/ext/live/s674.html.13
368
+ - spec/ext/live/s674.html.14
369
+ - spec/ext/live/s674.html.15
370
+ - spec/ext/live/s674.html.16
371
+ - spec/ext/live/s674.html.17
372
+ - spec/ext/live/s674.html.18
373
+ - spec/ext/live/s674.html.19
374
+ - spec/ext/live/s674.html.2
375
+ - spec/ext/live/s674.html.20
376
+ - spec/ext/live/s674.html.21
377
+ - spec/ext/live/s674.html.22
378
+ - spec/ext/live/s674.html.23
379
+ - spec/ext/live/s674.html.24
380
+ - spec/ext/live/s674.html.25
381
+ - spec/ext/live/s674.html.26
382
+ - spec/ext/live/s674.html.27
383
+ - spec/ext/live/s674.html.28
384
+ - spec/ext/live/s674.html.29
385
+ - spec/ext/live/s674.html.3
386
+ - spec/ext/live/s674.html.30
387
+ - spec/ext/live/s674.html.31
388
+ - spec/ext/live/s674.html.32
389
+ - spec/ext/live/s674.html.33
390
+ - spec/ext/live/s674.html.34
391
+ - spec/ext/live/s674.html.35
392
+ - spec/ext/live/s674.html.36
393
+ - spec/ext/live/s674.html.37
394
+ - spec/ext/live/s674.html.38
395
+ - spec/ext/live/s674.html.39
396
+ - spec/ext/live/s674.html.4
397
+ - spec/ext/live/s674.html.40
398
+ - spec/ext/live/s674.html.41
399
+ - spec/ext/live/s674.html.42
400
+ - spec/ext/live/s674.html.43
401
+ - spec/ext/live/s674.html.44
402
+ - spec/ext/live/s674.html.45
403
+ - spec/ext/live/s674.html.46
404
+ - spec/ext/live/s674.html.47
405
+ - spec/ext/live/s674.html.48
406
+ - spec/ext/live/s674.html.49
407
+ - spec/ext/live/s674.html.5
408
+ - spec/ext/live/s674.html.50
409
+ - spec/ext/live/s674.html.51
410
+ - spec/ext/live/s674.html.52
411
+ - spec/ext/live/s674.html.53
412
+ - spec/ext/live/s674.html.54
413
+ - spec/ext/live/s674.html.55
414
+ - spec/ext/live/s674.html.56
415
+ - spec/ext/live/s674.html.57
416
+ - spec/ext/live/s674.html.58
417
+ - spec/ext/live/s674.html.59
418
+ - spec/ext/live/s674.html.6
419
+ - spec/ext/live/s674.html.60
420
+ - spec/ext/live/s674.html.61
421
+ - spec/ext/live/s674.html.62
422
+ - spec/ext/live/s674.html.63
423
+ - spec/ext/live/s674.html.64
424
+ - spec/ext/live/s674.html.65
425
+ - spec/ext/live/s674.html.66
426
+ - spec/ext/live/s674.html.67
427
+ - spec/ext/live/s674.html.68
428
+ - spec/ext/live/s674.html.69
429
+ - spec/ext/live/s674.html.7
430
+ - spec/ext/live/s674.html.70
431
+ - spec/ext/live/s674.html.71
432
+ - spec/ext/live/s674.html.72
433
+ - spec/ext/live/s674.html.73
434
+ - spec/ext/live/s674.html.74
435
+ - spec/ext/live/s674.html.75
436
+ - spec/ext/live/s674.html.76
437
+ - spec/ext/live/s674.html.77
438
+ - spec/ext/live/s674.html.78
439
+ - spec/ext/live/s674.html.79
440
+ - spec/ext/live/s674.html.8
441
+ - spec/ext/live/s674.html.80
442
+ - spec/ext/live/s674.html.81
443
+ - spec/ext/live/s674.html.82
444
+ - spec/ext/live/s674.html.83
445
+ - spec/ext/live/s674.html.84
446
+ - spec/ext/live/s674.html.85
447
+ - spec/ext/live/s674.html.86
448
+ - spec/ext/live/s674.html.87
449
+ - spec/ext/live/s674.html.88
450
+ - spec/ext/live/s674.html.89
451
+ - spec/ext/live/s674.html.9
452
+ - spec/ext/live/s674.html.90
453
+ - spec/ext/live/s674.html.91
454
+ - spec/ext/live/s674.html.92
455
+ - spec/ext/live/s674.html.93
456
+ - spec/ext/live/s674.html.94
457
+ - spec/ext/live/s674.html.95
458
+ - spec/ext/live/s674.html.96
459
+ - spec/ext/live/s674.html.97
460
+ - spec/ext/live/s674.html.98
461
+ - spec/ext/live/s674.html.99
462
+ - spec/ext/nikkansports.txt
463
+ - spec/spec_helper.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/LICENSE.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2010 niku
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc DELETED
@@ -1,33 +0,0 @@
1
- = Consadole Aggregator
2
-
3
- Aggregate infomation of 'Consadole Sapporo'.
4
-
5
- == Install
6
-
7
- $ gem install consadole_aggregator
8
-
9
- == Usage
10
-
11
- $ consadole_aggregator
12
-
13
- == Contributing to consadole_aggregator
14
-
15
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
16
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
17
- * Fork the project
18
- * Start a feature/bugfix branch
19
- * Commit and push until you are happy with your contribution
20
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
21
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
22
-
23
- == TODO
24
-
25
- * extract Module of Aggregatable
26
- * use Aggregatable to Live
27
- * create Stack for output
28
-
29
- == Copyright
30
-
31
- Copyright (c) 2010 niku. See LICENSE.txt for
32
- further details.
33
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.9
data/account.yaml DELETED
@@ -1,6 +0,0 @@
1
- consumer:
2
- key: # your consumer key here
3
- secret: # your consumer secret here
4
- access:
5
- key: # your access key here
6
- secret: # your secret key here
data/db/.gitignore DELETED
File without changes
@@ -1,62 +0,0 @@
1
- require 'logger'
2
- require 'yaml'
3
-
4
- module ConsadoleAggregator
5
- module Aggregatable
6
- def initialize logger=nil
7
- @logger = logger || Logger.new(nil)
8
- end
9
-
10
- def get_new_articles
11
- get_resource = self.class.get_resource
12
- parse_list = self.class.parse_list
13
- parse_article = self.class.parse_article
14
- raise NotImplementedError unless get_resource && parse_list && parse_article
15
- list_url = get_resource.call
16
- article_urls = parse_list.call(list_url)
17
- article_urls.each_with_object([]) do |article_url, memo|
18
- article = parse_article.call(article_url)
19
- memo.push(article) if article && !get_strage.include?(article)
20
- end
21
- end
22
-
23
- def update
24
- @logger.info('begin of update')
25
- get_new_articles.each do |article|
26
- begin
27
- yield article if block_given?
28
- @strage << article
29
- rescue
30
- @logger.error $!
31
- end
32
- end
33
- save_strage
34
- @logger.info('end of update')
35
- end
36
-
37
- def get_strage
38
- @strage ||= YAML.load_file(build_strage_path) || [] # fix when YAML.load_file is nil
39
- rescue
40
- @logger.error $!
41
- raise
42
- end
43
-
44
- def save_strage
45
- YAML.dump(@strage, File.new(build_strage_path, 'w'))
46
- end
47
-
48
- def build_strage_path
49
- class_name = /([^:]+)$/.match(self.class.to_s)[1]
50
- File.expand_path(File.dirname(__FILE__) + "/../../db/#{class_name}.yaml")
51
- end
52
-
53
- # define class method's
54
- def self.included(mod)
55
- mod.extend ClassMethods
56
- end
57
-
58
- module ClassMethods
59
- attr_accessor :get_resource, :parse_list, :parse_article
60
- end
61
- end
62
- end
@@ -1,13 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module ConsadoleAggregator::Live
3
- Timeline = Struct.new(:time, :post)
4
- class Timeline
5
- def self.parse line
6
- return nil if line.nil? || line.empty? || line =~ /(&lt;前半&gt;)|(&lt;後半&gt;)/
7
- Timeline.new(*line.split(' '))
8
- end
9
- def to_s
10
- ('%s %s'%[time, post]).squeeze.rstrip
11
- end
12
- end
13
- end
data/log/.gitignore DELETED
File without changes
@@ -1,87 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require_relative '../spec_helper'
3
-
4
- module ConsadoleAggregator
5
- describe Aggregatable do
6
- before do
7
- @articles = [{ url:'http://example.jp/', title:'hoge' },
8
- { url:'http://example.com/', title:'fuga' }]
9
- get_resource_stub = double('get_resource')
10
- get_resource_stub.stub(:call).and_return('')
11
- parse_list_stub = double('parse_list')
12
- parse_list_stub.stub(:call).and_return(['http://example.jp/', 'http://example.com/'])
13
- parse_article_stub = double('parse_article')
14
- parse_article_stub.stub(:call) do |arg|
15
- if arg == 'http://example.jp/'
16
- { url:arg, title:'hoge' }
17
- else
18
- { url:arg, title:'fuga' }
19
- end
20
- end
21
- klass = Class.new do
22
- include Aggregatable
23
- @get_resource = get_resource_stub
24
- @parse_list = parse_list_stub
25
- @parse_article = parse_article_stub
26
- end
27
- ConsadoleAggregator::News.const_set(:TestClass, klass) # FIXME How do I suppress warning?
28
- subject.stub(:save_strage)
29
- end
30
-
31
- subject{ News::TestClass.new }
32
-
33
- describe '#get_new_articles' do
34
- context 'when article straged' do
35
- before do
36
- @straged = [@articles.first]
37
- subject.stub!(:get_strage).and_return(@straged)
38
- end
39
- it 'should return part of articles' do
40
- subject.get_new_articles.should == @articles - @straged
41
- end
42
- end
43
- end
44
-
45
- describe '#update' do
46
- context 'when default' do
47
- it 'should call ordered' do
48
- subject.should_receive(:get_new_articles).ordered.and_return([])
49
- subject.should_receive(:save_strage).ordered
50
- subject.update
51
- end
52
- end
53
- context 'when new_articles exist' do
54
- before do
55
- YAML.stub!(:load_file).and_return([])
56
- subject.stub!(:get_new_articles).and_return(@articles)
57
- end
58
- it 'should add strage' do
59
- expect{ subject.update }.to change{ subject.get_strage.dup }.from([]).to(@articles)
60
- end
61
- end
62
- end
63
-
64
- describe '#get_strage' do
65
- context 'when yaml can load' do
66
- it 'should load from yaml' do
67
- YAML.should_receive(:load_file).with(/\/db\/TestClass.yaml$/)
68
- subject.get_strage
69
- end
70
- end
71
- context 'when yaml can\'t load' do
72
- before do
73
- YAML.stub!(:load_file){ raise }
74
- end
75
- it 'should load from yaml' do
76
- except{ subject.get_strage }.to should_raise
77
- end
78
- end
79
- end
80
-
81
- describe '#build_strage_path' do
82
- context 'when Testclass' do
83
- it { subject.build_strage_path.should match /\/db\/TestClass.yaml$/ }
84
- end
85
- end
86
- end
87
- end