From: Phlip Date: 2009-02-23T13:49:29+09:00 Subject: Re: [ANN] nokogiri 1.2.0 Released Aaron Patterson wrote: > nokogiri version 1.2.0 has been released! The following is a question, if I got it wrong, and a code snippet if I didn't. To add nokogiri to a Merb project's Cucumber featurizer, I... Added it to features/support/env.rb: require "merb-core" require "spec" require "merb_cucumber/world/simple" require 'nokogiri' # <-- with the correct style of quote 'ticks'! Added its calls to features/steps/result_steps.rb When /^you go to (.*)/ do |text| @response = request(text) @xdoc = Nokogiri::HTML(@response.body.to_s) end Then /^you should see an? (.+) element$/ do |searcher| @xdoc.css(searcher).should_not be_nil end Called its steps from features/comics.feature: Feature: serve webcomics Scenario: root page When you go to / Then you should see an img.comic element The result is the usual bunch of pale green. (But note that I personally suck at writing customer-facing verbiage. They don't care if they see an img with a class of comic! They want to see a comic image! More verbiage tuning is in order...) Also note that I suck at writing RSpec matchers. The point of all this is clear error messages at fault time, and my .should_not be_nil is also not particularly exemplary! So thanks for the lib! it's going to the top of my list from now on... -- Phlip http://localhost:4000/Pigleg_Too/1