Skip to content

Commit

Permalink
Rails.root is a Pathname, not a String
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Macreery committed Jun 29, 2013
1 parent cf1cda4 commit 7402701
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Next Release (TBD)
------------------

0.4.2 (6/28/2013)
-----------------
* Fixed `Caller` strategy when using Rails.

0.4.1 (6/28/2013)
-----------------
* Added a `rake benchmark` task to compare different binding key/invalidation strategy pairs.
Expand Down
4 changes: 2 additions & 2 deletions garner.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = "garner"
s.version = "0.4.1"
s.version = "0.4.2"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Daniel Doubrovkine", "Frank Macreery"]
s.date = "2013-06-28"
s.date = "2013-06-29"
s.description = "Garner is a cache layer for Ruby and Rack applications, supporting model and instance binding and hierarchical invalidation."
s.email = "[email protected]"
s.extra_rdoc_files = [
Expand Down
2 changes: 1 addition & 1 deletion lib/garner/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def caller_root
#
# @return [String] The newly set caller_root.
def caller_root=(caller_root)
settings[:caller_root] = caller_root
settings[:caller_root] = caller_root && caller_root.to_s
end

# Reset the configuration options to the defaults.
Expand Down
2 changes: 1 addition & 1 deletion lib/garner/strategies/context/key/caller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.field
# @return [String] The default root path.
def self.default_root
if defined?(::Rails) && ::Rails.respond_to?(:root)
::Rails.root
::Rails.root.realpath.to_s
else
# Try to use the nearest ancestor directory containing a Gemfile.
requiring_caller = send(:caller).detect do |line|
Expand Down
2 changes: 1 addition & 1 deletion lib/garner/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Garner
VERSION = "0.4.1"
VERSION = "0.4.2"
end
6 changes: 3 additions & 3 deletions spec/garner/strategies/context/key/caller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
before(:each) do
class ::Rails
end
::Rails.stub(:root) { File.dirname(__FILE__) }
::Rails.stub(:root) { Pathname.new(File.dirname(__FILE__)) }
end

it "sets default_root to Rails.root" do
subject.default_root.should == ::Rails.root
subject.default_root.should == ::Rails.root.realpath.to_s
end

it "sets Garner.config.caller_root to Rails.root" do
Garner.config.caller_root.should == ::Rails.root
Garner.config.caller_root.should == ::Rails.root.realpath.to_s
end

it "sets an appropriate value for :caller" do
Expand Down

0 comments on commit 7402701

Please sign in to comment.