monet 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +7 -0
- data/Gemfile +1 -1
- data/lib/monet/baseless_image.rb +5 -1
- data/lib/monet/baseline_control.rb +30 -17
- data/lib/monet/capture.rb +28 -27
- data/lib/monet/capture_map.rb +11 -3
- data/lib/monet/changeset.rb +4 -0
- data/lib/monet/config.rb +18 -11
- data/lib/monet/image.rb +67 -0
- data/lib/monet/router.rb +71 -0
- data/lib/monet/tasks.rb +10 -7
- data/lib/monet/version.rb +1 -1
- data/lib/monet.rb +4 -29
- data/spec/capture_map_spec.rb +5 -50
- data/spec/capture_spec.rb +59 -33
- data/spec/cassettes/spider-config.yml +33784 -0
- data/spec/cassettes/spider-map.yml +33782 -0
- data/spec/config_spec.rb +14 -8
- data/spec/fixtures/baselines/lance.com/.DS_Store +0 -0
- data/spec/fixtures/baselines/lance.com/lance.com-1024-diff.png +0 -0
- data/spec/fixtures/baselines/lance.com/lance.com-1024.png +0 -0
- data/spec/fixtures/baselines/lance.com/lance.com|aboutus-1024.png +0 -0
- data/spec/fixtures/captures/lance.com/lance.com-1024.png +0 -0
- data/spec/fixtures/spider-config.yaml +8 -0
- data/spec/fixtures/thumbnails/lance.com/.DS_Store +0 -0
- data/spec/fixtures/thumbnails/lance.com/lance.com-1024.png +0 -0
- data/spec/image_spec.rb +36 -0
- data/spec/router_spec.rb +90 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/tmp/test.png +0 -0
- metadata +31 -7
- data/lib/monet/path_router.rb +0 -70
- data/spec/cassettes/spider.yml +0 -28572
- data/spec/path_router_spec.rb +0 -59
data/spec/path_router_spec.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'monet/path_router'
|
3
|
-
require 'monet/config'
|
4
|
-
|
5
|
-
describe Monet::PathRouter do
|
6
|
-
Given(:capture) { File.expand_path "./capture" }
|
7
|
-
Given(:baseline) { File.expand_path "./baseline" }
|
8
|
-
Given(:thumbnail) { File.expand_path "./thumbnail" }
|
9
|
-
Given(:config) { Monet::Config.new(base_url: "http://google.com", capture_dir: "./capture", baseline_dir: "./baseline", thumbnail_dir: "./thumbnail") }
|
10
|
-
Given(:router) { Monet::PathRouter.new(config) }
|
11
|
-
|
12
|
-
context "knows base dir" do
|
13
|
-
When(:path) { router.root_dir }
|
14
|
-
Then { path.should == "google.com" }
|
15
|
-
end
|
16
|
-
|
17
|
-
context "build url from path" do
|
18
|
-
When(:url) { router.build_url("/space/manager") }
|
19
|
-
Then { url.should == "http://google.com/space/manager" }
|
20
|
-
end
|
21
|
-
|
22
|
-
context "full url to path" do
|
23
|
-
When(:path) { router.route_url("http://google.com/space/manager", 900) }
|
24
|
-
Then { path.should == "#{capture}/google.com/google.com|space|manager-900.png" }
|
25
|
-
end
|
26
|
-
|
27
|
-
context "url path to path" do
|
28
|
-
When(:path) { router.route_url_path("/space/manager", 900) }
|
29
|
-
Then { path.should == "#{capture}/google.com/google.com|space|manager-900.png"}
|
30
|
-
end
|
31
|
-
|
32
|
-
context "path to url" do
|
33
|
-
When(:url) { router.route_path("#{capture}/google.com/google.com|space|manager-900.png") }
|
34
|
-
Then { url.should == "http://google.com/space/manager" }
|
35
|
-
end
|
36
|
-
|
37
|
-
context "path to baseline from url" do
|
38
|
-
When(:path) { router.url_to_baseline("http://google.com/space/manager", 900) }
|
39
|
-
Then { path.should == "#{baseline}/google.com/google.com|space|manager-900.png" }
|
40
|
-
end
|
41
|
-
|
42
|
-
context "path to baseline from path" do
|
43
|
-
When(:path) { router.url_path_to_baseline("/space/manager", 900) }
|
44
|
-
Then { path.should == "#{baseline}/google.com/google.com|space|manager-900.png" }
|
45
|
-
end
|
46
|
-
|
47
|
-
context "capture path to baseline path" do
|
48
|
-
When(:path) { router.capture_to_baseline("#{capture}/google.com/google.com|space|manager-900.png") }
|
49
|
-
Then { path.should == "#{baseline}/google.com/google.com|space|manager-900.png" }
|
50
|
-
end
|
51
|
-
|
52
|
-
context "can create thumbnail path" do
|
53
|
-
When(:path) { router.to_thumbnail_path("#{capture}/google.com/google.com|space|manager-900.png") }
|
54
|
-
Then { path.should == "#{thumbnail}/google.com/google.com|space|manager-900.png" }
|
55
|
-
|
56
|
-
When(:path) { router.to_thumbnail_path("#{baseline}/google.com/google.com|space|manager-900.png") }
|
57
|
-
Then { path.should == "#{thumbnail}/google.com/google.com|space|manager-900.png" }
|
58
|
-
end
|
59
|
-
end
|