assets_booster 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/assets_booster/package/javascript.rb +1 -1
- data/lib/assets_booster/package/stylesheet.rb +1 -1
- data/lib/assets_booster/version.rb +1 -1
- data/lib/assets_booster/view_helper.rb +2 -2
- data/spec/package/javascript_spec.rb +21 -8
- data/spec/package/stylesheet_spec.rb +21 -8
- data/spec/spec_helper.rb +2 -0
- metadata +1 -1
@@ -15,21 +15,34 @@ module AssetsBooster
|
|
15
15
|
@view = double("View")
|
16
16
|
end
|
17
17
|
|
18
|
-
describe "with the inline option
|
18
|
+
describe "with the inline option" do
|
19
|
+
before do
|
20
|
+
@options = {:a => "b", :inline => true}
|
21
|
+
end
|
22
|
+
|
19
23
|
it "should return a javascript tag with inline javascript" do
|
20
|
-
subject.should_receive(:read).with()
|
21
|
-
@view.should_receive(:javascript_tag).
|
22
|
-
subject.view_helper(@view,
|
24
|
+
subject.should_receive(:read).with()
|
25
|
+
@view.should_receive(:javascript_tag).and_return("<script>javascript</script>")
|
26
|
+
subject.view_helper(@view, @options).should == "<script>javascript</script>"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should not pass the inline option to the tag generator" do
|
30
|
+
subject.should_receive(:read).and_return("js code")
|
31
|
+
@view.should_receive(:javascript_tag).with("js code", @options.except(:inline))
|
32
|
+
subject.view_helper(@view, @options)
|
23
33
|
end
|
24
34
|
end
|
25
35
|
|
26
|
-
describe "with no options" do
|
36
|
+
describe "with no special options" do
|
37
|
+
before do
|
38
|
+
@options = {:a => "b"}
|
39
|
+
end
|
40
|
+
|
27
41
|
it "should return html tags" do
|
28
|
-
options = {}
|
29
42
|
sources = ["source1.js", "source2.js"]
|
30
43
|
subject.should_receive(:view_helper_sources).and_return(sources)
|
31
|
-
@view.should_receive(:javascript_include_tag).with(sources, options)
|
32
|
-
subject.view_helper(@view, options)
|
44
|
+
@view.should_receive(:javascript_include_tag).with(sources, @options)
|
45
|
+
subject.view_helper(@view, @options)
|
33
46
|
end
|
34
47
|
end
|
35
48
|
end
|
@@ -15,21 +15,34 @@ module AssetsBooster
|
|
15
15
|
@view = double("View")
|
16
16
|
end
|
17
17
|
|
18
|
-
describe "with the inline option
|
18
|
+
describe "with the inline option" do
|
19
|
+
before do
|
20
|
+
@options = {:a => "b", :inline => true}
|
21
|
+
end
|
22
|
+
|
19
23
|
it "should return a style tag with inline css" do
|
20
|
-
subject.should_receive(:read).with()
|
21
|
-
@view.should_receive(:style_tag).
|
22
|
-
subject.view_helper(@view,
|
24
|
+
subject.should_receive(:read).with()
|
25
|
+
@view.should_receive(:style_tag).and_return("<style>css</style>")
|
26
|
+
subject.view_helper(@view, @options).should == "<style>css</style>"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should not pass the inline option to the tag generator" do
|
30
|
+
subject.should_receive(:read).and_return("css code")
|
31
|
+
@view.should_receive(:style_tag).with("css code", @options.except(:inline))
|
32
|
+
subject.view_helper(@view, @options)
|
23
33
|
end
|
24
34
|
end
|
25
35
|
|
26
|
-
describe "with no options" do
|
36
|
+
describe "with no special options" do
|
37
|
+
before do
|
38
|
+
@options = {:a => "b"}
|
39
|
+
end
|
40
|
+
|
27
41
|
it "should return html tags" do
|
28
|
-
options = {}
|
29
42
|
sources = ["source1.css", "source2.css"]
|
30
43
|
subject.should_receive(:view_helper_sources).and_return(sources)
|
31
|
-
@view.should_receive(:stylesheet_link_tag).with(sources, options)
|
32
|
-
subject.view_helper(@view, options)
|
44
|
+
@view.should_receive(:stylesheet_link_tag).with(sources, @options)
|
45
|
+
subject.view_helper(@view, @options)
|
33
46
|
end
|
34
47
|
end
|
35
48
|
end
|
data/spec/spec_helper.rb
CHANGED