Exploring available methods in pry with ls

Suppose that you’re testing Rails mailer and you would like to test if body contains ‘hello there!’ in it. The problem is that you have forgotten what’s the name of the matcher.

describe 'Mail body' do
  it { binding.pry;is_expected.to eql 'hello there' }

eql does not cut it so you put binding.pry. When tests stops at that point you can make use of ls command. Think of it as standard shell ls equivalent.

EmailSpec::Matchers#methods: bcc_to  be_delivered_from  be_delivered_to  cc_to  deliver_from deliver_to  have_body_text  have_header  have_reply_to

See for yourself! As an exercise try to play with cd