40
36

More than 5 years have passed since last update.

RSpecでヘルパーメソッドを定義する

Last updated at Posted at 2013-12-17

複数のテストケースで共通する処理を別メソッドに置きたい場合、以下のようにヘルパーメソッドを定義する事ができる。

describe a test group do

  def my_helper_method
     :available
  end

  it has access to methods defined in its group do
    expect(my_helper_method).to be(:available)
  end
end
40
36
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
40
36