gauge-ruby icon indicating copy to clipboard operation
gauge-ruby copied to clipboard

Refactoring is giving a undefined method error

Open sswaroopgupta opened this issue 9 years ago • 3 comments

Expected Behavior Refactoring should not give us an error

Actual Behavior Getting the following error with parameter mismatch in step annotation and implementation.

Cannot perform refactoring: undefined method `children' for nil:NilClass 

Steps to replicate

  1. Create a spec
Specification Heading
=====================
ability to add product
----------------------
tags: shopping basket

* Add "product" to basket1
  1. Create an implementation with parameter mismatch
step 'Add <product> to basket1' do 
  puts product
  assert_equal(product, 'product')
  assert_equal(name, 'Gauge')
end
  1. refactor from the command line
gauge --refactor "Add \"product\" to basket1" "Add \"product\" to basket2"

getting the above error.

Version

Gauge version: 0.6.1.nightly-2016-07-25

Plugins
-------
csharp (0.9.1.nightly-2016-07-25)
html-report (2.1.1.nightly-2016-07-20)
java (0.5.1.nightly-2016-07-25)
ruby (0.3.1.nightly-2016-07-25)

sswaroopgupta avatar Jul 26 '16 08:07 sswaroopgupta

Unable to reproduce this with latest HEAD. Could you try doing:

$ bundle
$ bundle exec gauge --refactor "Add \"product\" to basket1" "Add \"product\" to basket2"

kaustavdm avatar Aug 22 '16 10:08 kaustavdm

This issue is still replicable Cannot perform refactoring: undefined method `children' for nil:NilClass

Gauge version: 1.0.1.nightly-2018-07-31
Commit Hash: 4ae7c9a

Plugins
-------
ruby (0.5.2.nightly-2018-07-31)

sswaroopgupta avatar Dec 15 '16 06:12 sswaroopgupta

With bundle exec gauge refactor "Add \"product\" to basket1" "Add \"product\" to basket2"

  • the spec file is not changed
  • In the implementation file step annotation text changes to Add instead of the entire text.

sswaroopgupta avatar Aug 02 '18 05:08 sswaroopgupta