24
24

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 5 years have passed since last update.

rspec3で複数のテストをまとめてpending

Last updated at Posted at 2014-09-22

rspecにて以下のようなコードで特定のexampleをpendingに出来るのはもちろんご存知ですね。この例だと3つあるexampleの内、最初の一つがpendingになります。

describe User do
  describe 'validations' do
    describe 'username' do
      xit { is_expected.to    allow_value('hamada_akira').for(:username) }
      it { is_expected.to_not allow_value('hamada-akira').for(:username) }
      it { is_expected.to_not allow_value('hamada.akira').for(:username) }
    end
  end
end

contextやdescribeについてもxでpending出来ないかな?

さすがrspec3。複数のテストを一気にpendingしたいなぁ〜、という時は以下のようにdescribeについてもxdescribeできます。contextについても同様にxcontextでpending出来ます。

describe User do
  describe 'validations' do
    xdescribe 'username' do
      it { is_expected.to     allow_value('hamada_akira').for(:username) }
      it { is_expected.to_not allow_value('hamada-akira').for(:username) }
      it { is_expected.to_not allow_value('hamada.akira').for(:username) }
    end
  end
end

RSpec 3の重要な変更(example groupの新しいエイリアス)

24
24
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
24
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?