Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brett-richardson/rspec-assumptions
Assume your setup for quick sanity tests in your specs.
https://github.com/brett-richardson/rspec-assumptions
Last synced: 12 days ago
JSON representation
Assume your setup for quick sanity tests in your specs.
- Host: GitHub
- URL: https://github.com/brett-richardson/rspec-assumptions
- Owner: brett-richardson
- License: mit
- Created: 2013-07-08T13:47:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-07-08T14:23:51.000Z (over 11 years ago)
- Last Synced: 2024-11-11T00:28:35.529Z (2 months ago)
- Language: Ruby
- Size: 695 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/brett-richardson/rspec-assumptions.png?branch=master)](https://travis-ci.org/brett-richardson/rspec-assumptions)
Using Rspec Assumptions
=======================Use RSpec assumptions to debug your specs.
Often when writing tests, you can find yourself testing your test set-up and not the subject itself.
That is where assumptions come in. Write an assumption about your test setup... and it will suceed silently.
However, it will notify you of errors when it fails.Using Rspec Assumptions is super simple.
In your Gemfile:
```ruby
group :development, :testing do
gem 'rspec-assumptions'
end
```In your spec_helper.rb:
```ruby
require 'rspec/assumptions'
```Define an assumption with the 'assumption' method.
If it fails, it will notify you... and if it suceeds, it does so quietly.```ruby
describe Apple do
let( :apple ){ create :apple }
let( :pear ){ create :pear }describe '#+' do
subject{ apple + pear }
assume{ apple.class.should != pear.class }it{ should be_a FruitSalad }
end
end
```