Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fixes public root bug with Jammit 0.6.5 #85

Merged
merged 1 commit into from about 2 years ago

2 participants

Vesa Vänskä Gabe Berke-Williams
Vesa Vänskä

The way Jammit defines the public root was changed in
documentcloud/jammit@b6ff4f0

This patch handles both the new and old implementation.

Vesa Vänskä Fixes public root bug with Jammit 0.6.5
The way Jammit defines the public root was changed in
documentcloud/jammit@b6ff4f0
ec63310
Gabe Berke-Williams gabebw commented on the diff February 01, 2012
spec/kumade/packagers/jammit_packager_spec.rb
@@ -7,7 +7,8 @@
7 7
 
8 8
   it_should_behave_like "packager"
9 9
 
10  
-  its(:assets_path) { should == File.join(Jammit::PUBLIC_ROOT, Jammit.package_path) }
  10
+  let(:jammit_public_root) { defined?(Jammit.public_root) ? Jammit.public_root : Jammit::PUBLIC_ROOT }
  11
+  its(:assets_path) { should == File.join(jammit_public_root, Jammit.package_path) }
1
Gabe Berke-Williams Collaborator
gabebw added a note February 01, 2012

Could you rewrite this so that jammit_public_root isn't a global (within the describe block) variable? Something like this:

it "has the correct asset path" do
  jammit_public_root = defined?(Jammit.public_root) ? Jammit.public_root : Jammit::PUBLIC_ROOT
  subject.assets_path.should == File.join(jammit_public_root, Jammit.package_path)
end

That way it's clear that only one test is using the variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Gabe Berke-Williams
Collaborator

Thanks for fixing this! Just one comment, then you'll be good to merge.

Gabe Berke-Williams
Collaborator

Actually, I'm going to merge this anyway.

Gabe Berke-Williams gabebw merged commit a3bd6af into from February 02, 2012
Gabe Berke-Williams gabebw closed this February 02, 2012
Gabe Berke-Williams gabebw referenced this pull request February 02, 2012
Closed

Get to green #86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 28, 2012
Vesa Vänskä Fixes public root bug with Jammit 0.6.5
The way Jammit defines the public root was changed in
documentcloud/jammit@b6ff4f0
ec63310
This page is out of date. Refresh to see the latest.
8  lib/kumade/packagers/jammit_packager.rb
@@ -6,7 +6,7 @@
6 6
 module Kumade
7 7
   class JammitPackager
8 8
     def self.assets_path
9  
-      File.join(Jammit::PUBLIC_ROOT, Jammit.package_path)
  9
+      File.join(public_root, Jammit.package_path)
10 10
     end
11 11
 
12 12
     def self.installed?
@@ -16,5 +16,11 @@ def self.installed?
16 16
     def self.package
17 17
       Jammit.package!
18 18
     end
  19
+
  20
+    private
  21
+
  22
+    def self.public_root
  23
+      defined?(Jammit.public_root) ? Jammit.public_root : Jammit::PUBLIC_ROOT
  24
+    end
19 25
   end
20 26
 end
3  spec/kumade/packagers/jammit_packager_spec.rb
@@ -7,7 +7,8 @@
7 7
 
8 8
   it_should_behave_like "packager"
9 9
 
10  
-  its(:assets_path) { should == File.join(Jammit::PUBLIC_ROOT, Jammit.package_path) }
  10
+  let(:jammit_public_root) { defined?(Jammit.public_root) ? Jammit.public_root : Jammit::PUBLIC_ROOT }
  11
+  its(:assets_path) { should == File.join(jammit_public_root, Jammit.package_path) }
11 12
 
12 13
   it "knows how to package itself" do
13 14
     ::Jammit.stubs(:package!)
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.