wadling 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wadling/version.rb +1 -1
- data/lib/wadling.rb +7 -1
- data/spec/lib/wadling/wadling_spec.rb +12 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2da58b02a22f880d6f31203d7a00d8d3f9c64fd
|
4
|
+
data.tar.gz: b2fdffaa21df7501b320db5f9c07d52402ed718a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edbf4e9ed10b1ec8901ad799ed075385836078b59062908e434a23ee7a45eda75963ee0a1a492cd4a6ad2ceac833d731a6ad3914fd0bdb77afed1342cfcaa334
|
7
|
+
data.tar.gz: 1a7c0a68e0a9759e7e36d2e907add99e2636b467c59023390d26ff378b25a1ad0f26b182b57ca03190da026f0e1d8cb2fb62bfa7d3a548a8de3a6511fa93c484
|
data/lib/wadling/version.rb
CHANGED
data/lib/wadling.rb
CHANGED
@@ -3,6 +3,12 @@ require 'byebug'
|
|
3
3
|
|
4
4
|
module Wadling
|
5
5
|
class LexiconTranslator
|
6
|
+
attr_accessor :style_sheet
|
7
|
+
|
8
|
+
def initialize(style_sheet = "/public/wadl")
|
9
|
+
@style_sheet = style_sheet
|
10
|
+
end
|
11
|
+
|
6
12
|
def translate_resources_into_wadl(resources)
|
7
13
|
return empty_wadl if no_resources?(resources)
|
8
14
|
raise ArgumentError.new("A resource dictionary is expected") if resources_invalid?(resources)
|
@@ -11,7 +17,7 @@ module Wadling
|
|
11
17
|
|
12
18
|
def header
|
13
19
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
|
14
|
-
"<?xml-stylesheet type=\"text/xsl\" href=\"
|
20
|
+
"<?xml-stylesheet type=\"text/xsl\" href=\"#{@style_sheet}\"?>" \
|
15
21
|
"<wadl:application xmlns:wadl=\"http://wadl.dev.java.net/2009/02\"" \
|
16
22
|
" xmlns:jr=\"http://jasperreports.sourceforge.net/xsd/jasperreport.xsd\"" \
|
17
23
|
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://wadl.dev.java.net/2009/02 wadl.xsd \">"
|
@@ -7,7 +7,7 @@ describe Wadling do
|
|
7
7
|
|
8
8
|
before :all do
|
9
9
|
@iut = Wadling::LexiconTranslator.new
|
10
|
-
@wadl_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><?xml-stylesheet type=\"text/xsl\" href=\"public/wadl\"?><wadl:application xmlns:wadl=\"http://wadl.dev.java.net/2009/02\" xmlns:jr=\"http://jasperreports.sourceforge.net/xsd/jasperreport.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://wadl.dev.java.net/2009/02 wadl.xsd \"><wadl:resources base=\"/\">"
|
10
|
+
@wadl_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><?xml-stylesheet type=\"text/xsl\" href=\"/public/wadl\"?><wadl:application xmlns:wadl=\"http://wadl.dev.java.net/2009/02\" xmlns:jr=\"http://jasperreports.sourceforge.net/xsd/jasperreport.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://wadl.dev.java.net/2009/02 wadl.xsd \"><wadl:resources base=\"/\">"
|
11
11
|
@wadl_footer = "</wadl:resources>" \
|
12
12
|
"</wadl:application>"
|
13
13
|
@empty_wadl = @wadl_header + @wadl_footer
|
@@ -60,6 +60,17 @@ describe Wadling do
|
|
60
60
|
@wadl2 = @wadl_header + @resource1_wadl + @resource2_wadl + @wadl_footer
|
61
61
|
end
|
62
62
|
|
63
|
+
context "when initialize" do
|
64
|
+
it "should default to /public/wadl for the stylesheet if none is provided" do
|
65
|
+
expect(@iut.style_sheet).to eq("/public/wadl")
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should remember the stylesheet is one is provided" do
|
69
|
+
iut = Wadling::LexiconTranslator.new("/some/stylesheet")
|
70
|
+
expect(iut.style_sheet).to eq("/some/stylesheet")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
63
74
|
context "when given nil" do
|
64
75
|
it "should return an empty WADL descriptor" do
|
65
76
|
expect(@iut.translate_resources_into_wadl(nil)).to eq(@empty_wadl)
|