The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Cucubmer and Test::Unit

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Bryan Liles

Posts: 228
Nickname: bryanl
Registered: May, 2008

Bryan Liles is the Principal Web Developer for Sourcefire, Inc.
Cucubmer and Test::Unit Posted: Nov 24, 2008 9:01 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Bryan Liles.
Original Post: Cucubmer and Test::Unit
Feed Title: Smarticus
Feed URL: http://smartic.us/feed/atom.xml
Feed Description: Ramblings of a ruby hacker
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Bryan Liles
Latest Posts From Smarticus

Advertisement

The new hotness coming out of the RSpec camp is Cucumber. In their own words, “Cucumber executes plain text documentation of code against that code.” In normal people speak, Cucumber provides an extremely easy way to write acceptance style tests for your applications.

To get started, I installed Cucumber per their directions. I’m using this with a Rails project, and the steps from the wiki put me on the right track. (I did already have RSpec installed, but we won’t be using that here) I’m using this with a Rails 2.2, project, so I’ve added the following to my environment.rb:

config.gem "cucumber", :version => "0.1.9"

Next, I bootstrapped Cucumber, and started working on my features.

Seeing as how I don’t do much Rspec these days, I wanted to see if it would be possible to use Cucumber with Test::Unit. Fortunately for us, this is a very easy task, and I’ll share my notes with you.

1. Make sure the ‘require’ spec line is commented out in features/support/env.rb.

2. Modify the steps in features/step_definitions/webrat_steps.rb

Mostly, what you will do here is convert the matchers to thier Test::Unit equivalents. For instance, response.body.should_not =~ /#{text}/m is synonymous to assert_no_match(response.body, /#{text}/m)

3. There is no step 3.

So I’ve using this for a few days, I’ve noticed nothing weird, and I will be using this in all my projects. Thanks to RSpec team for creating such a cool project.

Read: Cucubmer and Test::Unit

Topic: Wall-E Previous Topic   Next Topic Topic: RubyForge gem publishing time reduced from 1 hour to 5 minutes

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use