subtitle_it 1.9.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/Gemfile +3 -0
  4. data/{README.rdoc → README.md} +22 -18
  5. data/Rakefile +13 -18
  6. data/bin/subtitle_it +4 -8
  7. data/lib/subtitle_it/bin.rb +50 -58
  8. data/lib/subtitle_it/fixes.rb +3 -4
  9. data/lib/subtitle_it/formats/ass.rb +5 -6
  10. data/lib/subtitle_it/formats/mpl.rb +9 -9
  11. data/lib/subtitle_it/formats/rsb.rb +9 -9
  12. data/lib/subtitle_it/formats/srt.rb +17 -14
  13. data/lib/subtitle_it/formats/sub.rb +7 -7
  14. data/lib/subtitle_it/formats/xml.rb +13 -12
  15. data/lib/subtitle_it/formats/yml.rb +5 -5
  16. data/lib/subtitle_it/generator.rb +2 -2
  17. data/lib/subtitle_it/languages.rb +52 -53
  18. data/lib/subtitle_it/movie.rb +26 -6
  19. data/lib/subtitle_it/platform_endl.rb +7 -5
  20. data/lib/subtitle_it/subdown.rb +30 -33
  21. data/lib/subtitle_it/subline.rb +5 -5
  22. data/lib/subtitle_it/substyle.rb +3 -9
  23. data/lib/subtitle_it/subtime.rb +19 -10
  24. data/lib/subtitle_it/subtitle.rb +20 -28
  25. data/lib/subtitle_it/version.rb +1 -7
  26. data/lib/subtitle_it.rb +7 -7
  27. data/spec/fixtures/movie.xml +2 -2
  28. data/spec/spec_helper.rb +6 -6
  29. data/spec/subtitle_it/bin_spec.rb +110 -98
  30. data/spec/subtitle_it/formats/ass_spec.rb +2 -3
  31. data/spec/subtitle_it/formats/mpl_spec.rb +26 -28
  32. data/spec/subtitle_it/formats/rsb_spec.rb +29 -30
  33. data/spec/subtitle_it/formats/srt_spec.rb +27 -30
  34. data/spec/subtitle_it/formats/sub_spec.rb +19 -21
  35. data/spec/subtitle_it/formats/xml_spec.rb +21 -21
  36. data/spec/subtitle_it/formats/yml_spec.rb +14 -15
  37. data/spec/subtitle_it/movie_spec.rb +24 -15
  38. data/spec/subtitle_it/subdown_spec.rb +58 -65
  39. data/spec/subtitle_it/subline_spec.rb +17 -18
  40. data/spec/subtitle_it/subtime_spec.rb +43 -44
  41. data/spec/subtitle_it/subtitle_spec.rb +28 -29
  42. data/spec/subtitle_it_spec.rb +4 -5
  43. data/subtitle_it.gemspec +25 -98
  44. metadata +121 -67
  45. data/.rspec +0 -2
  46. data/config/hoe.rb +0 -73
  47. data/config/requirements.rb +0 -15
  48. data/lib/subtitle_it/movie_hasher.rb +0 -30
  49. data/script/console +0 -10
  50. data/script/destroy +0 -14
  51. data/script/generate +0 -14
  52. data/script/txt2html +0 -82
  53. data/spec/subtitle_it/movie_hasher_spec.rb +0 -13
  54. data/tasks/deployment.rake +0 -34
  55. data/tasks/environment.rake +0 -7
  56. data/tasks/rspec.rake +0 -21
@@ -1,142 +1,154 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  module BinspecHelper
4
- def mock_xmlrpc(stubs={}); @mock_xmlrpc ||= mock(XMLRPC::Client, stubs); end
5
- def mock_subdown; @mock_subdown = mock(Subdown); end
6
- def mock_file; @mock_file = mock(File); end
7
-
4
+ def mock_xmlrpc(stubs = {})
5
+ @mock_xmlrpc ||= double(XMLRPC::Client, stubs)
6
+ end
7
+
8
+ def mock_subdown
9
+ @mock_subdown = double(Subdown)
10
+ end
11
+
12
+ def mock_file
13
+ @mock_file = double(File)
14
+ end
15
+
8
16
  def mock_movie
9
- @mock_movie = mock(Movie, {:filename => "Beavis Butthead Do America.avi",
10
- :haxx => '09a2c497663259cb' })
17
+ @mock_movie = double(Movie, filename: 'Beavis Butthead Do America.avi',
18
+ haxx: '09a2c497663259cb')
11
19
  end
12
-
20
+
13
21
  def mock_subtitle
14
- @mock_subtitle = mock(Subtitle, {
15
- :info => sub_info, :format => 'srt', :<=> => 1
16
- })
22
+ @mock_subtitle = double(Subtitle, :info => sub_info, :format => 'srt', :<=> => 1)
17
23
  end
18
-
24
+
19
25
  def sub_info
20
- {
21
- "SubLanguageID" => 'eng',
22
- "MovieName" => 'Resevoir Dogs',
23
- "MovieYear" => '1992',
24
- "SubFileName" => 'Cool sub',
25
- "MovieImdbRating" => '10.0',
26
- "SubDownloadsCnt" => '310',
27
- "SubRating" => '9.5',
28
- "SubFormat" => 'srt',
29
- "SubSumCD" => '2',
30
- "SubAuthorComment" => 'Nice nice...'
31
- }
26
+ {
27
+ 'SubLanguageID' => 'eng',
28
+ 'LanguageName' => 'English',
29
+ 'MovieName' => 'Resevoir Dogs',
30
+ 'MovieYear' => '1992',
31
+ 'SubFileName' => 'Cool sub',
32
+ 'MovieFPS' => '29.0',
33
+ 'MovieImdbRating' => '10.0',
34
+ 'SubAddDate' => '12-12-2012 00:01:01',
35
+ 'SubDownloadsCnt' => '310',
36
+ 'SubRating' => '9.5',
37
+ 'SubFormat' => 'srt',
38
+ 'SubSumCD' => '2',
39
+ 'SubAuthorComment' => 'Nice nice...'
40
+ }
32
41
  end
33
42
  end
34
43
 
35
44
  describe Bin do
36
45
  include BinspecHelper
37
-
38
- it "should require ARGV" do
39
- lambda { Bin::run!(nil) }.should raise_error
46
+
47
+ it 'should require ARGV' do
48
+ expect { Bin.run!(nil) }.to raise_error
40
49
  end
41
-
50
+
42
51
  # Having a hard time testing the command line tool...
43
52
  # #
44
- #
53
+ #
45
54
  # it "should call for movie" do
46
55
  # Subdownloader.should_receive(:new)
47
- # File.should_receive(:exists?).and_return(true)
56
+ # File.should_receive(:exist?).and_return(true)
48
57
  # File.should_receive(:open).and_return(mock_file)
49
58
  # SubtitleIt::Bin::run!(["movie.avi"])
50
59
  # end
51
- #
60
+ #
52
61
  # it "should call for subtitle" do
53
62
  # @subwork_mock = mock(Subwork, :run! => true)#.should_receive(:new)
54
63
  # @subwork_mock.should_receive(:new)
55
64
  # @subwork_mock.should_receive(:run!)
56
- # File.should_receive(:exists?).and_return(true)
65
+ # File.should_receive(:exist?).and_return(true)
57
66
  # SubtitleIt::Bin::run!(["movie.srt"])
58
- # end
67
+ # end
59
68
  end
60
-
61
- describe Subdownloader do
69
+
70
+ describe Subdownloader do
62
71
  include BinspecHelper
63
-
64
- it "should print languages" do
65
- STDOUT.should_receive(:puts).at_least(30).times
66
- SubtitleIt::Bin.print_languages
72
+
73
+ it 'should print languages' do
74
+ expect(STDOUT).to receive(:puts).at_least(30).times
75
+ SubtitleIt::Bin.print_languages
67
76
  end
68
77
 
69
- it "should download a subtitle" do
70
- Movie.should_receive(:new).and_return(mock_movie)
71
- Subdown.should_receive(:new).and_return(mock_subdown)#mock(Subdown))
72
-
73
- STDIN.should_receive(:gets).and_return("1")
74
- STDOUT.should_receive(:puts).with("Found 2 results. Choose one:\n")
75
- STDOUT.should_receive(:printf).with("Choose: ")
76
- STDOUT.should_receive(:puts).with("You can choose multiple ones, separated with spaces or a range separated with hifen.")
77
- STDOUT.should_receive(:puts).with("Downloading 1 subtitles...")
78
- STDOUT.should_receive(:puts).with("1) Resevoir Dogs / 1992 | Cool sub | Movie score: 10.0\n Lang: Eng | Format: SRT | Downloads: 310 | Rating: 9.5 | CDs: 2\n Comments: Nice nice... \n\n")
79
- STDOUT.should_receive(:puts).with("2) Resevoir Dogs / 1992 | Cool sub | Movie score: 10.0\n Lang: Eng | Format: SRT | Downloads: 310 | Rating: 9.5 | CDs: 2\n Comments: Nice nice... \n\n")
80
- STDOUT.should_receive(:puts).with("Done. Wrote: Beavis Butthead Do America.srt.")
81
-
82
- File.should_receive(:open).with("Beavis Butthead Do America.srt", "w").and_return(true)
83
-
84
- @mock_subdown.should_receive(:log_in!).and_return(true)
85
- @mock_subdown.should_receive(:download_subtitle).and_return(mock_subtitle)
86
- @mock_subdown.should_receive(:search_subtitles).and_return([mock_subtitle, mock_subtitle])
87
- @mock_subdown.should_receive(:log_out!).and_return(true)
88
-
89
- Subdownloader.new.run! "file.avi"
78
+ it 'should download a subtitle' do
79
+ expect(Movie).to receive(:new).and_return(mock_movie)
80
+ expect(Subdown).to receive(:new).and_return(mock_subdown)
81
+
82
+ expect(STDIN).to receive(:gets).and_return('1')
83
+ expect(STDOUT).to receive(:puts).with(/You can choose multiple ones/)
84
+ expect(STDOUT).to receive(:puts).with("Found #{'2'.yellow} results:\n")
85
+ expect(STDOUT).to receive(:print).with(/Choose/)
86
+ expect(STDOUT).to receive(:puts).with(" #{'1'.yellow}. #{'Eng'.green} | #{'SRT'.blue} | #{'Resevoir Dogs'.cyan} / #{'1992'.cyan} | #{'9.5'.yellow} | FPS 29.0 | 2 CDs | 2012-12-12")
87
+ expect(STDOUT).to receive(:puts).with(" #{'2'.yellow}. #{'Eng'.green} | #{'SRT'.blue} | #{'Resevoir Dogs'.cyan} / #{'1992'.cyan} | #{'9.5'.yellow} | FPS 29.0 | 2 CDs | 2012-12-12")
88
+ expect(STDOUT).to receive(:puts).with('Downloading 1 subtitle...')
89
+ expect(STDOUT).to receive(:puts).with('Done: Beavis Butthead Do America.eng.srt'.yellow)
90
+
91
+ expect(File).to receive(:open).with('Beavis Butthead Do America.eng.srt', 'w').and_return(true)
92
+
93
+ expect(@mock_subdown).to receive(:log_in!).and_return(true)
94
+ expect(@mock_subdown).to receive(:download_subtitle).and_return(mock_subtitle)
95
+ expect(@mock_subdown).to receive(:search_subtitles).and_return([mock_subtitle, mock_subtitle])
96
+ expect(@mock_subdown).to receive(:log_out!).and_return(true)
97
+
98
+ Subdownloader.new.run! 'file.avi'
90
99
  end
91
-
92
- it "should get extension files" do
93
- Bin.get_extension("Lots.of.dots.happen").should eql("happen")
94
- lambda { Bin.get_extension("Nodotstoo") }.should raise_error
100
+
101
+ # it 'should download and convert a subtitle' do
102
+ # expect(Subtitle).to receive(:new).and_return(mock_subtitle)
103
+ # end
104
+
105
+ it 'should get extension files' do
106
+ expect(Bin.get_extension('Lots.of.dots.happen')).to eql('happen')
107
+ expect { Bin.get_extension('Nodotstoo') }.to raise_error
95
108
  end
96
-
97
- it "should swap extensions" do
98
- Bin.swap_extension("foo.txt", "srt").should eql("foo.srt")
109
+
110
+ it 'should swap extensions' do
111
+ expect(Bin.swap_extension('foo.txt', 'srt')).to eql('foo.srt')
99
112
  end
100
-
101
- it "should parse user input" do
113
+
114
+ it 'should parse user input' do
102
115
  @subd = Subdownloader.new
103
- @subd.parse_input("1 2-5 7 8-10 15").should eql([1, 2, 3, 4, 5, 7, 8, 9, 10, 15])
116
+ expect(@subd.parse_input('1 2-5 7 8-10 15')).to eql([1, 2, 3, 4, 5, 7, 8, 9, 10, 15])
104
117
  end
105
118
 
106
- it "should print choice" do
107
- @sub = mock(Subtitle, :info => sub_info)
108
- @subd = Subdownloader.new
109
- @subd.print_option(@sub, 1).should eql("2) Resevoir Dogs / 1992 | Cool sub | Movie score: 10.0
110
- Lang: Eng | Format: SRT | Downloads: 310 | Rating: 9.5 | CDs: 2
111
- Comments: Nice nice... \n\n")
119
+ it 'should print choice' do
120
+ @sub = double(Subtitle, info: sub_info)
121
+ @subd = Subdownloader.new
122
+ expect(@subd.print_option(@sub.info, 1)).
123
+ to eql(" #{'2'.yellow}. #{'Eng'.green} | #{'SRT'.blue} | #{'Resevoir Dogs'.cyan} / #{'1992'.cyan} | #{'9.5'.yellow} | FPS 29.0 | 2 CDs | 2012-12-12")
112
124
  end
113
125
  end
114
126
 
115
127
  describe Subwork do
116
128
  include BinspecHelper
117
-
118
- it "should call a new subtitle" do
119
- File.should_receive(:open).with("file.srt", "r").and_return(mock_file)
120
- File.should_receive(:open).with("file.sub", "w").and_return(true)
121
-
122
- STDOUT.should_receive(:puts).with("Working on file file.srt...")
123
- STDOUT.should_receive(:puts).with('Done. Wrote: file.sub.')
124
-
125
- Subtitle.should_receive(:new).and_return(mock_subtitle)
126
- @mock_subtitle.should_receive(:to_sub).and_return('subbb')
127
-
128
- Subwork.new.run!("file.srt", "sub")
129
+
130
+ it 'should call a new subtitle' do
131
+ expect(File).to receive(:open).with('file.srt', 'r').and_return(mock_file)
132
+ expect(File).to receive(:open).with('file.sub', 'w').and_return(true)
133
+
134
+ expect(STDOUT).to receive(:puts).with('Working on file file.srt...')
135
+ expect(STDOUT).to receive(:puts).with('Done: file.sub'.yellow)
136
+
137
+ expect(Subtitle).to receive(:new).and_return(mock_subtitle)
138
+ expect(@mock_subtitle).to receive(:to_sub).and_return('subbb')
139
+
140
+ Subwork.new.run!('file.srt', 'sub')
129
141
  end
130
-
131
- it "should not write if file exists" do
132
- File.should_receive(:open).with("file.srt", "r").and_return(mock_file)
133
- File.should_receive(:exists?).and_return(true)
134
-
135
- STDOUT.should_receive(:puts).with("Working on file file.srt...")
136
- STDOUT.should_receive(:puts).with("File exists. file.sub")
137
-
138
- Subtitle.should_receive(:new).and_return(mock_subtitle)
139
- @mock_subtitle.should_receive(:to_sub).and_return('subbb')
140
- Subwork.new.run!("file.srt", "sub")
142
+
143
+ it 'should not write if file exist' do
144
+ expect(File).to receive(:open).with('file.srt', 'r').and_return(mock_file)
145
+ expect(File).to receive(:exist?).and_return(true)
146
+
147
+ expect(STDOUT).to receive(:puts).with('Working on file file.srt...')
148
+ expect(STDOUT).to receive(:puts).with('File exist: file.sub'.red)
149
+
150
+ expect(Subtitle).to receive(:new).and_return(mock_subtitle)
151
+ expect(@mock_subtitle).to receive(:to_sub).and_return('subbb')
152
+ Subwork.new.run!('file.srt', 'sub')
141
153
  end
142
154
  end
@@ -1,5 +1,4 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- describe Formats, ".ass" do
4
-
5
- end
3
+ describe Formats, '.ass' do
4
+ end
@@ -1,45 +1,43 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- describe Formats, ".mpl" do
3
+ describe Formats, '.mpl' do
4
4
  include SubFixtures
5
- describe "In" do
6
-
5
+ describe 'In' do
7
6
  before(:each) do
8
- @mpl = Subtitle.new({:dump => mpl_fixture, :format => 'mpl'})
9
- end
7
+ @mpl = Subtitle.new(dump: mpl_fixture, format: 'mpl')
8
+ end
10
9
 
11
- it "should parse the sub to an array" do
12
- @mpl.lines.should be_instance_of(Array)
10
+ it 'should parse the sub to an array' do
11
+ expect(@mpl.lines).to be_instance_of(Array)
13
12
  end
14
-
15
- it "should have N lines" do
16
- @mpl.should have(12).lines
13
+
14
+ it 'should have N lines' do
15
+ expect(@mpl.lines.length).to eq(12)
17
16
  end
18
-
19
- it "should parse time of" do
20
- @mpl.lines[0].time_on.to_s.should eql("00:17:05.000")
17
+
18
+ it 'should parse time of' do
19
+ expect(@mpl.lines[0].time_on.to_s).to eql('00:17:05.000')
21
20
  end
22
-
23
- it "should parse time of" do
24
- @mpl.lines[0].time_off.to_s.should eql("00:18:35.000")
21
+
22
+ it 'should parse time of' do
23
+ expect(@mpl.lines[0].time_off.to_s).to eql('00:18:35.000')
25
24
  end
26
-
27
- it "should parse text" do
28
- @mpl.lines[0].text.should eql("You always say that.|The same thing every time.")
25
+
26
+ it 'should parse text' do
27
+ expect(@mpl.lines[0].text).to eql('You always say that.|The same thing every time.')
29
28
  end
30
29
  end
31
-
32
- describe "Out!" do
33
-
30
+
31
+ describe 'Out!' do
34
32
  before(:each) do
35
- @sub = Subtitle.new({:dump => yml_fixture, :format => 'yml'})
36
- end
37
-
38
- it "should dump the object as a SRT" do
39
- @sub.to_mpl.should eql("[3265][3285]worth killing for...
33
+ @sub = Subtitle.new(dump: yml_fixture, format: 'yml')
34
+ end
35
+
36
+ it 'should dump the object as a SRT' do
37
+ expect(@sub.to_mpl).to eql("[3265][3285]worth killing for...
40
38
  [3604][3634]worth dying for...
41
39
  [4203][4233]worth going to the hell for...
42
40
  [4203][4233]worth going a | line...\n")
43
41
  end
44
42
  end
45
- end
43
+ end
@@ -1,42 +1,41 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- describe Formats, ".rsb" do
3
+ describe Formats, '.rsb' do
4
4
  include SubFixtures
5
- describe "In" do
6
-
5
+ describe 'In' do
7
6
  before(:each) do
8
- @rsb = Subtitle.new({:dump => rsb_fixture, :format => 'rsb'})
9
- end
7
+ @rsb = Subtitle.new(dump: rsb_fixture, format: 'rsb')
8
+ end
9
+
10
+ it 'should parse the sub to an array' do
11
+ expect(@rsb.lines).to be_instance_of(Array)
12
+ end
10
13
 
11
- it "should parse the sub to an array" do
12
- @rsb.lines.should be_instance_of(Array)
14
+ it 'should have N lines' do
15
+ expect(@rsb.lines.length).to eq(3)
13
16
  end
14
-
15
- it "should have N lines" do
16
- @rsb.should have(3).lines
17
+
18
+ it 'should parse time of' do
19
+ expect(@rsb.lines[0].time_on.to_s).to eql('00:05:26.500')
17
20
  end
18
21
 
19
- it "should parse time of" do
20
- @rsb.lines[0].time_on.to_s.should eql("00:05:26.500")
22
+ it 'should parse time of' do
23
+ expect(@rsb.lines[0].time_off.to_s).to eql('00:05:28.500')
21
24
  end
22
-
23
- it "should parse time of" do
24
- @rsb.lines[0].time_off.to_s.should eql("00:05:28.500")
25
+
26
+ it 'should parse text' do
27
+ expect(@rsb.lines[0].text).to eql('worth killing for...')
25
28
  end
26
-
27
- it "should parse text" do
28
- @rsb.lines[0].text.should eql("worth killing for...")
29
- end
30
29
  end
31
-
32
- describe "Out" do
30
+
31
+ describe 'Out' do
33
32
  include SubFixtures
34
- before(:each) do
35
- @sub = Subtitle.new({:dump => yml_fixture, :format => 'yml'})
36
- end
37
-
38
- it "should dump the object to rsb" do
39
- @sub.to_rsb.should eql("- title: sincity\n- authors: \n- version: 1.1\n00:05:26.500 => 00:05:28.500 == worth killing for...\n00:06:00.400 => 00:06:03.400 == worth dying for...\n00:07:00.300 => 00:07:03.300 == worth going to the hell for...\n00:07:00.300 => 00:07:03.300 == worth going a | line...\n")
40
- end
41
- end
42
- end
33
+ before(:each) do
34
+ @sub = Subtitle.new(dump: yml_fixture, format: 'yml')
35
+ end
36
+
37
+ it 'should dump the object to rsb' do
38
+ expect(@sub.to_rsb).to eql("- title: sincity\n- authors: \n- version: 1.1\n00:05:26.500 => 00:05:28.500 == worth killing for...\n00:06:00.400 => 00:06:03.400 == worth dying for...\n00:07:00.300 => 00:07:03.300 == worth going to the hell for...\n00:07:00.300 => 00:07:03.300 == worth going a | line...\n")
39
+ end
40
+ end
41
+ end
@@ -1,42 +1,40 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- describe Formats, ".srt" do
3
+ describe Formats, '.srt' do
4
4
  include SubFixtures
5
- describe "In" do
6
-
5
+ describe 'In' do
7
6
  before(:each) do
8
- @srt = Subtitle.new({:dump => srt_fixture, :format => 'srt'})
9
- end
7
+ @srt = Subtitle.new(dump: srt_fixture, format: 'srt')
8
+ end
10
9
 
11
- it "should parse the sub to an array" do
12
- @srt.lines.should be_instance_of(Array)
10
+ it 'should parse the sub to an array' do
11
+ expect(@srt.lines).to be_instance_of(Array)
13
12
  end
14
-
15
- it "should have N lines" do
16
- @srt.should have(543).lines
13
+
14
+ it 'should have N lines' do
15
+ expect(@srt.lines.length).to eq(543)
17
16
  end
18
-
19
- it "should parse time of" do
20
- @srt.lines[0].time_on.to_s.should eql("00:01:43.680")
17
+
18
+ it 'should parse time of' do
19
+ expect(@srt.lines[0].time_on.to_s).to eql('00:01:43.680')
21
20
  end
22
-
23
- it "should parse time of" do
24
- @srt.lines[0].time_off.to_s.should eql("00:01:45.557")
21
+
22
+ it 'should parse time of' do
23
+ expect(@srt.lines[0].time_off.to_s).to eql('00:01:45.557')
25
24
  end
26
-
27
- it "should parse text" do
28
- @srt.lines[0].text.should eql("My dear children,")
25
+
26
+ it 'should parse text' do
27
+ expect(@srt.lines[0].text).to eql('My dear children,')
29
28
  end
30
29
  end
31
-
32
- describe "Out!" do
33
-
30
+
31
+ describe 'Out!' do
34
32
  before(:each) do
35
- @sub = Subtitle.new({:dump => yml_fixture, :format => 'yml'})
36
- end
37
-
38
- it "should dump the object as a SRT" do
39
- @sub.to_srt.should eql("1
33
+ @sub = Subtitle.new(dump: yml_fixture, format: 'yml')
34
+ end
35
+
36
+ it 'should dump the object as a SRT' do
37
+ expect(@sub.to_srt).to eql("1
40
38
  00:05:26,500 --> 00:05:28,500
41
39
  worth killing for...
42
40
 
@@ -50,8 +48,7 @@ worth going to the hell for...
50
48
 
51
49
  4
52
50
  00:07:00,300 --> 00:07:03,300
53
- worth going a
54
- line...\n")
51
+ worth going a \n line...\n")
55
52
  end
56
53
  end
57
- end
54
+ end
@@ -1,46 +1,44 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- describe Formats, ".sub" do
3
+ describe Formats, '.sub' do
4
4
  include SubFixtures
5
- describe "Parse" do
6
-
5
+ describe 'Parse' do
7
6
  before(:each) do
8
- @sub = Subtitle.new({:dump => sub_fixture, :format => 'sub'})
7
+ @sub = Subtitle.new(dump: sub_fixture, format: 'sub')
9
8
  end
10
9
 
11
- it "should parse the sub to an array" do
12
- @sub.lines.should be_instance_of(Array)
10
+ it 'should parse the sub to an array' do
11
+ expect(@sub.lines).to be_instance_of(Array)
13
12
  end
14
13
 
15
- it "should have N lines" do
16
- @sub.should have(2025).lines
14
+ it 'should have N lines' do
15
+ expect(@sub.lines.length).to eq(2025)
17
16
  end
18
17
 
19
- it "should have a nic text on" do
20
- @sub.lines[110].time_on.to_s.should eql('00:10:44.936')
18
+ it 'should have a nic text on' do
19
+ expect(@sub.lines[110].time_on.to_s).to eql('00:10:44.936')
21
20
  end
22
21
 
23
- it "should have a nice text out" do
24
- @sub.lines[110].time_off.to_s.should eql('00:10:49.941')
22
+ it 'should have a nice text out' do
23
+ expect(@sub.lines[110].time_off.to_s).to eql('00:10:49.941')
25
24
  end
26
25
 
27
- it "should parse the sentece correctly" do
28
- @sub.lines[0].text.should eql("You always say that.|The same thing every time.")
26
+ it 'should parse the sentece correctly' do
27
+ expect(@sub.lines[0].text).to eql('You always say that.|The same thing every time.')
29
28
  end
30
29
 
31
- it "should parse the sentece correctly" do
32
- @sub.lines[2020].text.should eql("I'm tryin' real hard...")
30
+ it 'should parse the sentece correctly' do
31
+ expect(@sub.lines[2020].text).to eql("I'm tryin' real hard...")
33
32
  end
34
33
  end
35
34
 
36
- describe "Out" do
37
-
35
+ describe 'Out' do
38
36
  before(:each) do
39
- @sub = Subtitle.new({:dump => yml_fixture, :format => 'yml'})
37
+ @sub = Subtitle.new(dump: yml_fixture, format: 'yml')
40
38
  end
41
39
 
42
- it "should dump the object as a SUB" do
43
- @sub.to_sub.should eql("{7816}{7864}worth killing for...
40
+ it 'should dump the object as a SUB' do
41
+ expect(@sub.to_sub).to eql("{7816}{7864}worth killing for...
44
42
  {8631}{8703}worth dying for...
45
43
  {10069}{10141}worth going to the hell for...
46
44
  {10069}{10141}worth going a | line...\n")
@@ -1,46 +1,46 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- describe Formats, ".xml" do
3
+ describe Formats, '.xml' do
4
4
  include SubFixtures
5
- describe "In" do
5
+ describe 'In' do
6
6
  before(:each) do
7
- @xml = Subtitle.new({:dump => xml_fixture, :format => 'xml'})
7
+ @xml = Subtitle.new(dump: xml_fixture, format: 'xml')
8
8
  end
9
9
 
10
- it "should parse the sub to an array" do
11
- @xml.lines.should be_instance_of(Array)
10
+ it 'should parse the sub to an array' do
11
+ expect(@xml.lines).to be_instance_of(Array)
12
12
  end
13
13
 
14
- it "should have N lines" do
15
- @xml.should have(13).lines
14
+ it 'should have N lines' do
15
+ expect(@xml.lines.length).to eq(13)
16
16
  end
17
17
 
18
- it "should parse time of" do
19
- @xml.lines[0].time_on.to_s.should eql("00:00:00.000")
20
- @xml.lines[10].time_on.to_s.should eql("00:00:25.520")
18
+ it 'should parse time of' do
19
+ expect(@xml.lines[0].time_on.to_s).to eql('00:00:00.000')
20
+ expect(@xml.lines[10].time_on.to_s).to eql('00:00:25.520')
21
21
  end
22
22
 
23
- it "should parse time of" do
24
- @xml.lines[0].time_off.to_s.should eql("00:00:03.700")
25
- @xml.lines[10].time_off.to_s.should eql("00:00:27.520")
23
+ it 'should parse time of' do
24
+ expect(@xml.lines[0].time_off.to_s).to eql('00:00:03.700')
25
+ expect(@xml.lines[10].time_off.to_s).to eql('00:00:27.520')
26
26
  end
27
27
 
28
- it "should parse text" do
29
- @xml.lines[0].text.should eql("I had just joined <span tts:fontFamily=\"monospaceSansSerif,proportionalSerif,TheOther\" tts:fontSize=\"+2\">Macromedia</span> in 1996,")
28
+ it 'should parse text' do
29
+ expect(@xml.lines[0].text).to eql("I had just joined <span tts:fontFamily=\"monospaceSansSerif,proportionalSerif,TheOther\" tts:fontSize=\"+2\">Macromedia</span> in 1996,")
30
30
  end
31
31
  end
32
32
 
33
- describe "Out" do
33
+ describe 'Out' do
34
34
  before(:each) do
35
- @sub = Subtitle.new({:dump => yml_fixture, :format => 'yml'})
35
+ @sub = Subtitle.new(dump: yml_fixture, format: 'yml')
36
36
  end
37
37
 
38
- it "should parse the sub to an array" do
39
- @sub.to_xml.should be_instance_of(String)
38
+ it 'should parse the sub to an array' do
39
+ expect(@sub.to_xml).to be_instance_of(String)
40
40
  end
41
41
 
42
- it "should equal..." do
43
- @sub.to_xml.should eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>
42
+ it 'should equal...' do
43
+ expect(@sub.to_xml).to eql("<?xml version=\"1.0\" encoding=\"UTF-8\"?>
44
44
  <tt xml:lang=\"en\" xmlns=\"http://www.w3.org/2006/10/ttaf1\" xmlns:tts=\"http://www.w3.org/2006/10/ttaf1#styling\">
45
45
  <head>
46
46
  <styling>