Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/petitest/petitest-spec
BDD style DSL for Petitest.
https://github.com/petitest/petitest-spec
bdd petitest rspec
Last synced: 8 days ago
JSON representation
BDD style DSL for Petitest.
- Host: GitHub
- URL: https://github.com/petitest/petitest-spec
- Owner: petitest
- License: mit
- Created: 2017-03-25T14:32:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-27T08:37:23.000Z (almost 8 years ago)
- Last Synced: 2024-11-16T17:39:50.390Z (3 months ago)
- Topics: bdd, petitest, rspec
- Language: Ruby
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Petitest::Spec
[![Gem Version](https://badge.fury.io/rb/petitest-spec.svg)](https://rubygems.org/gems/petitest-spec)
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/github/petitest/petitest-spec)BDD style DSL for [Petitest](https://github.com/petitest/petitest).
## Installation
Add this line to your application's Gemfile:
```ruby
gem "petitest"
```And then execute:
```bash
bundle
```Or install it yourself as:
```bash
gem install petitest
```## Usage
Require `"petitest/spec"` and extend `Petitest::Spec` into your test class.
```ruby
require "petitest/autorun"
require "petitest/spec"class ExampleTest < Petitest::Test
include ::Petitest::Spec# ... your tests ...
end
```### .describe and .context
Nest a test group with description. `.context` is an alias.
```ruby
describe "GET /me" do
context "without logged-in" do
it "returns 401" do
assert { response.status == 200 }
end
end
end
```### .it and .specify
Define a test with description. `.specify` is an alias.
```ruby
it "returns foo" do
assert { x == "foo" }
endspecify "x is foo" do
assert { x == "foo" }
end
```### .let
Define a memozied method.
```ruby
let(:result) do
1 + 1
endit "returns 2" do
assert { result == 2 }
end
```