You can only do this if you are testing Capybara using a javascript driver such as Selenium or Poltergeist. Using rspec / capybara and selenium, you can do it like this:
text = page.driver.browser.switch_to.alert.text
expect(text).to eq 'Message you are looking for'
, , , , , . , .