Hi,
I starting a new project, and have run into behavior I cannot
replicate in irb, (i.e. outside of using rspec) when the directory?
returns true, so I thought I'd ask here, in case any one has seen this
badhavior.
ruby-1.9.2-p136
rspec (2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
rspec-mocks (2.5.0)

When I try to run this spec:

require Pathname(__FILE__).ascend { |d| h=d+'spec_helper.rb'; break h
if h.file? }
describe B3::Bdd do
  it "should indicate RVM is installed locally" do
    B3::Bdd::Helpers.rvm_local_install?.should be_true
  end
end

The spec helper is: require 'rspec' ; require_relative '../lib/b3'

Which describes this code:

class B3
  module Bdd
    module Helpers
      def rvm_local_install?
        puts ENV['rvm_path']
        rvm_path = Pathname.new(ENV['rvm_path'] || '~/.rvm')
        rvm_path.dirname.realpath.directory?
      end
      module_function :rvm_local_install?
    end
  end
end


I get this error:

https://gist.github.com/853798

irb version:

$ irb
ruby-1.9.2-p136 :001 > require 'pathname';
ruby-1.9.2-p136 :002 >
Dir.chdir('/home/hedge/Documents/Workspaces/b3/spec/b3/') do
ruby-1.9.2-p136 :003 >     pn=Pathname.new(ENV['rvm_path'] || '~/.rvm')
ruby-1.9.2-p136 :004?>   puts pn.dirname.realpath.directory?
ruby-1.9.2-p136 :005?>   end
true
 => nil
ruby-1.9.2-p136 :006 > pn2=Pathname.new(ENV['rvm_path'] || '~/.rvm')
 => #<Pathname:/home/hedge/.rvm>
ruby-1.9.2-p136 :007 > puts pn2.dirname.realpath.directory?
true
 => nil

I'd appreciate any comments or insights.

-- 
πόλλ' οἶδ ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
  Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://wiki.hedgehogshiatus.com
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to