<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://bridgetownrb.com/" version="2.2.2">Bridgetown</generator><link href="https://peterboling.com/feed/rspec_block_is_expected.xml" rel="self" type="application/atom+xml" /><link href="https://peterboling.com/" rel="alternate" type="text/html" /><updated>2026-11-15T23:03:36+00:00</updated><id>https://peterboling.com/feed/rspec_block_is_expected.xml</id><title type="html">Peter Boling | Rspec_block_is_expected</title><subtitle>Yet Another Paradigm by Peter Boling, featuring technical blog posts about Ruby, JavaScript, TypeScript, Go, Python, DevOps, and various open source projects. Ramblings, mumblings, cv/resume, technical blog, and documentation for many popular, and unpopular, RubyGems and other FLOSS projects, including oauth2, omniauth-identity, sanitize_email, debug_logging, flag_shih_tzu, gem_bench, etc. Semi-lifely state-of-the-petris updates.</subtitle><author><name>Peter Boling</name><email>floss@galtzo.com</email></author><entry><title type="html">rspec-block_is_expected v1.0.5 released!</title><link href="https://peterboling.com/rspec_block_is_expected/rspec-block_is_expected-v1.0.5-released!/" rel="alternate" type="text/html" title="rspec-block_is_expected v1.0.5 released!" /><published>2025-06-01T01:02:21+00:00</published><updated>2025-06-01T01:02:21+00:00</updated><id>https://peterboling.com/rspec_block_is_expected/rspec-block_is_expected-v1.0.5-released!/</id><content type="html" xml:base="https://peterboling.com/rspec_block_is_expected/rspec-block_is_expected-v1.0.5-released!/">&lt;p&gt;&lt;strong&gt;Full Changelog&lt;/strong&gt;: https://github.com/pboling/rspec-block_is_expected/compare/v1.0.4…v1.0.5&lt;/p&gt;</content><category term="release" /><category term="rspec-block_is_expected" /><category term="v1.0.5" /></entry><entry><title type="html">Introducing rspec-block_is_expected</title><link href="https://peterboling.com/rspec_block_is_expected/introducing-rspec-block_is_expected/" rel="alternate" type="text/html" title="Introducing rspec-block_is_expected" /><published>2018-10-01T19:30:16+00:00</published><updated>2018-10-01T19:30:16+00:00</updated><id>https://peterboling.com/rspec_block_is_expected/introducing-rspec-block_is_expected/</id><content type="html" xml:base="https://peterboling.com/rspec_block_is_expected/introducing-rspec-block_is_expected/">&lt;h2 id=&quot;allows-you-to-use-block_is_expected-similarly-to-how-you-would-use-is_expected-if-a-block-was-wrapping-the-subject&quot;&gt;Allows you to use &lt;code class=&quot;highlighter-rouge&quot;&gt;block_is_expected&lt;/code&gt; similarly to how you would use &lt;code class=&quot;highlighter-rouge&quot;&gt;is_expected&lt;/code&gt; if a block was wrapping the subject.&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/pboling/rspec-block_is_expected&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/rt/rspec-block_is_expected.svg&quot; alt=&quot;Total Downloads&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/rspec-block_is_expected&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/rd/rspec-block_is_expected.svg&quot; alt=&quot;Downloads Today&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://codeclimate.com/github/pboling/rspec-block_is_expected/test_coverage&quot;&gt;&lt;img src=&quot;https://api.codeclimate.com/v1/badges/ca0a12604ecc19f5e76d/test_coverage&quot; alt=&quot;Test Coverage&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://codeclimate.com/github/pboling/rspec-block_is_expected/maintainability&quot;&gt;&lt;img src=&quot;https://api.codeclimate.com/v1/badges/ca0a12604ecc19f5e76d/maintainability&quot; alt=&quot;Maintainability&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/rspec-block_is_expected/network&quot;&gt;&lt;img src=&quot;https://img.shields.io/github/forks/pboling/rspec-block_is_expected.svg?style=social&quot; alt=&quot;Network&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/rspec-block_is_expected/stargazers&quot;&gt;&lt;img src=&quot;https://img.shields.io/github/stars/pboling/rspec-block_is_expected.svg?style=social&quot; alt=&quot;Stars&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://rubygems.org/gems/rspec-block_is_expected&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/v/rspec-block_is_expected.svg&quot; alt=&quot;Version&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://travis-ci.org/pboling/rspec-block_is_expected&quot;&gt;&lt;img src=&quot;https://img.shields.io/travis/pboling/rspec-block_is_expected.svg&quot; alt=&quot;Build&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;http://inch-ci.org/github/pboling/rspec-block_is_expected&quot;&gt;&lt;img src=&quot;http://inch-ci.org/github/pboling/rspec-block_is_expected.svg&quot; alt=&quot;Documentation&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://depfu.com/github/pboling/rspec-block_is_expected?project_id=5614&quot;&gt;&lt;img src=&quot;https://badges.depfu.com/badges/272ce0df3bc6df5cbea9354e2c3b65af/count.svg&quot; alt=&quot;Depfu&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.codetriage.com/pboling/rspec-block_is_expected&quot;&gt;&lt;img src=&quot;https://www.codetriage.com/pboling/rspec-block_is_expected/badges/users.svg&quot; alt=&quot;Open Source Helpers&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://gitter.im/pboling/rspec-block_is_expected&quot;&gt;&lt;img src=&quot;https://img.shields.io/gitter/room/pboling/rspec-block_is_expected.svg&quot; alt=&quot;Chat&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://opensource.org/licenses/MIT&quot;&gt;&lt;img src=&quot;https://img.shields.io/badge/License-MIT-green.svg&quot; alt=&quot;License: MIT&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This gem does one very simple thing very well.  It allows you to use &lt;code class=&quot;highlighter-rouge&quot;&gt;block_is_expected&lt;/code&gt; similarly to how you would use &lt;code class=&quot;highlighter-rouge&quot;&gt;is_expected&lt;/code&gt; if a block was wrapping the subject.  Supports the same versions of Ruby that RSpec does, 1.8.7 - current ruby-head, as well as the JRuby equivalents.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;raises&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;block_is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;raise_error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TypeError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you only ever want to test subjects wrapped in blocks, and are comfortable with &lt;strong&gt;losing&lt;/strong&gt; the standard &lt;code class=&quot;highlighter-rouge&quot;&gt;is_expected&lt;/code&gt; behavior, see an alternative to this gem &lt;a href=&quot;https://github.com/christopheraue/ruby-rspec-is_expected_block/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;

&lt;p&gt;Add this line to your application’s Gemfile:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;rspec-block_is_expected&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;group: :test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And then execute:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ bundle
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or install it yourself as:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ gem install rspec-block_is_expected
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;

&lt;p&gt;There is no configuration needed if you your test suite loads the bundle group (e.g. &lt;code class=&quot;highlighter-rouge&quot;&gt;test&lt;/code&gt;) that you added the gem to.&lt;/p&gt;

&lt;p&gt;Otherwise, you may load it manually near the top of your &lt;code class=&quot;highlighter-rouge&quot;&gt;spec_helper.rb&lt;/code&gt;, and it will self configure.&lt;/p&gt;
&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;rspec/block_is_expected&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;

&lt;p&gt;The spec suite for this gem has some examples of usage, lightly edited here.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;RSpec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;TestyMcTest&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;errors raised&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;can be tested&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Where you used to have:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# expect { subject }.to raise_error(TypeError)&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;block_is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;raise_error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TypeError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;execution&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lock&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;can change state&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;locked?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;eq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Where you used to have:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# expect { subject }.to_not raise_error&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;block_is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to_not&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;raise_error&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;locked?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;eq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;changed state&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lock&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;can be tested&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Where you used to have:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# expect { subject }.to change { mutex.locked? }.from(false).to(true)&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;block_is_expected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;change&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mutex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;locked?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><category term="development" /><category term="ruby" /><category term="rails" /><category term="rubygems" /><category term="rspec" /><category term="rspec-block_is_expected" /></entry></feed>