以下の内容はhttps://tbpgr.hatenablog.com/entry/20140416/1397653436より取得しました。


RSpec | rspec command | example option

概要

rspec command | example option

詳細

rspec commandのexample optionで
・特定の一つのexampleのみ実行
・特定の名前に一致するexampleを全て実行
・example optionを複数回指定して複雑な条件で任意のテストを実行する
などのようなことができます。

サンプルコード1(hoge_spec.rb)
# encoding: utf-8
require "spec_helper"
require "hoge"

describe Hoge do
  it "hoge1 1" do
    # some spec
  end

  it "hoge1 2" do
    # some spec
  end

  it "hoge2" do
    # some spec
  end
end
サンプルコード2(hige_spec.rb)
# encoding: utf-8
require "spec_helper"
require "hige"

describe Hige do
  it "hige1 1" do
    # some spec
  end

  it "hige1 2" do
    # some spec
  end

  it "hige2" do
    # some spec
  end
end
実行例:hoge1 1だけを実行
$ rspec -e 'hoge1 1'
Run options: include {:full_description=>/hoge1\ 1/}
.

Finished in 0.001 seconds
1 example, 0 failures
実行例:hoge1 1, hoge1 2を実行
$ rspec -e 'hoge1'
Run options: include {:full_description=>/hoge1/}
..

Finished in 0.001 seconds
2 examples, 0 failures
実行例:describe Hoge以下のexampleを全て実行
$ rspec -e 'Hoge'
Run options: include {:full_description=>/Hoge/}
...

Finished in 0 seconds
3 examples, 0 failures
実行例:hoge1 1, hoge1 2, hige1 1,hige1 2を全て実行
rspec -e 'hoge1' -e 'hige1'
Run options: include {:full_description=>/(?-mix:hoge1)|(?-mix:hige1)/}
....

Finished in 0 seconds
4 examples, 0 failures



以上の内容はhttps://tbpgr.hatenablog.com/entry/20140416/1397653436より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14