Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Extract variable

#1

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'"

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

State: new
Milestone: none
Assigned to: Fabio Kung Fabio Kung

Activity

No comments yet.

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.