David Chelimsky

random thoughtlessness

The RSpec Book: Beta 4.0

We’ve released version 4.0 of The RSpec Book beta. It’s got a number of improvements per suggestions submitted by readers, as well as two exciting new chapters.

New Chapter: Rails Controllers

Continuing inward on our outside-in journey, this chapter explores how (and when) to write controller specs. We also introduce approaches to dealing with some controller-specific spec’ing challenges like filters, global behaviour defined in application controller and sending email.

New Chapter: Extending RSpec

This chapter introduces techniques for extending RSpec to cater to domain-specific needs. Covered topics include custom example group classes, custom matchers (including an exciting new matcher definition DSL), macros and custom formatters. Whether customizing RSpec for your own app, or in order to ship domain-specific spec’ing extensions with the libraries you’re releasing, this chapter is filled with really useful information that will help you make your specs easier to write and read.

Thanks (again, and again, and again)

Many thanks to all of you who are already participating in The RSpec Book beta program and making so many great suggestions. Your ongoing contribution to this process remains invaluable for the book and all of its readers.

The RSpec Book: Beta 3.0

| Comments

We’ve released version 3.0 of The RSpec Book beta. It’s got a number of improvements per suggestions submitted by readers, as well as two new chapters.

New Chapter: Evolving Existing Features

This is the next chapter in the Mastermind tutorial, in which we take the reader through the process of developing a command line version of the classic Mastermind game. In this chapter, we explore the problem of driving out changes to existing behaviour with new scenarios and code examples, all the while keeping the old code examples passing.

New Chapter: The Case for BDD

As the title suggests, this chapter lays out the case for Behaviour Driven Development as an over-arching methodology. You’ll read about how and why so many traditional projects fail, the Agile Manifesto and the methodologies that emerged around it, and why so many teams continue to struggle in spite of best efforts to adopt these new methodologies.

Thanks

Many thanks to all of you who are already participating in The RSpec Book beta program and making so many great suggestions. Your contribution to this process is invaluable for the book and all of its readers.

rspec-1.2, rspec-rails-1.2 (and rails-2.3)

rspec-1.2.0 and rspec-rails-1.2.0 have been released!

You’ll need this upgrade if you’re upgrading to rails-2.3.

Be sure to read the change logs before upgrading. There have been a few changes that will impact some (not all) of you.

rspec-1.2.0: RDoc | History

rspec-rails-1.2.0: RDoc | History

rspec/rspec-rails/ruby-1.9

Better late than never:

<code>[david: rspec (master)]$ multiruby -S rake spec
...
Passed: v1_8_6_114, 1.8.7-p72, 1.9.1-p0

[david: example_rails_app (master)] $ multiruby -S rake rspec:pre_commit
...
Passed: v1_8_6_114, 1.8.7-p72, 1.9.1-p0
</code>

Coming soon to a gem release near you.

The RSpec Book - Beta 2.0

The Pragmatic Programmers have just released the The RSpec Book, Beta 2.0. If you’ve already purchased the beta book, you can go to your account page and you’ll be able to download the new update.

If you haven’t purchased the beta book yet, now is a great time to join the party! We just added three new chapters:

Evolving Requirements

This is the next chapter in the Mastermind tutorial, which takes you through the evolution of a command line version of the classic Mastermind board game. The earlier chapters introduce RSpec and Cucumber. This new chapter introduces Cucumber’s new Scenario Outlines feature, which let’s you express repetitive scenarios in FIT-inspired tabular format.

Simulating the Browser with Webrat

Bryan Helmkamp, Webrat’s lead maintainer, builds on the Cucumber/Rails material in earlier chapters, driving those scenarios through the Rails stack with Webrat’s simple, powerful API.

Rails Views

Zach Dennis shows you how to write RSpec code examples for Rails views. Using Webrat’s have_xpath and have_selector matchers, and wrapping them in custom matchers targetted at your app, Zach shows you how to provide value throughout the life of the application with expressive, maintainable view specs.

Chapters from Beta 1.0

These new chapters build on the chapters we already released in Beta 1.0:

  • Introduction

  • Describing Application Behaviour with Cucumber

  • Working from the Outside-In with RSpec

  • Code Examples

  • Expectations

  • RSpec and Test::Unit

  • Tools and Integration

  • BDD in Rails

  • Cucumber with Rails

Up Next

We’ve got many more chapters coming over the next two or three updates, including chapters from Dan North and Dave Astels on Behaviour Driven Development and Mock Objects, new material on integrating Selenium, extending and customizing RSpec, and much, much more.

Thanks to all who are already participating in the beta program. We’ve gotten some great feedback so far. Some of it is already incorporated in the 2.0 beta release, and much more will be addressed in the upcoming releases. You’re all making this a better book for everyone else who will read it, so thank you, thank you, thank you.

Feedback on The RSpec Book (beta)

Thank you to all who are participating in The RSpec Book beta program. We’ve already gotten some good feedback, and we look forward to more as we release updates over the coming weeks.

For those of you who are reading the beta and would like to provide feedback, there are two outlets for you on the Pragmatic Programmers’ site.

The errata page is for technical errors, typos, etc. Things that don’t really require any discussion and are simple, task oriented fixes.

Although the errata page lists Suggestion as a type of errata, the system provides no opportunity for a conversation. Therefore, if you are making a comment like “I’m not sure I agree with the statement on page 37” or “you say x here and y there, which is it?”, etc, then the forum might be a better option. That way I (or any of the authors) can throw questions back at you to get a better feel for what you’d like to see and how it might help.

Of course, we’d rather have your feedback than not, so if you’re not interested in such a dialog, go ahead and stick to the one-way-street of the errata page.

Again, thanks for the feedback thus far. You’re helping to make this a better book for everyone else who will read it.

RSpec works with test/unit

[Updated to Sept 5, 2009]

Did you know that rspec is interoperable with test/unit?

spec/rails (formerly rspec_on_rails) has always run on test/unit and rspec (core) has had t/u interop capability for over a year now.

Take, for example, this test in addition_test.rb:

require 'test/unit'

class TestAddition < Test::Unit::TestCase
def test_add_1_and_2
  assert_equal 3, 1 + 2
end
end







$ ruby addition_test







Loaded suite /Users/david/projects/ruby/tmp/tur/addition_test
Started
.
Finished in 0.000289 seconds.

1 tests, 1 assertions, 0 failures, 0 errors

Now, simply require ‘spec/test/unit’:

require 'rubygems'
require 'spec/test/unit'

class TestAddition < Test::Unit::TestCase
def test_add_1_and_2
  assert_equal 3, 1 + 2
end
end

Run it with the spec command that is installed when you install rspec:

$ spec addition_test

And tada!

.

Finished in 0.001451 seconds

1 example, 0 failures

RSpec is running your tests!

The RSpec Book is now in beta

The RSpec Book

I’m pleased to announce the beta release of the Pragmatic Bookshelf’s The RSpec Book: Behaviour Driven Development with RSpec, Cucumber and Friends!

It’s been a long time coming, and there’s still a lot of work to do to get to print. The beta release has 9 of the 22 chapters we have planned. Most of what remains is almost done, but not quite ready to release yet. As with all of the Pragmatic beta books, we’ll do regular updates every few weeks as we wrap up the remaining chapters and incorporate your feedback. And please do provide feedback. We want this book to serve you well!

There are six authors involved: Dave Astels, Zach Dennis, Aslak Hellesøy, Bryan Helmkamp, Dan North, and me. I’m honored to be in such good company here, with the guys who brought us BDD, to the developers and maintainers of RSpec, Cucumber and Webrat.

You can read more (and buy the book!) at http://www.pragprog.com/titles/achbd/the-rspec-book

On behalf of all the authors, I’d like to extend a special thank you to all of you who have contributed to the software and the conversation around RSpec, Cucumber, and BDD in general. RSpec would be nothing without the community that has evolved around it, so thank you, thank you, thank you!

rspec-1.1.12 is released

We just released rspec-1.1.12. You can read the changelogs for rspec and rspec-rails for all the details, but are some changes that you should definitely know about.

Cucumber is the new Story Runner

rspec-1.1.12 is the last release that will ship with the Story Runner bundled. With the next release, we will do the one and only gem release of repo so you won’t be forced to upgrade to Cucumber Thanks to Chad Humphries for stepping in and extracting the Story Runner to a separate repo.

The Story Runner is deprecated, however, and we will not be maintaining it. If anybody wants to maintain it, you’re welcome to. Just fork the repo and have at it.

Why are we deprecating the Story Runner? Because Aslak Hellesøy’s Cucumber library kicks its ass. Easier setup means lower barrier to entry, building on treetop means great feedback with backtraces plus support for an ever-growing list of written languages. And migrating from RSpec Stories is a snap. So what are you waiting for?

rspec-1.1.12 release candidate

I’m getting ready to do a 1.1.12 release of rspec and rspec-rails. Given the history of release-related compatibility problems, I offer you release candidate gems, which you can acquire thusly:

UPDATE: new version (1.1.11.6) fixes dependency problem w/ github gems

<code>gem sources --add http://gems.github.com
[sudo] gem install dchelimsky-rspec -v 1.1.11.6
[sudo] gem install dchelimsky-rspec-rails -v 1.1.11.6
</code>

Release notes can be seen under Maintenance at:

NOTE: This will be the last release of rspec-rails that supports rails < 2.0

If you are so inclined, please grab these gems, use them, and let me know if there are any problems.