Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9186553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:33:25+00:00 2026-06-17T19:33:25+00:00

I am using Steak to do acceptance testing because I didn’t like cucumber at

  • 0

I am using Steak to do acceptance testing because I didn’t like cucumber at all although I am using some cucumber concepts in the way I test. I liked the declarative vs imperative styles for testings and I am abstracting some expectations into elaborated custom rspec matchers that insinde the match method use other matchers, heres an example:

RSpec::Matchers.define :show_post do |post|
  match do |page|
    within '.post' do
      page.should have_content post.title
      page.should have_content post.tagline
      page.should have_content post.body
      page.should list_author  post.author
    end
  end
end

The only problem I am having is that if my matcher fails I get a generic message that doesn’t give me any insight on what’s missing, when what I really want is to now which one of the expectation that compose the custom matcher is not meet.

I’ve been living with this nuisance for a while because I really like the expressiveness of being able to do:

page.should show_post Post.last
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:33:26+00:00Added an answer on June 17, 2026 at 7:33 pm

    Better yet:

    module DefineMatcher
      def define_matcher name, &block
        klass = Class.new do
          include Capybara::RSpecMatchers
    
          attr_reader :expected
    
          def initialize expected
            @expected = expected
          end
    
          define_method :matches?, &block
        end
    
        define_method name do |expected|
          klass.new expected
        end
      end
    end
    
    
    module PageMatchers
      extend DefineMatcher
    
      define_matcher :show_notice do |page|
        within '.alert-notice' do
          page.should have_content expected
        end
      end
    end
    
    RSpec.configuration.include PageMatchers, :type => :acceptance
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still on Rails 2.3.x and using Rspec, Capybara and Steak to do some
I would like to test a controller that directly renders some JSON output (by
Using SQL Server 2008 R2 we are looking for a way to select the
Using the Redis info command, I am able to get all the stats of
Is there a way using Android layout to automatically distinguish between f/ex a Dell
I am using Groovy to do some calculations, within an RCP app. When I
Is there a way to create an index and specify a custom analyzer using
I'm using the JQuery datepicker and show it to the user with some days
I am using rails 3, Steak & Capybara. I have restful resources, is it
I am looking for some resources that speak about managing large C projects using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.