mdgnkm mdgnkm - 6 months ago 53
Ruby Question

How do you log to the Rails log file in Cucumber?

Is there a way to log to the test.log file in Cucumber for Rails?

Using cucumber 1.3.15, cucumber-rails 1.4.1, and rails 4.0.3

Answer

Rails.logger works just fine in step definitions, e.g.

Given /^I log on to the Internet$/ do
  Rails.logger.info "Logging on ..."
end