# \[ANN\] (testing/bdd) Speccify, the lightweight option

**URL:** <https://www.ruby-forum.com/t/ann-testing-bdd-speccify-the-lightweight-option/159473>\
**Category:** Ruby\
**Created:** [February 4, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/ann-testing-bdd-speccify-the-lightweight-option/159473 "2009-02-04T20:55:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhennemeyer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@mhennemeyer](https://www.ruby-forum.com/u/mhennemeyer)\
**Post date:** [February 4, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/ann-testing-bdd-speccify-the-lightweight-option/159473/1 "2009-02-04T20:55:31Z")

</div>

Hi!  
I’m proud to release  
Speccify, the lightweight option.

Please TRY IT OUT!

Website: [http://speccify.rubyforge.org](http://speccify.rubyforge.org)

1. Get it:  
$ sudo gem install speccify

2. Use it:  
require ‘rubygems’  
require ‘speccify’

# GO

1. Love it:  
Speccify is a complete Testing/BDD Framework that  
provides everything that actually matters.

Features:

- Nested Contexts
- Custom matchers are no-brainers with def\_matcher()
- Fast
- 100% Ruby 1.9 and 1.8 compatible
- Rails out of the box!
- Sophisticated Expectations/Matchers System
- \< 300 LOC (sans rdoc)
- Near Future: Rails Generators, TM-Bundle

Speccify has no dependencies outside standard ruby, iterops with  
test/unit and minitest without issues and generally behaves like  
a good citizen.

Speccify has a strong opinion of what actually not matters:

- /spec directory instead of /test
- whatever\_spec.rb instead of whatever\_test.rb
- custom formatters
- custom runners
- html output or any special formatted output
- special commandline tools
- shared example groups
- pending examples
- before\_all, after\_all, before\_suite, after\_suite

Some Examples:

1. Plain:

# test\_object.rb

```
   require "rubygems"
   require "speccify"

   describe Object do
     before do
       @obj = Object.new
     end

     it "is not nil" do
       @obj.should_not be_nil
     end

     it "can be frozen" do
       @obj.freeze
       @obj.should be_frozen
     end
   end

```

1. Rails ActionMailer Test:

describe MyMailer, :type =\> ActionMailer::TestCase do

before do  
@expected.subject = ‘MyMailer#confirm’  
@expected.body = read\_fixture(‘confirm’)  
@expected.date = Time.now  
end

it “sends confirm mail” do  
MyMailer.create\_confirm(@expected.date).encoded.should  
eql(@expected.encoded)  
end

describe “nested context” do  
it “still sends confirm mail” do  
MyMailer.create\_confirm(@expected.date).encoded.should  
eql(@expected.encoded)  
end  
end  
end

1. Rails Performance Test:

require ‘performance\_test\_help’

describe “Browsing”, :type =\> ActionController::PerformanceTest do  
it “get homepage” do  
get ‘/’  
end  
end

1. Create a custom Matcher:

def\_matcher :be\_smart do |given, matcher, args|  
!given.dumb?  
end  
obj.should be\_smart

# passes if obj.dumb? # =\> false

You can create the most sophisticated matchers with def\_matcher().  
Method chaining like with rspecs change matcher:  
lambda {do\_something}.should change {something}.from(undone).to(done)  
is really not a big deal with speccify. (See:  
[http://speccify.rubyforge.org/matchers.html](http://speccify.rubyforge.org/matchers.html))

Browse the site: [http://speccify.rubyforge.org](http://speccify.rubyforge.org) ,  
skim the docs: [http://speccify.rubyforge.org/doc/index.html](http://speccify.rubyforge.org/doc/index.html)  
and feel free mail me with any questions or whatever:  
[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Thanks  
Matthias
