Hi!
Have you tried to put the scenario in a context?
like
feature 'My feature ' do
context '31 deposits' do
before(:all) do
#your before all
end
scenario 'scenario 1 that use 31 deposits' do
expect()
end
scenario 'scenario 2 that use 31 deposits' do
expect()
end
end
end
/Ester
On Wednesday, June 4, 2014 3:38:03 PM UTC+2, Javix wrote:
>
> 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) doHi!
>
> 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.
>
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/d8ac265e-a02e-47d1-b86e-9fb573c7b0b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.