0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Rspec | named_let does not work for match_array / contain_exactly

Last updated at Posted at 2019-04-16

named_let is a gem for Rspec. The symbol given to let displays the test result.

But.

Test content

 require 'spec_helper' describe do subject { [Object.new, Object.new] } named_let(:instances) { subject } it { should contain_exactly(*instances) } end 

result

 rspec -fd test_spec.rb 

Instead of the name given in named_let, the content (in this case, the instance is displayed as it is.

  should contain exactly #<Object:0x007fcb73c525b0> and #<Object:0x007fcb73c52588> Finished in 0.90819 seconds (files took 11.2 seconds to load) 1 example, 0 failures 

environment

  • named_let (0.1.5)
  • rspec-rails (3.1.0)

Original by

Rspec | named_let は match_array / contain_exactly には効かない

About

About this translattion

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?