Skip to content

Commit

Permalink
Directify specs for save-file and cat
Browse files Browse the repository at this point in the history
  • Loading branch information
rf- committed Aug 19, 2012
1 parent 699c3aa commit f4c3ada
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 142 deletions.
1 change: 0 additions & 1 deletion lib/pry/code.rb
Expand Up @@ -36,7 +36,6 @@ class << self
# @param [Symbol] code_type The type of code the file contains. # @param [Symbol] code_type The type of code the file contains.
# @return [Code] # @return [Code]
def from_file(fn, code_type=type_from_filename(fn)) def from_file(fn, code_type=type_from_filename(fn))

if fn == Pry.eval_path if fn == Pry.eval_path
new(Pry.line_buffer.drop(1), 1, code_type) new(Pry.line_buffer.drop(1), 1, code_type)
else else
Expand Down
1 change: 1 addition & 0 deletions lib/pry/pry_instance.rb
Expand Up @@ -426,6 +426,7 @@ def retrieve_line(eval_string, target)
# @param [Binding] target The target of the Pry session. # @param [Binding] target The target of the Pry session.
# @return [Boolean] `true` if `val` is a command, `false` otherwise # @return [Boolean] `true` if `val` is a command, `false` otherwise
def process_command(val, eval_string = '', target = binding_stack.last) def process_command(val, eval_string = '', target = binding_stack.last)
val = val.chomp
result = commands.process_line(val, { result = commands.process_line(val, {
:target => target, :target => target,
:output => output, :output => output,
Expand Down
1 change: 1 addition & 0 deletions test/helper.rb
Expand Up @@ -230,6 +230,7 @@ def eval(*strs)
result = nil result = nil


strs.flatten.each do |str| strs.flatten.each do |str|
str = "#{str}\n" unless str.end_with?("\n")
if @pry.process_command(str) if @pry.process_command(str)
result = last_command_result_or_output result = last_command_result_or_output
else else
Expand Down
2 changes: 1 addition & 1 deletion test/test_default_commands/test_introspection.rb
Expand Up @@ -268,7 +268,7 @@ def last_exception=(exception)
end end


it "should edit a range of lines if a range is given" do it "should edit a range of lines if a range is given" do
pry_eval "10\n", "11\n", "edit -i 1,2" pry_eval "10", "11", "edit -i 1,2"
@contents.should == "10\n11\n" @contents.should == "10\n11\n"
end end


Expand Down

0 comments on commit f4c3ada

Please sign in to comment.