das_catalog 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/das_catalog.rb +2 -2
- data/lib/das_catalog/feed.rb +7 -2
- data/lib/das_catalog/version.rb +1 -1
- data/spec/das_feed_spec.rb +14 -2
- data/spec/spec_helper.rb +3 -0
- metadata +21 -21
data/lib/das_catalog.rb
CHANGED
data/lib/das_catalog/feed.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'rss/1.0'
|
2
|
+
require 'rss/2.0'
|
2
3
|
|
3
4
|
module DasCatalog
|
4
5
|
class Feed
|
5
6
|
FEED_URL = "https://www.destroyallsoftware.com/screencasts/feed"
|
6
7
|
|
7
8
|
def self.get
|
8
|
-
|
9
|
+
content = ""
|
10
|
+
open(FEED_URL) do |s|
|
11
|
+
content = s.read
|
12
|
+
end
|
13
|
+
RSS::Parser.parse(content,false)
|
9
14
|
end
|
10
15
|
end
|
11
16
|
end
|
data/lib/das_catalog/version.rb
CHANGED
data/spec/das_feed_spec.rb
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
require_relative "spec_helper"
|
2
2
|
|
3
3
|
describe DasCatalog::Feed do
|
4
|
-
|
5
|
-
|
4
|
+
let(:feed) { File.readlines(File.join(File.dirname(__FILE__), "fixtures/feed.xml")).to_s }
|
5
|
+
|
6
|
+
before do
|
7
|
+
FakeWeb.register_uri(:get, "https://www.destroyallsoftware.com/screencasts/feed", :body => feed)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "grabs the feed with open" do
|
11
|
+
# This is from openuri but I feel dirty setting mocks on high level objects
|
12
|
+
DasCatalog::Feed.expects(:open).with("https://www.destroyallsoftware.com/screencasts/feed")
|
13
|
+
DasCatalog::Feed.get
|
14
|
+
end
|
15
|
+
|
16
|
+
it "parses the feed with RSS::Parser" do
|
17
|
+
RSS::Parser.expects(:parse).with(feed, false)
|
6
18
|
DasCatalog::Feed.get
|
7
19
|
end
|
8
20
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,7 @@ require 'fakefs/safe'
|
|
7
7
|
require 'fileutils'
|
8
8
|
require 'tempfile'
|
9
9
|
require 'logger'
|
10
|
+
require 'fakeweb'
|
10
11
|
|
11
12
|
require_relative '../lib/das_catalog'
|
12
13
|
|
@@ -20,3 +21,5 @@ MiniTest::Spec.add_setup_hook do
|
|
20
21
|
c.logger = null_logger
|
21
22
|
end
|
22
23
|
end
|
24
|
+
|
25
|
+
FakeWeb.allow_net_connect = false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: das_catalog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-03-02 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
15
|
+
name: mechanize
|
16
|
+
requirement: &2152533740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152533740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: highline
|
27
|
+
requirement: &2152533220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,21 +32,21 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152533220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
37
|
+
name: minitest
|
38
|
+
requirement: &2152532580 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '0'
|
44
|
-
type: :
|
44
|
+
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2152532580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
48
|
+
name: mocha
|
49
|
+
requirement: &2152531960 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2152531960
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement: &
|
59
|
+
name: fakefs
|
60
|
+
requirement: &2152531280 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2152531280
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement: &
|
70
|
+
name: fakeweb
|
71
|
+
requirement: &2152530860 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2152530860
|
80
80
|
description: Download screencasts from Destroy All Software catalog. Uses the rss
|
81
81
|
feed plus Mechanize to log you in and then download new movies to your local drive.
|
82
82
|
email: xternal1+github@gmail.com
|