tdiary-contrib 4.1.1 → 4.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,11 @@ describe "MyHotEntry" do
10
10
  "#{File.basename(__FILE__, ".rb")}-#{$$}"
11
11
  end
12
12
  before(:each) do
13
+ stub_request(:get, "http://b.hatena.ne.jp/entrylist?mode=rss&url=http%3A%2F%2Fd.hatena.ne.jp%2F&sort=eid&threshold=3")
14
+ .to_return(status: 200, body: File.new('spec/fixtures/my_hotentry/entrylist.xml'))
15
+ stub_request(:get, "http://b.hatena.ne.jp/entrylist?mode=rss&sort=eid&threshold=3&url=http://empty-url.example.com/")
16
+ .to_return(status: 200, body: File.new('spec/fixtures/my_hotentry/entrylist-empty.xml'))
17
+
13
18
  fake_plugin(:my_hotentry)
14
19
  @cache_path = File.join(Dir.tmpdir, cache_filename)
15
20
  Dir.mkdir(@cache_path)
data/spec/spec_helper.rb CHANGED
@@ -10,6 +10,20 @@ if ENV['COVERAGE'] == 'simplecov'
10
10
  end
11
11
 
12
12
  require 'erb'
13
+ require 'webmock/rspec'
14
+ require 'tmpdir'
15
+
16
+ RSpec.configure do |c|
17
+ # create a temporary directory used by the plugin for cache
18
+ c.before(:all) do
19
+ @cache_path = Dir.mktmpdir
20
+ end
21
+
22
+ c.after(:all) do
23
+ FileUtils.rmtree(@cache_path)
24
+ end
25
+ end
26
+
13
27
  # FIXME PluginFake in under construction.
14
28
  class PluginFake
15
29
  include ERB::Util
@@ -19,12 +33,14 @@ class PluginFake
19
33
 
20
34
  def initialize
21
35
  @conf = Config.new
36
+ @cache_path = ""
22
37
  @mode = ""
23
38
  @date = nil
24
39
  @header_procs = []
25
40
  @footer_procs = []
26
41
  @update_procs = []
27
42
  @conf_procs = []
43
+ @edit_procs = []
28
44
  @body_enter_procs = []
29
45
  @body_leave_procs = []
30
46
  end
@@ -33,6 +49,10 @@ class PluginFake
33
49
  @conf_procs << block
34
50
  end
35
51
 
52
+ def add_edit_proc( block = Proc::new )
53
+ @edit_procs << block
54
+ end
55
+
36
56
  def add_header_proc( block = Proc::new )
37
57
  @header_procs << block
38
58
  end
@@ -183,6 +203,8 @@ def fake_plugin( name_sym, cgi=nil, base=nil, &block )
183
203
  file_path = plugin_path( name_sym, base )
184
204
  plugin_name = File.basename( file_path, ".rb" )
185
205
 
206
+ plugin.instance_variable_set(:@cache_path, @cache_path)
207
+
186
208
  plugin.instance_eval do
187
209
  eval( File.read( file_path ), binding,
188
210
  "(#{File.basename(file_path)})", 1 )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tDiary contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-29 00:00:00.000000000 Z
11
+ date: 2015-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tdiary
@@ -294,6 +294,7 @@ files:
294
294
  - plugin/section_footer2.rb
295
295
  - plugin/section_permalink.rb
296
296
  - plugin/section_permalink_anchor.rb
297
+ - plugin/select-style.rb
297
298
  - plugin/select_style.rb
298
299
  - plugin/select_theme.rb
299
300
  - plugin/show_and_hide.rb
@@ -326,9 +327,14 @@ files:
326
327
  - plugin/yshop.rb
327
328
  - plugin/zenback.rb
328
329
  - spec/apple_webclip_spec.rb
330
+ - spec/fixtures/flickr/5950109223.flickr.photos.getInfo.xml
331
+ - spec/fixtures/flickr/5950109223.flickr.photos.getSizes.xml
329
332
  - spec/fixtures/friendfeed.xml
330
333
  - spec/fixtures/github.json
334
+ - spec/fixtures/my_hotentry/entrylist-empty.xml
335
+ - spec/fixtures/my_hotentry/entrylist.xml
331
336
  - spec/fixtures/twitter.xml
337
+ - spec/flicker_spec.rb
332
338
  - spec/gist_spec.rb
333
339
  - spec/github_link_spec.rb
334
340
  - spec/google_analytics_spec.rb
@@ -463,9 +469,14 @@ specification_version: 4
463
469
  summary: tDiary contributions package
464
470
  test_files:
465
471
  - spec/apple_webclip_spec.rb
472
+ - spec/fixtures/flickr/5950109223.flickr.photos.getInfo.xml
473
+ - spec/fixtures/flickr/5950109223.flickr.photos.getSizes.xml
466
474
  - spec/fixtures/friendfeed.xml
467
475
  - spec/fixtures/github.json
476
+ - spec/fixtures/my_hotentry/entrylist-empty.xml
477
+ - spec/fixtures/my_hotentry/entrylist.xml
468
478
  - spec/fixtures/twitter.xml
479
+ - spec/flicker_spec.rb
469
480
  - spec/gist_spec.rb
470
481
  - spec/github_link_spec.rb
471
482
  - spec/google_analytics_spec.rb