Test e-mail dispatch in Cucumber
Spreewald has steps that let you test that e-mails have been sent, using arbitrary conditions in any combination.
The attached file is for legacy purposes only.
Related cards:
Test your application's e-mail spam scoring with mail-tester.com
You can use mail-tester.com to check your application's e-mails for issues that might cause e-mails to be classified as spam.
They provide a one-time e-mail addresses that you can use to sign up etc. You can then c...
Never write a Cucumber step definition again with Cucumber Factory - Gem Session: gem
I love Cucumber, but I hate writing step definitions. They are ugly, awkward to write and very, very boring: Most step defintions merely create objects for a scenario to chew on.
Cucumber: How to find unused step definitions
Cucumber has an output format that prints step definitions only. You can use this to find unused ones:
- Temporarily add
require_relative 'env'
to the top of the first file in features/support.--dry-run
makes Cucumber skip loadingenv.rb
....
Reload the page in your Cucumber features
Both these approaches will keep your GET
parameters -- and will only work for GET
requests.
-
Capybara:
When /^I reload the page$/ do visit [ current_path, page.driver.request.env['QUERY_STRING'] ].reject(&:blank?).join('?')
...
Cucumber: Calling multiple steps from a step definition
When refactoring a sequence of steps to a new, more descriptive step, you can use the steps
method and Ruby's %-notation like this:
Given 'I have an article i...
Disable Rails XSS protection in ActionMailer views
This might eventually be fixed by Rails itself.\
Right now this is the way to have the rails_xss plugin not escape the body of ActionMailer mails.
Put this into config/initializers/mailers_without_rails_xss.rb
:
How to send a test e-mail from shell
If you want to manually check if e-mail delivery works on a machine by sending an e-mail you can run the following:
mail -s Test someone@example.com < /dev/null
This will send an empty e-mail with "Test" as its subject to `someone@example.com...
Escaping of quotation marks in Cucumber steps and step definitions
Issue
When you have a Cucumber step like
Then I should see "Did you see those \"quotation marks\" over there?"
you'll run into trouble. Cucumber won't take your escaped quotation marks.
Workarounds
One workaround is to write the ...
Ruby's percent notation can do more than strings
Percent Notation
We already know that that we can create strings using the percent notation:
%(<foo="bar's ton">)
is perfectly fine Ruby.
Modifier
Bu...