railscasts_download 0.1.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.
- data/.gitignore +5 -0
- data/Gemfile +9 -0
- data/README.md +36 -0
- data/Rakefile +10 -0
- data/bin/railscasts_download +26 -0
- data/lib/railscasts_download/downloader.rb +11 -0
- data/lib/railscasts_download/rss.rb +19 -0
- data/lib/railscasts_download/saver.rb +30 -0
- data/lib/railscasts_download/version.rb +3 -0
- data/lib/railscasts_download.rb +4 -0
- data/railscasts_download.gemspec +24 -0
- data/test/acceptance/railscasts_download_test.rb +25 -0
- data/test/fixtures/rss.txt +4072 -0
- data/test/functional/railscasts_download_test.rb +60 -0
- data/test/functional/rss_test.rb +17 -0
- data/test/railscasts_download_test.rb +5 -0
- data/test/stubs/downloader.rb +8 -0
- data/test/test_helper.rb +4 -0
- metadata +77 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
class RailscastsDownloadInEmptyEnvTestClear < Test::Unit::TestCase
|
2
|
+
def setup
|
3
|
+
source_file = File.dirname( __FILE__ ) + '/../fixtures/rss.txt'
|
4
|
+
downloader = StubDownloader.new
|
5
|
+
@saver = RailscastsDownload::Saver.new( downloader: downloader, rss_uri: source_file )
|
6
|
+
end
|
7
|
+
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
8
|
+
|
9
|
+
def test_videos_uris_nothing_raised
|
10
|
+
assert_nothing_raised { @saver.videos_uris }
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_missing_videos_uris_nothing_raised
|
14
|
+
assert_nothing_raised { @saver.missing_videos_uris }
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_videos_uris_returns_correct_values
|
18
|
+
assert_equal( "http://media.railscasts.com/assets/episodes/videos/001-caching-with-instance-variables.mp4",
|
19
|
+
@saver.videos_uris.first )
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_missing_videos_uris_returns_correct_value
|
23
|
+
assert_equal( "http://media.railscasts.com/assets/episodes/videos/001-caching-with-instance-variables.mp4",
|
24
|
+
@saver.missing_videos_uris.first )
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_videos_uris_returns_all_uris
|
28
|
+
assert_equal( 311, @saver.videos_uris.count )
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_missing_videos_uris_returns_all_uris
|
32
|
+
assert_equal( 311, @saver.missing_videos_uris.count )
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class RailscastsDownloadWithSomeVideoesTest < Test::Unit::TestCase
|
37
|
+
def setup
|
38
|
+
source_file = File.dirname( __FILE__ ) + '/../fixtures/rss.txt'
|
39
|
+
@saver = RailscastsDownload::Saver.new( rss_uri: source_file )
|
40
|
+
File.new( "001-caching-with-instance-variables.mp4", "w+" ).close
|
41
|
+
end
|
42
|
+
|
43
|
+
def teardown
|
44
|
+
Dir.glob( '*.mp4' ).each { |file| File.delete(file)}
|
45
|
+
end
|
46
|
+
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
47
|
+
|
48
|
+
def test_missing_videos_uris_returns_correct_value
|
49
|
+
assert_equal( "http://media.railscasts.com/assets/episodes/videos/002-dynamic-find-by-methods.mp4",
|
50
|
+
@saver.missing_videos_uris.first )
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_videos_uris_returns_all_uris
|
54
|
+
assert_equal( 311, @saver.videos_uris.count )
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_missing_videos_uris_returns_only_missing_uris
|
58
|
+
assert_equal( 310, @saver.missing_videos_uris.count )
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
class RssTest < Test::Unit::TestCase
|
3
|
+
def setup
|
4
|
+
source_file = File.dirname( __FILE__ ) + '/../fixtures/rss.txt'
|
5
|
+
@rss = RailscastsDownload::Rss.new( source_file )
|
6
|
+
end
|
7
|
+
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
8
|
+
|
9
|
+
def test_get_uris_returns_array
|
10
|
+
assert_instance_of( Array, @rss.get_uris )
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_get_uris_returns_correct_uris
|
14
|
+
assert_equal( "http://media.railscasts.com/assets/episodes/videos/001-caching-with-instance-variables.mp4",
|
15
|
+
@rss.get_uris.first )
|
16
|
+
end
|
17
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: railscasts_download
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- k-nowicki
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-29 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Download all revised and pro railscasts with oneline command.
|
15
|
+
email:
|
16
|
+
- karol@knowicki.pl
|
17
|
+
executables:
|
18
|
+
- railscasts_download
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- bin/railscasts_download
|
27
|
+
- lib/railscasts_download.rb
|
28
|
+
- lib/railscasts_download/downloader.rb
|
29
|
+
- lib/railscasts_download/rss.rb
|
30
|
+
- lib/railscasts_download/saver.rb
|
31
|
+
- lib/railscasts_download/version.rb
|
32
|
+
- railscasts_download.gemspec
|
33
|
+
- test/acceptance/railscasts_download_test.rb
|
34
|
+
- test/fixtures/rss.txt
|
35
|
+
- test/functional/railscasts_download_test.rb
|
36
|
+
- test/functional/rss_test.rb
|
37
|
+
- test/railscasts_download_test.rb
|
38
|
+
- test/stubs/downloader.rb
|
39
|
+
- test/test_helper.rb
|
40
|
+
homepage: ''
|
41
|
+
licenses: []
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
hash: 4319710688046479509
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
hash: 4319710688046479509
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project: railscasts_download
|
66
|
+
rubygems_version: 1.8.17
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Download all revised and pro railscasts with oneline command!
|
70
|
+
test_files:
|
71
|
+
- test/acceptance/railscasts_download_test.rb
|
72
|
+
- test/fixtures/rss.txt
|
73
|
+
- test/functional/railscasts_download_test.rb
|
74
|
+
- test/functional/rss_test.rb
|
75
|
+
- test/railscasts_download_test.rb
|
76
|
+
- test/stubs/downloader.rb
|
77
|
+
- test/test_helper.rb
|