Skip to content

Commit 5e101a0

Browse files
committed
205 Remove obsolete spec helper and db wrapper method
1 parent 33841b7 commit 5e101a0

File tree

2 files changed

+9
-40
lines changed

2 files changed

+9
-40
lines changed

plugins/store/database.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,6 @@
1111

1212
module Automatic::Plugin
1313
module Database
14-
def for_each_new_link
15-
prepare_database
16-
existing_records = model_class.find(:all)
17-
@return_html = []
18-
@pipeline.each { |link|
19-
unless link.nil?
20-
new_link = false
21-
unless existing_records.detect { |b| b.try(unique_key) == link }
22-
yield(link)
23-
new_link = true
24-
end
25-
@return_html << link if new_link
26-
end
27-
}
28-
@return_html
29-
end
30-
3114
def for_each_new_feed
3215
prepare_database
3316
existing_records = model_class.find(:all)

spec/spec_helper.rb

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def root_dir
5151
def db_dir
5252
dir = (File.expand_path('~/.automatic/db'))
5353
if File.directory?(dir)
54-
return dir
54+
dir
5555
else
56-
return File.join(root_dir, "db")
56+
File.join(root_dir, "db")
5757
end
5858
end
5959
end
@@ -70,20 +70,6 @@ def feed(&block)
7070
generator.instance_eval(&block)
7171
@pipeline << generator.feed
7272
end
73-
74-
def html(fixture)
75-
obj = File.read(File.join(APP_ROOT, "spec",
76-
"fixtures", fixture))
77-
@pipeline << obj
78-
end
79-
80-
def link(fixture)
81-
obj = File.read(File.join(APP_ROOT, "spec",
82-
"fixtures", fixture))
83-
require 'extract/link'
84-
@pipeline << obj
85-
@pipeline.replace Automatic::Plugin::ExtractLink.new(nil, @pipeline).run
86-
end
8773
end
8874

8975
class StubFeedGenerator
@@ -94,16 +80,16 @@ def initialize
9480
def feed
9581
rss = RSS::Rss.new([])
9682
rss.instance_variable_set(:@channel, @channel)
97-
return rss
83+
rss
9884
end
9985

10086
def item(url, title="", description="", date="")
101-
itm = RSS::Rss::Channel::Item.new
102-
itm.link = url
103-
itm.title = title unless title.blank?
104-
itm.instance_variable_set(:@description, description)
105-
itm.pubDate = date unless date.blank?
106-
@channel.items << itm
87+
item = RSS::Rss::Channel::Item.new
88+
item.link = url
89+
item.title = title unless title.blank?
90+
item.instance_variable_set(:@description, description)
91+
item.pubDate = date unless date.blank?
92+
@channel.items << item
10793
end
10894
end
10995
end

0 commit comments

Comments
 (0)