From 6358405e3f15ac6fc7df30d877dd5cf8f585aef2 Mon Sep 17 00:00:00 2001 From: Aditya Sanghi Date: Sun, 10 Oct 2010 05:36:30 +0800 Subject: [PATCH] remove config[:pretend] as its just not right; fixed tests --- lib/thor/actions.rb | 2 +- lib/thor/actions/empty_directory.rb | 2 +- spec/actions_spec.rb | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/thor/actions.rb b/lib/thor/actions.rb index 7f93ab8a1..d982af5b8 100644 --- a/lib/thor/actions.rb +++ b/lib/thor/actions.rb @@ -158,7 +158,7 @@ def find_in_source_paths(file) # def inside(dir='', config={}, &block) verbose = config.fetch(:verbose, false) - pretend = options[:pretend] || config.fetch(:pretend, false) + pretend = options[:pretend] say_status :inside, dir, verbose shell.padding += 1 if verbose diff --git a/lib/thor/actions/empty_directory.rb b/lib/thor/actions/empty_directory.rb index e44d0598d..484cb820f 100644 --- a/lib/thor/actions/empty_directory.rb +++ b/lib/thor/actions/empty_directory.rb @@ -63,7 +63,7 @@ def revoke! # Shortcut for pretend. # def pretend? - base.options[:pretend] or config[:pretend] + base.options[:pretend] end # Sets the absolute destination value from a relative destination value. diff --git a/spec/actions_spec.rb b/spec/actions_spec.rb index 6e4dba0e3..d834e9339 100644 --- a/spec/actions_spec.rb +++ b/spec/actions_spec.rb @@ -142,11 +142,9 @@ def file end describe "when pretending" do - it "we should be able to step in and do more actions" do - runner.inside("bar", :pretend => true) do |dest| - Dir.pwd.must_not =~ /bar/ - dest.must =~ /bar/ - end + it "no directories should be created" do + runner.inside("bar", :pretend => true) {} + File.exists?("bar").must be_false end end