forked from ecomba/vim-ruby-refactoring
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more descriptive steps for extract let
- Loading branch information
Showing
2 changed files
with
30 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
Feature: Extract RSpec Let | ||
Feature: Extract RSpec Let :RExtractLet | ||
Take an assignment in an rspec specfication and convert it into a let declaration | ||
|
||
Scenario: Extract to rspec let declaration | ||
Given I have an rspec specification with an assignment | ||
When I extract to rspec let | ||
Then I see that there is now an rspec let declaration | ||
Given I have the following code: | ||
""" | ||
describe "something" do | ||
it "does stuff" do | ||
bar = 10 | ||
bar.should == 10 | ||
end | ||
end | ||
""" | ||
When I select the variable assignment and execute: | ||
""" | ||
:RExtractLet | ||
""" | ||
Then I should see: | ||
""" | ||
describe "something" do | ||
let(:bar) { 10 } | ||
it "does stuff" do | ||
bar.should == 10 | ||
end | ||
end | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,10 @@ | ||
Given /^I have an rspec specification with an assignment$/ do | ||
@input = <<-DOC | ||
describe "something" do | ||
it "does stuff" do | ||
bar = 10 | ||
bar.should == 10 | ||
end | ||
end | ||
DOC | ||
When /^I select the variable assignment and execute:$/ do |command| | ||
select_variable_assignment | ||
add_to_commands command | ||
end | ||
|
||
When /^I extract to rspec let$/ do | ||
@commands = <<-DOC | ||
:normal 3G | ||
:RExtractLet | ||
DOC | ||
def select_variable_assignment | ||
@commands = ':normal 3G' | ||
add_return_key | ||
end | ||
|
||
Then /^I see that there is now an rspec let declaration$/ do | ||
result_of_executing_the_commands.should == <<-DOC | ||
describe "something" do | ||
let(:bar) { 10 } | ||
it "does stuff" do | ||
bar.should == 10 | ||
end | ||
end | ||
DOC | ||
end |