spec/static_assets_spec.rb in sinatra-exstatic-assets-2.0.0 vs spec/static_assets_spec.rb in sinatra-exstatic-assets-2.0.1
- old
+ new
@@ -20,11 +20,12 @@
its(:fullpath) { should == fullpath }
its(:timestamp) { should == Time.now.to_i }
its(:"is_uri?") { should be_false }
its(:querystring) { should == "?ts=#{Time.now.to_i}" }
end
- context "Given a url" do let(:filename) { "http://code.jquery.com/jquery-1.9.1.min.js" }
+ context "Given a url" do
+ let(:filename) { "http://code.jquery.com/jquery-1.9.1.min.js" }
let(:expected) { "http://code.jquery.com/jquery-1.9.1.min.js" }
it { should_not be_nil }
it { should == expected }
its(:fullpath) { should be_nil }
its(:timestamp) { should == false }
@@ -109,15 +110,28 @@
subject { o.send :sss_javascript_tag, url }
it { should_not be_nil }
it { should == expected }
end
context "Images" do
- let(:url) { "/images/foo.png" }
- let(:filename) { "/images/foo.png" }
- let(:expected) { %Q!<img src="/bar/images/foo.png?ts=#{time}" />! }
- subject { o.send :sss_image_tag, url }
- it { should_not be_nil }
- it { should == expected }
+ context "Local" do
+ let(:url) { "/images/foo.png" }
+ let(:filename) { "/images/foo.png" }
+ let(:expected) { %Q!<img src="/bar/images/foo.png?ts=#{time}" />! }
+ subject { o.send :sss_image_tag, url }
+ it { should_not be_nil }
+ it { should == expected }
+ end
+ context "Remote" do
+ let(:url) { "http://example.org/images/foo.png" }
+ let(:filename) { "/images/foo.png" }
+ let(:expected) { %Q!<img src="#{url}" />! }
+ subject {
+ o.send :sss_image_tag,
+ url
+ }
+ it { should_not be_nil }
+ it { should == expected }
+ end
end
end
end # Exstatic
end # Sinatra
\ No newline at end of file