Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom functions not supported in steps? #16

Closed
NobbZ opened this issue Nov 22, 2011 · 5 comments
Closed

Custom functions not supported in steps? #16

NobbZ opened this issue Nov 22, 2011 · 5 comments

Comments

@NobbZ
Copy link

NobbZ commented Nov 22, 2011

Hi!

I am going to move from cucumber to turnip, but while converting my steps an error occured...

The converted stepfile can be found at https://github.com/NobbZ/webworld/blob/feature/turnip/spec/turnip_steps.rb

When I try to run a feature that requires a login I get the following error:

  1) Users Logging in
     Failure/Error: Turnip::StepDefinition.execute(self, Turnip::StepModule.all_steps_for(*scenario_tags), step)
     undefined method `log_in' for #<RSpec::Core::ExampleGroup::Nested_3::Nested_1:0x00000004240960>
     # spec/turnip_steps.rb:20:in `block in <top (required)>'

Is there a way to use my "log_in" function or do I have to repay myself and write the necessarely commands in every step that should use this function?

@jnicklas
Copy link
Owner

There are actually two ways. On edge Turnip (doesn't work in the latest gem release), you could do this:

steps_for :global do
  def log_in ... end
end

Or you could use RSpec's configure mechanism (remember, Turnip is just RSpec with fancy sugar):

module LogInStuff
  def log_in ... end
end

RSpec.configure do |config|
  config.include LogInStuff, :turnip => true
end

or something like that.

@NobbZ
Copy link
Author

NobbZ commented Nov 22, 2011

That seems to work. Now I have to find a way, to get turnip working in RubyMine. But thats another issue, and I can workaround with command line

@NobbZ NobbZ closed this as completed Nov 22, 2011
@jmgarnier
Copy link

If you came here googling, this is useful:

using steps_for(:global) is deprecated, add steps to Turnip::Steps instead.

@naoufalelh
Copy link

That seems to work. Now I have to find a way, to get turnip working in RubyMine. But thats another issue, and I can workaround with command line
@NobbZ
Did you come up with something so that RubyMine can find it way to the step definition when using Turnip?

@NobbZ
Copy link
Author

NobbZ commented Dec 27, 2020

Even if I did, I wouldn't remember anymore. I created the issue 9 years ago and moved along. I do use ruby only on very rare occasions and only for very small scripts without extensive testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants