Skip to content

Instantly share code, notes, and snippets.

@bfabry
Created October 26, 2011 11:34
Show Gist options
  • Save bfabry/1316092 to your computer and use it in GitHub Desktop.
Save bfabry/1316092 to your computer and use it in GitHub Desktop.
it "should be able to pass in blocks" do
code = <<CODE
def method(x, y, &block)
z = x * y
some_shit = SomeClass.new(x)
if some_shit.good_to_go?
puts some_shit.print(y)
SomeShitProcessor.new(some_shit).process(&block)
end
end
CODE
RubyRefactorer.extract_method(code,
:indent => 2,
:start_line => 5,
:end_line => 6,
:name => 'process_someshit').should == "\
def process_someshit(some_shit, y, block)
puts some_shit.print(y)
SomeShitProcessor.new(some_shit).process(&block)
end"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment