Skip to content

Instantly share code, notes, and snippets.

@abachman
Created June 10, 2010 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abachman/433446 to your computer and use it in GitHub Desktop.
Save abachman/433446 to your computer and use it in GitHub Desktop.
The Tabular plugin: http://github.com/godlygeek/tabular
" nice indentation for Cucumber scripts (if you're not already nesting)
:'<,'>Tabularize /^.*\(Given\|And\|When\|Then\) /l0
So that:
Scenario: Admin user should be able to access categories index from form library page
Given I am an admin user with the login "administrator" and the password "administrator"
And there is a active study
And a category exists with name: "Behavioral", category_type: "_treatment"
And I login as "administrator" authenticating with "administrator"
When I follow "Categories" within "#treatment_lists_categories_link"
Then I should be on the admin categories page
And I should see "Categories" within "#content_panel"
And I should see "Behavioral" within "#content_panel"
Can become:
Scenario: Admin user should be able to access categories index from form library page
Given I am an admin user with the login "administrator" and the password "administrator"
And there is a active study
And a category exists with name: "Behavioral", category_type: "_treatment"
And I login as "administrator" authenticating with "administrator"
When I follow "Categories" within "#treatment_lists_categories_link"
Then I should be on the admin categories page
And I should see "Categories" within "#content_panel"
And I should see "Behavioral" within "#content_panel"
When you've selected the second through last line.
To add a shortcut ("tabular pattern"), put:
AddTabularPattern! cucumber /^.*\(Given\|And\|When\|Then\) /l0
in ~/.vim/after/plugin/TabularMaps.vim. Now you can use ":'<,'>Tabularize cucumber" instead of the whole pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment