Skip to content

Instantly share code, notes, and snippets.

@JunichiIto
Last active September 5, 2025 14:24
Show Gist options
  • Save JunichiIto/f603d3fbfcf99b914f86 to your computer and use it in GitHub Desktop.
Save JunichiIto/f603d3fbfcf99b914f86 to your computer and use it in GitHub Desktop.

Revisions

  1. JunichiIto revised this gist Jun 28, 2022. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions alias_matchers.md
    Original file line number Diff line number Diff line change
    @@ -17,8 +17,8 @@ You can see also [Module: RSpec::Matchers API](http://rubydoc.info/github/rspec/
    |an_instance_of(Integer)|be_an_instance_of(Integer)|an instance of Integer|
    |a_kind_of(Integer)|be_a_kind_of(Integer)|a kind of Integer|
    |a_value_between(1, 10)|be_between(1, 10)|a value between 1 and 10 (inclusive)|
    |a_value_within(0.1)|be_within(0.1)|a value within 0.1 of 3|
    |within(0.1)|be_within(0.1)|within 0.1 of 3|
    |a_value_within(0.1).of(3)|be_within(0.1).of(3)|a value within 0.1 of 3|
    |within(0.1).of(3)|be_within(0.1).of(3)|within 0.1 of 3|
    |a_block_changing|change|a block changing result|
    |changing|change|changing result|
    |a_collection_containing_exactly(1, 2)|contain_exactly(1, 2)|a collection containing exactly 1 and 2|
    @@ -65,4 +65,4 @@ You can see also [Module: RSpec::Matchers API](http://rubydoc.info/github/rspec/
    |a_block_yielding_with_args|yield_with_args|a block yielding with args|
    |yielding_with_args|yield_with_args|yielding with args|
    |a_block_yielding_successive_args|yield_successive_args|a block yielding successive args()|
    |yielding_successive_args|yield_successive_args|yielding successive args()|
    |yielding_successive_args|yield_successive_args|yielding successive args()|
  2. JunichiIto revised this gist Apr 22, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions alias_matchers.md
    Original file line number Diff line number Diff line change
    @@ -45,8 +45,8 @@ You can see also [Module: RSpec::Matchers API](http://rubydoc.info/github/rspec/
    |an_object_matching(/foo/)|match(/foo/)|an object matching /foo/|
    |match_regex(/foo/)|match(/foo/)|match regex /foo/|
    |matching(/foo/)|match(/foo/)|matching /foo/|
    |a_block_outputting('foo')|output('foo')|a block outputting 'foo' to stdout|
    |a_block_outputting('foo')|output('foo')|a block outputting 'foo' to stderr|
    |a_block_outputting('foo').to_stdout|output('foo').to_stdout|a block outputting 'foo' to stdout|
    |a_block_outputting('foo').to_stderr|output('foo').to_stderr|a block outputting 'foo' to stderr|
    |a_block_raising(ArgumentError)|raise_error(ArgumentError)|a block raising ArgumentError|
    |raising(ArgumentError)|raise_error(ArgumentError)|raising ArgumentError|
    |an_object_responding_to(:foo)|respond_to(:foo)|an object responding to #foo|
    @@ -65,4 +65,4 @@ You can see also [Module: RSpec::Matchers API](http://rubydoc.info/github/rspec/
    |a_block_yielding_with_args|yield_with_args|a block yielding with args|
    |yielding_with_args|yield_with_args|yielding with args|
    |a_block_yielding_successive_args|yield_successive_args|a block yielding successive args()|
    |yielding_successive_args|yield_successive_args|yielding successive args()|
    |yielding_successive_args|yield_successive_args|yielding successive args()|
  3. JunichiIto renamed this gist Jul 28, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. JunichiIto created this gist Jul 28, 2014.
    68 changes: 68 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    This list is based on [aliases_spec.rb](https://raw.githubusercontent.com/rspec/rspec-expectations/6f975b08c996b1014654334229d5d4b020055690/spec/rspec/matchers/aliases_spec.rb).

    You can see also [Module: RSpec::Matchers API](http://rubydoc.info/github/rspec/rspec-expectations/RSpec/Matchers).

    |matcher|aliased to|description|
    |:------|:---------|:----------|
    |a_truthy_value|be_truthy|a truthy value|
    |a_falsey_value|be_falsey|a falsey value|
    |be_falsy|be_falsey|be falsy|
    |a_falsy_value|be_falsey|a falsy value|
    |a_nil_value|be_nil|a nil value|
    |a_value > 3|be > 3|a value > 3|
    |a_value < 3|be < 3|a value < 3|
    |a_value <= 3|be <= 3|a value <= 3|
    |a_value == 3|be == 3|a value == 3|
    |a_value === 3|be === 3|a value === 3|
    |an_instance_of(Integer)|be_an_instance_of(Integer)|an instance of Integer|
    |a_kind_of(Integer)|be_a_kind_of(Integer)|a kind of Integer|
    |a_value_between(1, 10)|be_between(1, 10)|a value between 1 and 10 (inclusive)|
    |a_value_within(0.1)|be_within(0.1)|a value within 0.1 of 3|
    |within(0.1)|be_within(0.1)|within 0.1 of 3|
    |a_block_changing|change|a block changing result|
    |changing|change|changing result|
    |a_collection_containing_exactly(1, 2)|contain_exactly(1, 2)|a collection containing exactly 1 and 2|
    |containing_exactly(1, 2)|contain_exactly(1, 2)|containing exactly 1 and 2|
    |a_range_covering(1, 2)|cover(1, 2)|a range covering 1 and 2|
    |covering(1, 2)|cover(1, 2)|covering 1 and 2|
    |ending_with(23)|end_with(23)|ending with 23|
    |a_collection_ending_with(23)|end_with(23)|a collection ending with 23|
    |a_string_ending_with("z")|end_with("z")|a string ending with 'z'|
    |an_object_eq_to(3)|eq 3|an object eq to 3|
    |eq_to(3)|eq 3|eq to 3|
    |an_object_eql_to(3)|eql 3|an object eql to 3|
    |eql_to(3)|eql 3|eql to 3|
    |an_object_equal_to(3)|equal 3|an object equal to 3|
    |equal_to(3)|equal 3|equal to 3|
    |an_object_existing|exist|an object existing|
    |existing|exist|existing|
    |an_object_having_attributes(:age => 32)|have_attributes(:age => 32)|an object having attributes {:age => 32}|
    |a_string_including("a")|include("a")|a string including 'a'|
    |a_collection_including("a")|include("a")|a collection including 'a'|
    |a_hash_including(:a => 5)|include(:a => 5)|a hash including {:a => 5}|
    |including(3)|include(3)|including 3|
    |a_string_matching(/foo/)|match(/foo/)|a string matching /foo/|
    |an_object_matching(/foo/)|match(/foo/)|an object matching /foo/|
    |match_regex(/foo/)|match(/foo/)|match regex /foo/|
    |matching(/foo/)|match(/foo/)|matching /foo/|
    |a_block_outputting('foo')|output('foo')|a block outputting 'foo' to stdout|
    |a_block_outputting('foo')|output('foo')|a block outputting 'foo' to stderr|
    |a_block_raising(ArgumentError)|raise_error(ArgumentError)|a block raising ArgumentError|
    |raising(ArgumentError)|raise_error(ArgumentError)|raising ArgumentError|
    |an_object_responding_to(:foo)|respond_to(:foo)|an object responding to #foo|
    |responding_to(:foo)|respond_to(:foo)|responding to #foo|
    |an_object_satisfying { }|satisfy { }|an object satisfying block|
    |satisfying { }|satisfy { }|satisfying block|
    |a_collection_starting_with(23)|start_with(23)|a collection starting with 23|
    |a_string_starting_with("z")|start_with("z")|a string starting with 'z'|
    |starting_with("d")|start_with("d")|starting with 'd'|
    |a_block_throwing(:foo)|throw_symbol(:foo)|a block throwing :foo|
    |throwing(:foo)|throw_symbol(:foo)|throwing :foo|
    |a_block_yielding_control|yield_control|a block yielding control|
    |yielding_control|yield_control|yielding control|
    |a_block_yielding_with_no_args|yield_with_no_args|a block yielding with no args|
    |yielding_with_no_args|yield_with_no_args|yielding with no args|
    |a_block_yielding_with_args|yield_with_args|a block yielding with args|
    |yielding_with_args|yield_with_args|yielding with args|
    |a_block_yielding_successive_args|yield_successive_args|a block yielding successive args()|
    |yielding_successive_args|yield_successive_args|yielding successive args()|