LRDesign / rspec-steps

Stepwise operation for rspec
MIT License
72 stars 9 forks source link

calling after(:step) raises an error in RSpec #22

Closed IdahoEv closed 8 years ago

IdahoEv commented 9 years ago

I attempted to convert xing-application-base to use rspec-steps 2.0.1. After patching shared_steps (see PR #7 ), waterpig's attempt to hook in after(:steps) in Waterpig::SnapStep.included results in the following error with RSpec:

/Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:536:in `extract_scope_from': You must explicitly give a scope (example, context, suite) or scope alias (each, all) when using symbols as metadata for a hook. (ArgumentError)
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:526:in `scope_and_options_from'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:490:in `register'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:185:in `before'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/waterpig-0.6.1/lib/waterpig/browser-integration.rb:38:in `included'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1065:in `include'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1065:in `safe_include'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1059:in `block in configure_group'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1057:in `each'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1057:in `configure_group'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/world.rb:87:in `configure_group'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/example_group.rb:356:in `set_it_up'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/example_group.rb:323:in `subclass'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/example_group.rb:219:in `block in define_example_group_method'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/dsl.rb:41:in `block in expose_example_group_alias'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-steps-2.0.1/lib/rspec-steps/builder.rb:10:in `build_example_group'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-steps-2.0.1/lib/rspec-steps/dsl.rb:19:in `steps'
    from /Users/evan/Development/Xing/apps/xing-application-base/e2e_tests/features/admin_signs_in_and_creates_page_spec.rb:2:in `<top (required)>'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `block in load'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `each'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `load_spec_files'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:96:in `setup'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:84:in `run'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/gems/rspec-core-3.1.7/exe/rspec:4:in `<top (required)>'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/bin/rspec:23:in `load'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/bin/rspec:23:in `<main>'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/bin/ruby_executable_hooks:15:in `eval'
    from /Users/evan/.rvm/gems/ruby-2.2.2@xing/bin/ruby_executable_hooks:15:in `<main>'
nyarly commented 9 years ago

@IdahoEv - what version of waterpig were you using? I seem to remember updating waterpig because the kind of hooking it does is no longer possible. User specs can use after(:steps), but library code needs to go back to using `after(:each)

IdahoEv commented 9 years ago

I don't have it in front of me but it was whatever version was in xing-application-base over the weekend. On Oct 21, 2015 21:01, "Judson Lester" notifications@github.com wrote:

@IdahoEv https://github.com/IdahoEv - what version of waterpig were you using? I seem to remember updating waterpig because the kind of hooking it does is no longer possible. User specs can use after(:steps), but library code needs to go back to using `after(:each)

— Reply to this email directly or view it on GitHub https://github.com/LRDesign/rspec-steps/issues/22#issuecomment-150100100 .

nyarly commented 9 years ago

I'll pick this up over there then.

nyarly commented 9 years ago

Confirming: that's XingFramework/xing-application-base@integration_specs_in_root_105523332 ?

nyarly commented 8 years ago

This is confirmed as an issue with non-DSL tools using before(:steps) - Waterpig has been updated to correct this, and local spec_helper or spec_support files need to be as well. Consider before(:step) deprecated - use :each instead.