[Rspec-users] domain language?

Phlip phlip2005 at gmail.com
Mon Oct 30 13:02:15 EST 2006


RSpeckers:

I went with RSpec instead of Systir because I downloaded and installed
the former first.

(I know that's not exactly a ringing endorsement! ;-)

I want to compete with FIT and Fitnesse, like this:

http://www.zeroplayer.com/cgi-bin/wiki?TestFlea#tropism

(Click on a Green Bar to distend one test case.)

I want a domain-specific language in the parchment-colored area on the right.

I don't want to invent it the bass-ackwards way FIT does, with its
Java-style Action Fixture. That just gets me back to writing each line
as a custom function. Ruby solutions tend to be much more elegant than
that!

Now here's my RSpec_Watir solution, to log into a site:

snapshot()
@browser.should_contain("login")
@browser.text_field(:id, 'login').should_exist

@browser.ie.document.activeElement.name.should_equal('login')
# .because login field should have the focus

Those lines violate the Systir principles; they use parens () and
variables and state. They use a comment instead of an assertion
documentation string.

RSpec has gone a long way towards producing readable sentences -
"should_contain" instead of "assert ... contains?" etc.

How to go the extra step? How to improve my RSpec style? How to get
rid of @browser, and have a true domain language, without writing a
private function for every stinkin' operation on my website?

Oh, and soon my tests must use 2 or more browsers, too...

(I suspect I can't just cram in Systir, because it has a competing
test runner. And I have a bug report on ZenTest that I don't want to
work around yet.)

-- 
  Phlip
  http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!


More information about the Rspec-users mailing list