Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wojtha/mouse_melon
MouseMelon is a simple DSL which allows to write acceptance specs in Gherkin-like language without any parser.
https://github.com/wojtha/mouse_melon
bdd dsl gherkin rspec testing
Last synced: 6 days ago
JSON representation
MouseMelon is a simple DSL which allows to write acceptance specs in Gherkin-like language without any parser.
- Host: GitHub
- URL: https://github.com/wojtha/mouse_melon
- Owner: wojtha
- License: mit
- Created: 2015-09-18T18:08:11.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-11-24T21:37:42.000Z (almost 5 years ago)
- Last Synced: 2024-10-16T11:03:24.566Z (20 days ago)
- Topics: bdd, dsl, gherkin, rspec, testing
- Language: Ruby
- Homepage: https://github.com/wojtha/mouse_melon
- Size: 142 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# MouseMelon a.k.a. Mexikan Gherkin
MouseMelon is a pseudo-Gherkin DSL designed to be used in RSpec acceptance specs but it may be used elsewhere.
[![Build Status](https://travis-ci.org/wojtha/mouse_melon.svg?branch=master)](https://travis-ci.org/wojtha/mouse_melon) [![Code Climate](https://codeclimate.com/github/wojtha/mouse_melon/badges/gpa.svg)](https://codeclimate.com/github/wojtha/mouse_melon) [![Test Coverage](https://codeclimate.com/github/wojtha/mouse_melon/badges/coverage.svg)](https://codeclimate.com/github/wojtha/mouse_melon/coverage)
![Example of Gherkin feature vs MouseMelon spec](/assets/gherkin_vs_mouse_melon.png?raw=true "Gherkin vs MouseMelon")
## Notable features:
* It runs inside RSpec (Minitest support may come later): just include module and you're ready.
* `Given`, `When`, `Then` are just methods which calls the step definitions directly.
* You can use symbols `I_am_registered_user` or feature steps `I am registered user`.
* You can define the steps globally, locally or mix them into the specs.
* Steps can have arguments `I register user`.
* Command line tool to generate step definitions.
* No fancy output of tested steps like Cucumber or Spinach.### Currently supported/tested environment:
* RSpec 3.3.x
* Ruby 2.1.x## Installation
Add this line to your application's Gemfile:
```ruby
gem 'mouse_melon'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install mouse_melon
Include it to RSpec helper
```ruby
RSpec.configure do |config|
config.include MouseMelon::DSL, :type => :feature
end
```## Usage
Here is demonstration of various possible styles:
```ruby
feature 'MouseMelon features' do
# Steps shared via modules
include CommonStepsscenario 'Steps as methods' do
given_is_defined
when_is_defined
then_is_defined
endscenario 'Steps as symbols' do
Given :given_is_defined
When :when_is_defined
Then :then_is_defined
endscenario 'Steps as strings' do
Given 'given is defined'
When 'when is defined'
Then 'then is defined'
And 'and is defined'
And 'and it has arguments', 'hello', 1
endscenario 'Steps as Steps' do
Step 'given is defined'
Step 'when is defined'
Step 'then is defined'
endscenario 'Steps as triangle bullets' do
‣ 'given is defined'
‣ 'when is defined'
‣ 'then is defined'
endscenario 'Steps as circle bullets' do
• 'given is defined'
• 'when is defined'
• 'then is defined'
end# INLINE STEP DEFINITIONS
def given_is_defined
puts 'GIVEN'
enddef when_is_defined
puts 'WHEN'
endstep 'then is defined' do
puts 'THEN'
endstep 'and is defined' do
puts 'AND'
endstep 'and it has arguments' do |*args|
puts "AND with args #{args.inspect}"
end
end
```For more examples look inside `examples` and `spec` folders.
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/wojtha/mouse_melon. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).