Skip to content

Commit

Permalink
issue: changing all within the context of a method
Browse files Browse the repository at this point in the history
all temporary variables within the context of the current method should be substituted.
  • Loading branch information
despo committed Jun 1, 2011
1 parent 02306c7 commit 6a96f1d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
32 changes: 32 additions & 0 deletions features/inline_temp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,35 @@ Feature: Inline Temp :RInlineTemp
y = 5 and z = 5
"""

@issues @wip
Scenario: Inline a temporary variable to all variables within the context of a method
Given I have the following code:
"""
def some_method
x = 5
y = x and z = x
r = x + 2
end
def some_other_method
x = 2
y = x + 1
end
"""
When I select "x = 5" and execute:
"""
:RInlineTemp
"""
Then I should see:
"""
def some_method
y = 5 and z = 5
r = 5 + 2
end
def some_other_method
x = 2
y = x + 1
end
"""
11 changes: 11 additions & 0 deletions features/step_definitions/inline_temp_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,14 @@
select_method
add_to_commands(command)
end

When /^I select \"x = 5\" and execute:$/ do |command|
select_second_line
add_to_commands command
end

def select_second_line
@commands = ':normal 2G'
add_return_key
end

0 comments on commit 6a96f1d

Please sign in to comment.