{"issue":{"created_at":"2011-11-19T07:26:50Z","state":"open","updated_at":"2011-11-28T15:55:54Z","user":{"gravatar_id":"bd75fa9879dc67a44461f53ab38e7d62","id":47326,"url":"https://api.github.com/users/bdmac","avatar_url":"https://secure.gravatar.com/avatar/bd75fa9879dc67a44461f53ab38e7d62?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"bdmac"},"comments":5,"body":"This is an attempt at making steps be callable directly from other steps.  This seems to be a fairly common tendency in Cucumber so I thought we should support it here.  It looks like this:\r\n\r\n``` ruby\r\n  step 'a global step call' do\r\n    step 'there is a monster'\r\n    @monster.should == 1\r\n  end\r\n```\r\n\r\nIt currently does not support tables but I'm thinking Cucumber doesn't either.\r\n\r\nThis feature adheres to the established Turnip module visibility paradigm by respecting the currently active tags for a step.  Global steps are callable from anywhere.  `steps_for` steps are only callable if they would have been callable from directly within the .feature file that is executing the step.\r\n\r\nI had to hack things a bit to make the currently active tags visible to the block being executed in the rspec context so that it could respect the visibility rules.  Here's said hack:\r\n\r\n``` ruby\r\n        context.instance_eval <<-CODE\r\n          def self.active_tags\r\n            #{step.active_tags.inspect}\r\n          end\r\n        CODE\r\n```\r\n\r\nI am open to other ideas on that.\r\n\r\nAlternatives would be to either:\r\n\r\n1. Say only :global steps can be called from within another step.  I can then simply hardcode the tag used for step searching to be :global.\r\n2. Say that ALL steps are callable regardless of tagging.  I would then have to add a method to StepModule to return all defined steps and we would have to look through an inordinately large list when this is done.  This would also lead to problems with ambiguity that steps_for is currently solving since all steps would basically be global when being called this way.","assignee":null,"id":2287423,"number":11,"pull_request":{"patch_url":"https://github.com/jnicklas/turnip/pull/11.patch","html_url":"https://github.com/jnicklas/turnip/pull/11","diff_url":"https://github.com/jnicklas/turnip/pull/11.diff"},"labels":[],"title":"Making steps callable from other steps.","closed_at":null,"html_url":"https://github.com/jnicklas/turnip/issues/11","url":"https://api.github.com/repos/jnicklas/turnip/issues/11","milestone":null},"action":"created","comment":{"created_at":"2011-11-28T15:55:54Z","updated_at":"2011-11-28T15:55:54Z","user":{"gravatar_id":"6c469749d725177dd2837d806c769cd4","id":134,"url":"https://api.github.com/users/jnicklas","avatar_url":"https://secure.gravatar.com/avatar/6c469749d725177dd2837d806c769cd4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jnicklas"},"body":"1) Does it matter if they are turnip tags or not?\r\n2) That's a problem yes\r\n\r\nThe reason we don't do :turnip_tags or something like that, is because then tags from the feature level will not be combined with tags from scenario level, and will instead be replaced.","id":2898624,"url":"https://api.github.com/repos/jnicklas/turnip/issues/comments/2898624"}}