Sha256: 4753187ab9d4e344bffeee15e35f55af53d49a6640e22baa9a7b26a0edad03d9
Contents?: true
Size: 1.36 KB
Versions: 6
Compression:
Stored size: 1.36 KB
Contents
Feature: define matcher In order to express my domain clearly in my code examples As an RSpec user I want to define matchers with fluent interfaces Scenario: one additional method Given a file named "between_spec.rb" with: """ Spec::Matchers.define :be_bigger_than do |first| def but_smaller_than(second) @second = second self end match do |actual| (actual > first) && (actual < @second) end end describe 5 do it { should be_bigger_than(4).but_smaller_than(6) } end """ When I run "spec between_spec.rb --format specdoc" Then the stdout should include "1 example, 0 failures" And the stdout should include "should be bigger than 4" Scenario: generate method using dsl Given a file named "between_spec.rb" with: """ Spec::Matchers.define :be_bigger_than do |first| chain :but_smaller_than do |limit| @limit = limit end match do |actual| (actual > first) && (actual < @limit) end end describe 5 do it { should be_bigger_than(4).but_smaller_than(6) } end """ When I run "spec between_spec.rb --format specdoc" Then the stdout should include "1 example, 0 failures" And the stdout should include "should be bigger than 4"
Version data entries
6 entries across 6 versions & 3 rubygems