Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rspec]describeとcontextとit #66

Open
sakamoto-rh opened this issue Jul 4, 2013 · 0 comments
Open

[rspec]describeとcontextとit #66

sakamoto-rh opened this issue Jul 4, 2013 · 0 comments

Comments

@sakamoto-rh
Copy link

※題名がrspecですが、下記サンプルは+ capybaraで使う想定になってます。

Q1:それぞれの標準的な使い分けについての確認。
describe
〇〇について
context
〇〇の場合
it
〇〇になること
sample code:

describe 'ログイン画面について' do
  context '初期表示時の場合' do
    it 'タイトルが正しく設定されていること do
      #it 'タイトルが[〇〇システム | ログイン画面]と表示されていること' do
      #↑の例のように答えは書かない。テストする項目を記述すること。
      #なぜなら、以下に書く検証する項目と冗長になるため。
    end
  end
end

Q2:もし、contextの下にさらにグループ化したい場合はdescribe?context?
sample code:

describe '検索画面について' do
  context '初期表示時の場合' do
    describe 'テキストボックスの初期表示について' do
      it '更新日には正しい初期値が入力されていること' do
        #TODO: 本日の日付が入っているテストを記述。
      end
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant