monet 0.2.3 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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