How do I output a variable in a rspec test?
At this moment (Rails 4) you can log it:
p variable
If you want the output to go into the log file (i.e. logs/test.log), you can use the rails logger.
Rails.logger.debug variable.inspect
Rails.logger.debug variable.to_yaml
If you want to see the output in the console, you can use the pretty printer 'pp'.
require 'pp'
it 'does something'
thing = Factory(:something)
pp thing
end
Or you can use good 'ol puts
puts thing.to_yaml