Or rather reading open source code in general
class UserFlowTest < ActionDispatch::IntegrationTest
def test_index
RubyProf.start
get '/users'
result = RubyProf.stop
File.open "a.html", 'w' do |file|
RubyProf::GraphHtmlPrinter.new(result).print(file)
end
assert_equal 200, response.status
end
end
class UserFlowTest < ActionDispatch::IntegrationTest
def test_index
RubyProf.start
User.all
result = RubyProf.stop
File.open "a.html", 'w' do |file|
RubyProf::GraphHtmlPrinter.new(result).print(file)
end
end
end
https://news.ycombinator.com/item?id=7792623
If not, consider starting by writing a failing test.Get a stack trace (e.g. "raise 'omg'"). Set breakpoints (or litter the code with puts statements). Basically you want to follow the input and trace it through the various steps and figure out where did it stop working the way you expect. Sometimes it's easier to do this top-down, sometimes it is easier to go from bottom-up (trace the output back to the input).
http://blog.steveklabnik.com/posts/2012-07-05-how-can-i-contribute-to-ruby-on-rails-
http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html