web_update_checker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile +7 -0
- data/lib/web_update_checker.rb +38 -55
- data/lib/web_update_checker/version.rb +1 -1
- data/spec/spec_helper.rb +7 -0
- data/spec/vcr/http/hogehoge.yml +66 -0
- data/spec/vcr/http/yahoo.yml +963 -0
- data/spec/web_update_checker_spec.rb +33 -41
- data/web_update_checker.gemspec +2 -4
- metadata +14 -38
@@ -2,72 +2,64 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe WebUpdateChecker do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
WebUpdateChecker::Checker.new(@url).cleanup
|
8
|
-
end
|
9
|
-
|
10
|
-
before(:each) do
|
5
|
+
let(:url) { 'http://example.com/' }
|
6
|
+
let(:regex) { /<h1>(.*)<\/h1>/ }
|
11
7
|
|
12
|
-
|
8
|
+
before do
|
9
|
+
WebUpdateChecker::Checker.new(url).cleanup
|
10
|
+
end
|
13
11
|
|
14
|
-
|
12
|
+
let(:mail) do
|
13
|
+
mail = Mail.new do
|
15
14
|
from 'TODO@example.com'
|
16
15
|
to 'TODO@example.com'
|
17
16
|
subject 'Web site is updated!'
|
18
|
-
body
|
17
|
+
body url
|
19
18
|
end
|
20
19
|
|
21
|
-
|
20
|
+
mail.delivery_method :smtp, {
|
22
21
|
address: 'localhost',
|
23
22
|
port: 25,
|
24
|
-
|
25
|
-
# address: 'smtp.gmail.com',
|
26
|
-
# port: 587,
|
27
|
-
# user_name: '<TODO>',
|
28
|
-
# password: '<TODO>',
|
29
|
-
# authentication: 'plain',
|
30
|
-
# enable_starttls_auto: true
|
31
23
|
}
|
32
24
|
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should have a version number' do
|
38
|
-
WebUpdateChecker::VERSION.should_not be_nil
|
39
25
|
end
|
40
26
|
|
41
|
-
it 'should initialize temporary file' do
|
42
|
-
|
43
|
-
WebUpdateChecker::Checker.new(@url).execute.should be_nil
|
44
27
|
|
28
|
+
it 'should have a version number' do
|
29
|
+
expect(WebUpdateChecker::VERSION).to_not be_nil
|
45
30
|
end
|
46
31
|
|
32
|
+
context 'first and second' do
|
33
|
+
it 'should initialize temporary file' do
|
34
|
+
VCR.use_cassette 'http/hogehoge' do
|
35
|
+
expect(WebUpdateChecker::Checker.new(url).execute).to be_nil
|
36
|
+
end
|
37
|
+
end
|
47
38
|
|
48
|
-
it 'should be return as same contents' do
|
49
|
-
|
50
|
-
WebUpdateChecker::Checker.new(@url).execute.should be_falsey
|
51
39
|
|
40
|
+
it 'should be return as same contents' do
|
41
|
+
VCR.use_cassette 'http/hogehoge' do
|
42
|
+
expect(WebUpdateChecker::Checker.new(url).execute).to be_falsey
|
43
|
+
end
|
44
|
+
end
|
52
45
|
end
|
53
46
|
|
54
47
|
|
55
48
|
it 'should be return as different contents' do
|
56
49
|
|
57
|
-
|
58
|
-
|
50
|
+
VCR.use_cassette 'http/yahoo' do
|
51
|
+
url = 'http://www.yahoo.co.jp/'
|
52
|
+
expect(WebUpdateChecker::Checker.new(url).execute).to be_falsey
|
53
|
+
expect(WebUpdateChecker::Checker.new(url).execute).to be_truthy
|
54
|
+
end
|
59
55
|
|
60
56
|
end
|
61
57
|
|
62
|
-
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
|
70
|
-
after(:all) do
|
71
|
-
end
|
58
|
+
# it 'should be send a notification mail' do
|
59
|
+
#
|
60
|
+
# WebUpdateChecker::Checker.new(url, regex, mail).execute.should be_true
|
61
|
+
#
|
62
|
+
# end
|
63
|
+
#
|
72
64
|
|
73
65
|
end
|
data/web_update_checker.gemspec
CHANGED
@@ -18,8 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler"
|
22
|
-
spec.add_development_dependency "
|
23
|
-
spec.add_development_dependency "rspec", "~> 2.0"
|
24
|
-
spec.add_development_dependency "mail", "~> 2.3"
|
21
|
+
spec.add_development_dependency "bundler"
|
22
|
+
spec.add_development_dependency "mail"
|
25
23
|
end
|
metadata
CHANGED
@@ -1,71 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_update_checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Matsukura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.9'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.9'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '2.0'
|
26
|
+
version: '0'
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
28
|
name: mail
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
|
-
- - "
|
31
|
+
- - ">="
|
60
32
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
33
|
+
version: '0'
|
62
34
|
type: :development
|
63
35
|
prerelease: false
|
64
36
|
version_requirements: !ruby/object:Gem::Requirement
|
65
37
|
requirements:
|
66
|
-
- - "
|
38
|
+
- - ">="
|
67
39
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
40
|
+
version: '0'
|
69
41
|
description: 'First time of execution, this library get the specifified URL and preserve
|
70
42
|
the result. After the 2nd time, compare the current page contents and previous contents. '
|
71
43
|
email:
|
@@ -84,6 +56,8 @@ files:
|
|
84
56
|
- lib/web_update_checker.rb
|
85
57
|
- lib/web_update_checker/version.rb
|
86
58
|
- spec/spec_helper.rb
|
59
|
+
- spec/vcr/http/hogehoge.yml
|
60
|
+
- spec/vcr/http/yahoo.yml
|
87
61
|
- spec/web_update_checker_spec.rb
|
88
62
|
- web_update_checker.gemspec
|
89
63
|
homepage: http://github.com/matsubo/web_update_checker
|
@@ -112,5 +86,7 @@ specification_version: 4
|
|
112
86
|
summary: Check the web page is changed comparing to the previous time.
|
113
87
|
test_files:
|
114
88
|
- spec/spec_helper.rb
|
89
|
+
- spec/vcr/http/hogehoge.yml
|
90
|
+
- spec/vcr/http/yahoo.yml
|
115
91
|
- spec/web_update_checker_spec.rb
|
116
92
|
has_rdoc:
|