From: Matthias Hennemeyer Date: 2009-02-05T04:55:02+09:00 Subject: [ANN] (testing/bdd) Speccify, the lightweight option Hi! I'm proud to release Speccify, the lightweight option. Please TRY IT OUT! Website: http://speccify.rubyforge.org 1. Get it: $ sudo gem install speccify 2. Use it: require 'rubygems' require 'speccify' # GO 3. 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 2. 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 3. Rails Performance Test: require 'performance_test_help' describe "Browsing", :type => ActionController::PerformanceTest do it "get homepage" do get '/' end end 4. 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) Browse the site: http://speccify.rubyforge.org , skim the docs: http://speccify.rubyforge.org/doc/index.html and feel free mail me with any questions or whatever: mailto:mhennemeyer@gmail.com Thanks Matthias -- Posted via http://www.ruby-forum.com/.