undertexter 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -0
- data/lib/undertexter/error.rb +20 -0
- data/lib/undertexter.rb +25 -17
- data/spec/fixtures/error.html +4252 -0
- data/spec/spec_helper.rb +7 -3
- data/spec/undertexter_spec.rb +15 -0
- data/undertexter.gemspec +3 -1
- metadata +20 -3
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require "
|
3
|
-
require "
|
1
|
+
require "rspec"
|
2
|
+
require "webmock/rspec"
|
3
|
+
require "undertexter"
|
4
|
+
require "subtitle"
|
5
|
+
require "undertexter/error"
|
6
|
+
|
7
|
+
WebMock.allow_net_connect!
|
4
8
|
|
5
9
|
RSpec.configure do |config|
|
6
10
|
config.mock_with :rspec
|
data/spec/undertexter_spec.rb
CHANGED
@@ -117,4 +117,19 @@ describe Undertexter, "should work when trying to fetch some english subtitles"
|
|
117
117
|
it "should return the right url when trying to fetch an swedish sub" do
|
118
118
|
Undertexter.find("tt0840361", :language => :swedish).first.url.should match(/http:\/\/undertexter\.se\/laddatext\.php\?id=\d+/i)
|
119
119
|
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "errors" do
|
123
|
+
before(:all) do
|
124
|
+
WebMock.disable_net_connect!
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should raise an error if the markup is changed" do
|
128
|
+
stub_request(:get, "http://www.undertexter.se/?p=soek&add=arkiv&str=tt0499549").to_return(:body => File.read("spec/fixtures/error.html"), :status => 200)
|
129
|
+
lambda { Undertexter.find("tt0499549") }.should raise_error(SourceHasBeenChangedError)
|
130
|
+
end
|
131
|
+
|
132
|
+
after(:all) do
|
133
|
+
WebMock.allow_net_connect!
|
134
|
+
end
|
120
135
|
end
|
data/undertexter.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "undertexter"
|
6
|
-
s.version = "0.1.
|
6
|
+
s.version = "0.1.7"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Linus Oleander"]
|
9
9
|
s.email = ["linus@oleander.nu"]
|
@@ -22,5 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency("nokogiri")
|
23
23
|
s.add_dependency("mimer_plus")
|
24
24
|
s.add_dependency("levenshteinish")
|
25
|
+
|
25
26
|
s.add_development_dependency("rspec", "2.4.0")
|
27
|
+
s.add_development_dependency("webmock")
|
26
28
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: undertexter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Linus Oleander
|
@@ -90,6 +90,20 @@ dependencies:
|
|
90
90
|
version: 2.4.0
|
91
91
|
type: :development
|
92
92
|
version_requirements: *id005
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: webmock
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
type: :development
|
106
|
+
version_requirements: *id006
|
93
107
|
description: A subtitle search client to search for swedish subtitles on undertexter.se
|
94
108
|
email:
|
95
109
|
- linus@oleander.nu
|
@@ -109,8 +123,10 @@ files:
|
|
109
123
|
- lib/subtitle.rb
|
110
124
|
- lib/undertexter.rb
|
111
125
|
- lib/undertexter/array.rb
|
126
|
+
- lib/undertexter/error.rb
|
112
127
|
- spec/array_spec.rb
|
113
128
|
- spec/data/127.Hours.2010.DVDSCR.XViD-MC8
|
129
|
+
- spec/fixtures/error.html
|
114
130
|
- spec/spec_helper.rb
|
115
131
|
- spec/subtitle_spec.rb
|
116
132
|
- spec/undertexter_spec.rb
|
@@ -152,6 +168,7 @@ summary: A subtitle search client for undertexter.se
|
|
152
168
|
test_files:
|
153
169
|
- spec/array_spec.rb
|
154
170
|
- spec/data/127.Hours.2010.DVDSCR.XViD-MC8
|
171
|
+
- spec/fixtures/error.html
|
155
172
|
- spec/spec_helper.rb
|
156
173
|
- spec/subtitle_spec.rb
|
157
174
|
- spec/undertexter_spec.rb
|