doc_juan 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/doc_juan/url_generator.rb +1 -1
- data/lib/doc_juan/version.rb +1 -1
- data/spec/url_generator_spec.rb +18 -3
- metadata +1 -7
@@ -24,7 +24,7 @@ module DocJuan
|
|
24
24
|
params << "url=#{CGI.escape(url)}"
|
25
25
|
params << "filename=#{CGI.escape(filename)}"
|
26
26
|
options.each do |k,v|
|
27
|
-
params << "options[#{CGI.escape(k.to_s)}]=#{CGI.escape v}"
|
27
|
+
params << "options[#{CGI.escape(k.to_s)}]=#{CGI.escape v.to_s}"
|
28
28
|
end
|
29
29
|
params << "key=#{public_key}"
|
30
30
|
|
data/lib/doc_juan/version.rb
CHANGED
data/spec/url_generator_spec.rb
CHANGED
@@ -12,7 +12,8 @@ describe DocJuan::UrlGenerator do
|
|
12
12
|
subject do
|
13
13
|
DocJuan::UrlGenerator.new('http://example.com', 'file.pdf', {
|
14
14
|
title: 'The Site',
|
15
|
-
size: 'A4'
|
15
|
+
size: 'A4',
|
16
|
+
print_stylesheet: true
|
16
17
|
})
|
17
18
|
end
|
18
19
|
|
@@ -22,6 +23,7 @@ describe DocJuan::UrlGenerator do
|
|
22
23
|
expected = 'http://doc-juan.example.com/render?'
|
23
24
|
expected << "url=#{CGI.escape subject.url}"
|
24
25
|
expected << "&filename=#{CGI.escape subject.filename}"
|
26
|
+
expected << "&options[print_stylesheet]=true"
|
25
27
|
expected << "&options[size]=A4"
|
26
28
|
expected << "&options[title]=#{CGI.escape 'The Site'}"
|
27
29
|
expected << "&key=#{subject.public_key}"
|
@@ -29,6 +31,19 @@ describe DocJuan::UrlGenerator do
|
|
29
31
|
url.must_equal expected
|
30
32
|
end
|
31
33
|
|
34
|
+
it 'generates the url with no options' do
|
35
|
+
subject.stubs(:options).returns Hash.new
|
36
|
+
url = subject.generate
|
37
|
+
|
38
|
+
expected = 'http://doc-juan.example.com/render?'
|
39
|
+
expected << "url=#{CGI.escape subject.url}"
|
40
|
+
expected << "&filename=#{CGI.escape subject.filename}"
|
41
|
+
expected << "&key=#{subject.public_key}"
|
42
|
+
|
43
|
+
url.must_equal expected
|
44
|
+
end
|
45
|
+
|
46
|
+
|
32
47
|
it 'has the host' do
|
33
48
|
DocJuan.config.host = 'example.com'
|
34
49
|
|
@@ -56,11 +71,11 @@ describe DocJuan::UrlGenerator do
|
|
56
71
|
end
|
57
72
|
|
58
73
|
it 'compiles into a seed string for the public key computation' do
|
59
|
-
subject.seed_string.must_equal 'filename:file.pdf-options_size:A4-options_title:The Site-url:http://example.com'
|
74
|
+
subject.seed_string.must_equal 'filename:file.pdf-options_print_stylesheet:true-options_size:A4-options_title:The Site-url:http://example.com'
|
60
75
|
end
|
61
76
|
|
62
77
|
it 'calculates the public key' do
|
63
|
-
subject.public_key.must_equal '
|
78
|
+
subject.public_key.must_equal 'b55142f9fdb148e8844e37e064e8eb2af6aabac6'
|
64
79
|
end
|
65
80
|
|
66
81
|
it 'calculates the public key with no options given' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doc_juan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -45,18 +45,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
45
|
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
|
-
segments:
|
49
|
-
- 0
|
50
|
-
hash: -3357457256720695940
|
51
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
49
|
none: false
|
53
50
|
requirements:
|
54
51
|
- - ! '>='
|
55
52
|
- !ruby/object:Gem::Version
|
56
53
|
version: '0'
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
hash: -3357457256720695940
|
60
54
|
requirements: []
|
61
55
|
rubyforge_project:
|
62
56
|
rubygems_version: 1.8.10
|