How is it possible to use before and after hooks in feature specs just for one of scenarios only ?
I tried to use one as follows:
feature "Operations page" do
... some scenarios are omitted...
scenario "List all operations with pagination" do
before(:all) do
31.times do
create(:deposit,
value_date: Date.today,
sum: 1000,
rate: 2.5,
withholding: 12,
close_date: Date.today + 3.months)
end
end
expect(page).to have_selector('div.pagination')
end
and getting the error:
Failure/Error: before(:all) do
NoMethodError:
undefined method `before' for #<RSpec::Core::ExampleGroup::Nested_1:0x5a3b328>
It's OK to use 'background' but it will be executed before each of the feature scenarios if I'm not mistaken. Right ?
I'm using RSpec 2.14.2
Ruby 2.0.0p353
Rails 4.0.3
Thank you.