#1 new
Hugo Corbucci

Extract variable

Reported by Hugo Corbucci | March 26th, 2009 @ 04:12 PM

To increase my programming speed As a programmer I want to extract a variable from a selected text

Scenario: Invalid Selection
    Given a text "puts File.dirname '/tmp/file.txt'; File.dirname('/tmp/file.txt') + 'my_other_file.txt'"
    And I selected "ile.dirna"
    When I ask for refactoring options
    Then I should not be able to "Extract Variable"

Scenario: Valid Selection
    Given a text "puts File.dirname '/tmp/file.txt'; File.dirname('/tmp/file.txt') + 'my_other_file.txt'"
    And I selected "File.dirname '/tmp/file.txt'"
    When I ask for refactoring options
    Then I should able to "Extract Variable"

Scenario: Extracting a variable
    Given a text "puts File.dirname '/tmp/file.txt'; File.dirname('/tmp/file.txt') + 'my_other_file.txt'"
    And I selected "File.dirname '/tmp/file.txt'"
    When I run "Extract Variable"
    And I type "dirname"
    Then I should get "dirname = File.dirname '/tmp/file.txt'; puts dirname; File.dirname('/tmp/file.txt') + 'my_other_file.txt'"

Scenario: Extracting a variable on equal multiple occurrences
    Given a text "puts File.dirname('/tmp/file.txt'); File.dirname('/tmp/file.txt') + 'my_other_file.txt'"
    And I selected "File.dirname('/tmp/file.txt')"
    When I run "Extract Variable"
    And I type "dirname"
    And I select "All occurrences"
    Then I should get "dirname = File.dirname('/tmp/file.txt'); puts dirname; dirname + 'my_other_file.txt'"

Scenario: Extracting a variable on equivalent multiple occurrences
    Given a text "puts File.dirname '/tmp/file.txt'; File.dirname('/tmp/file.txt') + 'my_other_file.txt'"
    And I selected "File.dirname '/tmp/file.txt'"
    When I run "Extract Variable"
    And I type "dirname"
    And I select "All occurrences"
    Then I should get "dirname = File.dirname '/tmp/file.txt'; puts dirname; dirname + 'my_other_file.txt'"

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Common refactorings for Ruby code, written in Ruby. This project aims to be integrated with several editors (mainly TextMate), to provide simple refactorings.

People watching this ticket

Pages