adamh-asset_library 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ Next, add the gem into your Rails project's config/environment.rb:
15
15
 
16
16
  Finally, include the Rake tasks in your project:
17
17
 
18
- echo "require 'asset_library/rake_tasks'" > lib/tasks/asset_library.rake
18
+ echo "begin; require 'asset_library/rake_tasks'; rescue LoadError; end" > lib/tasks/asset_library.rake
19
19
 
20
20
  == Usage
21
21
 
@@ -43,6 +43,8 @@ class AssetLibrary
43
43
  def absolute_url(relative_url)
44
44
  host = helper.__send__(:compute_asset_host, relative_url) if helper.respond_to?(:compute_asset_host, true)
45
45
 
46
+ host = nil if host == '' # Rails sets '' by default
47
+
46
48
  if host && !(host =~ %r{^[-a-z]+://})
47
49
  controller = helper.instance_variable_get(:@controller)
48
50
  request = controller && controller.respond_to?(:request) && controller.request
@@ -56,6 +56,20 @@ describe(AssetLibrary::Helpers) do
56
56
  h.asset_library_javascript_tags(:m).should =~ %r{"http://assets.test/f.js\?123"}
57
57
  end
58
58
 
59
+ it('should not use compute_asset_host if it returns nil') do
60
+ m = mock(:assets => [a('/f.js')])
61
+ AssetLibrary.stub!(:asset_module).and_return(m)
62
+ h.should_receive(:compute_asset_host).and_return(nil)
63
+ h.asset_library_javascript_tags(:m).should =~ %r{"/f.js\?123"}
64
+ end
65
+
66
+ it('should not use compute_asset_host if it returns ""') do
67
+ m = mock(:assets => [a('/f.js')])
68
+ AssetLibrary.stub!(:asset_module).and_return(m)
69
+ h.should_receive(:compute_asset_host).and_return("")
70
+ h.asset_library_javascript_tags(:m).should =~ %r{"/f.js\?123"}
71
+ end
72
+
59
73
  it('should add request protocol to compute_asset_host output if applicable') do
60
74
  m = mock(:assets => [a('/f.js')])
61
75
  AssetLibrary.stub!(:asset_module).and_return(m)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adamh-asset_library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - adamh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-24 00:00:00 -07:00
12
+ date: 2009-08-26 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -41,7 +41,6 @@ files:
41
41
  - README.rdoc
42
42
  has_rdoc: true
43
43
  homepage: http://github.com/adamh/asset_library
44
- licenses:
45
44
  post_install_message:
46
45
  rdoc_options:
47
46
  - --charset=UTF-8
@@ -62,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
61
  requirements: []
63
62
 
64
63
  rubyforge_project:
65
- rubygems_version: 1.3.5
64
+ rubygems_version: 1.2.0
66
65
  signing_key:
67
66
  specification_version: 2
68
67
  summary: Manage and bundle CSS and JavaScript files