LoginSignup
18
11

More than 5 years have passed since last update.

Rspec特定のテストのみを実行する

Last updated at Posted at 2018-01-14
Rspec.describe Test, type: :model do
  describe "#testA" do
    context "pattern-a" do
       ...
    end
  end

  describe "#testB" do
    context "pattern-a" do
      ... 
    end
  end
end

上記のようなテストがあったときに#testAのみを実行したい場合などがある
その場合

Rspec.describe Test, type: :model do
  describe "#testA", type: :doing do
    context "pattern-a" do
       ...
    end
  end

  describe "#testB" do
    context "pattern-a" do
      ... 
    end
  end
end

describe "#testA", type: :doing doのようにタグをつけてあげ、

$ bundle exec rspec --tag type:doing ファイルパス

これで特定のテストのみを実行できる

18
11
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
18
11