} let(:list) do ['a', 'b'] + Array.new(count, obj) end context 'given an obj' do it 'counts the occurrences' do expect(list.count(obj)).to eql count end end end
} let(:list) { ['a', 'b'] + Array.new(count, obj) } context 'given an obj' do ... end context 'given a block' do it 'counts the occurrences' do expect( list.count { |o| o == obj } ).to eql count end end end
end before(:example) do # default # do before each test in scope end after(:context) do # do once after all tests in scope end after(:example) do # default # do after each test in scope end
creates a new widget' do visit '/widgets/new' fill_in 'Name', with: 'My Widget' click_button 'Create Widget' expect(page).to have_text('Widget was successfully created.') end end