You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting the following two problems, I'm documenting together, as I strongly suspect they are related to my configuration.
First Problem: I cannot wrap my steps in a describe:
for example:
require'spec_helper'describe'admin pages',js: truedo# remove this and everything works fineRSpec::Steps.steps"orders index",js: truedoit"should login and display the Orders page"dosize_window(:default)@orders=5.times.collectdoFactoryGirl.create(:order,:with_valid_payment)FactoryGirl.create(:order,:with_valid_payment,:from_one_month_ago)FactoryGirl.create(:order,:with_valid_payment,:with_tag)FactoryGirl.create(:order,:with_valid_payment,:with_name)end@admin=FactoryGirl.create(:user,type: "Administrator")login(@admin,then_visit: "/admin/orders")page.find('h1',text: "Orders")page.shouldhave_content("Orders")endit"should show latest orders"doorders=page.all(".order-row",count: 15)orders.count.shouldeq(15)end...
I get this:
/Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/example_group.rb:240:in `block in define_example_group_method': Creating an isolated context from within a context is not allowed. Change `RSpec.describe` to `describe` or move this to a top-level scope. (RuntimeError)
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/dsl.rb:43:in `block in expose_example_group_alias'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-steps-2.1.1/lib/rspec-steps/builder.rb:10:in `build_example_group'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-steps-2.1.1/lib/rspec-steps/dsl.rb:19:in `steps'
from /Users/mitch/railsdev/v4-catprint/spec/integration/admin_spec.rb:5:in `block in <top (required)>'
Note, that if I use the monkeypatch, and simply say steps, I get a slightly different error (perhaps this is a clue?)
/Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/example_group.rb:675:in `method_missing': undefined method `steps' for RSpec::ExampleGroups::AdminPages:Class (NoMethodError)
from /Users/mitch/railsdev/v4-catprint/spec/integration/admin_spec.rb:5:in `block in <top (required)>'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/example_group.rb:385:in `module_exec'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/example_group.rb:385:in `subclass'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/example_group.rb:255:in `block in define_example_group_method'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/dsl.rb:43:in `block in expose_example_group_alias'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/dsl.rb:82:in `block (2 levels) in expose_example_group_alias_globally'
from /Users/mitch/railsdev/v4-catprint/spec/integration/admin_spec.rb:3:in `<top (required)>'
Second (possibly related) problem
In my specs helper if I have:
config.after(:step)do
...
end
I get:
/Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/hooks.rb:591:in `extract_scope_from': You must explicitly give a scope (example, context) or scope alias (each, all) when using symbols as metadata for a hook. (ArgumentError)
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/hooks.rb:578:in `scope_and_options_from'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/hooks.rb:449:in `register'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/hooks.rb:272:in `after'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core/configuration.rb:1651:in `after'
from /Users/mitch/railsdev/v4-catprint/spec/spec_helper.rb:193:in `block in <top (required)>'
from /Users/mitch/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.2/lib/rspec/core.rb:97:in `configure'
from /Users/mitch/railsdev/v4-catprint/spec/spec_helper.rb:123:in `<top (required)>'
Here is the header of the spec_helper.rb if that helps:
require'rails_helper'require'rspec'require'rspec/expectations'require'factory_girl_rails'require'shoulda/matchers'require'database_cleaner'require'capybara/rspec'require'capybara/rails'require'support/user_helper'require'support/component_test_helpers'require'capybara/poltergeist'require'billy/rspec'require'fixtures/doodlebin/stubs'require'timecop'require"rack_session_access/capybara"require'rspec-steps/monkeypatching'# I get the same problems with or without this
...
The text was updated successfully, but these errors were encountered:
Steps is intended, generally, to be used in place of describe; i.e. the steps block is the describe block, but with the added feature of sequentializing the examples within it. So in our practice, we would write your block as:
RSpec::Steps.steps "admin pages orders index", js: true do
That said, I can see cases where you might want to nest steps inside describes in order to simplify your naming. We'll look at whether that can be added in a future version - I'm not immediately certain whether the current architecture can be extended to allow that. Alternatively, we'd welcome a pull request.
Okay that explains the first one - I will at least do a PR on the Readme since this is very unclear. The readme seems to imply that steps can be used inside a describe block, but you can't have context inside of steps which makes sense.
Great Great Gem, thanks so much!
I'm getting the following two problems, I'm documenting together, as I strongly suspect they are related to my configuration.
First Problem: I cannot wrap my steps in a describe:
for example:
I get this:
Note, that if I use the monkeypatch, and simply say
steps
, I get a slightly different error (perhaps this is a clue?)Second (possibly related) problem
In my specs helper if I have:
I get:
Here is the header of the spec_helper.rb if that helps:
The text was updated successfully, but these errors were encountered: