Skip to content

Commit

Permalink
remove config[:pretend] as its just not right; fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Sanghi authored and josevalim committed Oct 27, 2010
1 parent e519057 commit 6358405
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/thor/actions.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/thor/actions/empty_directory.rb
Expand Up @@ -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.
Expand Down
8 changes: 3 additions & 5 deletions spec/actions_spec.rb
Expand Up @@ -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

Expand Down

0 comments on commit 6358405

Please sign in to comment.