Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/railsware/rspec-example_steps
Given/When/Then steps for RSpec examples
https://github.com/railsware/rspec-example_steps
Last synced: about 1 month ago
JSON representation
Given/When/Then steps for RSpec examples
- Host: GitHub
- URL: https://github.com/railsware/rspec-example_steps
- Owner: railsware
- License: mit
- Created: 2011-12-28T21:56:52.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2021-07-01T22:24:15.000Z (about 3 years ago)
- Last Synced: 2024-07-20T03:02:26.207Z (2 months ago)
- Language: Ruby
- Homepage:
- Size: 34.2 KB
- Stars: 85
- Watchers: 64
- Forks: 20
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## RSpec example steps
Given/When/Then/And/But steps for RSpec examples
### Description
This gem brings two major functionality to your `spec/features`
* Verbosity for rspec documentation formatter.
* Ability to comment or describe set of actions in example into some step.### Installation
* For rspec v2 use gem **v0.2.x** or rspec2 branch
* For rspec v3 use gem **v3.x.x** or master branch```ruby
gem 'rspec-example_steps'
```Add to `spec/spec_helper.rb`
```ruby
require 'rspec/example_steps'
```### Example
`spec/features/search_spec.rb`
```ruby
context 'Searching' do
Steps 'Result found' do
Given 'I am on search page' do
visit '/search'
expect(page).to have_content('Search')
endWhen 'I search something' do
fill_in 'Search', with: 'John'
click_button 'Go'
endThen 'I should see result' do
expect(page).to have_content('Result')
end
end
end
```### Documentation formatting output:
`rspec -fd spec/features/search_spec.rb`
Searching
User succesfully replaces device
Given I am on search page
When I search something
Then I should see result### Pending steps
Simular to Example :pending behavior:
```ruby
Steps 'User login' do
# just skip block
When 'I go to login'# pass pending: true option
Then 'I should see welcome', pending: true do
...
end# pass pending: 'some pending message'
Then 'I should see last login IP', pending: 'WIP' do
...
end
end
```## Authors
* [Andriy Yanko](http://ayanko.github.io)
## License
* Copyright (c) 2013 Railsware [www.railsware.com](http://www.railsware.com)
* [MIT](www.opensource.org/licenses/MIT)## Alternatives
* [rspec-steps](https://github.com/LRDesign/rspec-steps)
* [rspec-given](https://github.com/jimweirich/rspec-given)