...servers. It spins up when you run your feature specs, so that you can test your purchase flow without hitting Stripe’s servers or making any external HTTP requests.
...ve also had tests actually hitting the testing sandbox of Stripe, which worked OK most of the time (can be flakey...
...the following command open a database console for the development environment: rails dbconsole -p test You need to write this instead: rails dbconsole test -p
So you can easily add new roles to a user model and start testing without adding new traits by yourself. Note: If you not provide a second argument to...
...implement sending an error notification if the data (in the db) is too old. Testing: If you use sidekiq_retries_exhausted (unit test): https://stackoverflow.com/questions/33930199/rspec-sidekiq-how-to-test-within-sidekiq-retries-exhausted-block-with-another If you use the...
...global option (manual test): # Use this worker to test if the exception notifier for sidekiq works as expected and the retries total duration fits. # Example: TestWorker.perform_async('foo', 'bar')
I recently encountered the error above when I was running selenium tests. Thanks to a post on stackoverflow I found out that clearing all files in tmp/cache in my project...
Sometimes you want to test migrations with production or staging data. Dumping single tables makes sense if a complete dump would be to big. mysqldump -u deploy_user -p application...
To test that an object was constructed by a given constructor function, use jasmine.any(Klass): describe('plus()', function() { it ('returns a number', function() { let result = plus(1, 2) expect(result...
This step will pass if the specified select is sorted. Then /^the "(.*?)" select should be sorted$/ do |label, negate|
...gem you often hook onto events like this: update.before do do_something end For testing such things in your controller you should -- as always -- not trigger something that eventually calls...
.../public/assets-test/', '/tmp/', ] } 2. Report all existing offenses and exclude them initially Add an RSpec test, which runs ESLint (also during a full RSpec test run), e.g. in spec/eslint_spec.rb: require 'open3...
expect(status.success?).to eq(true), failure_message end end Run the test or simply run yarn run eslint . from your console to check all files. Now you...
Capybara will match elements outside of a page's tag. For example, the step definitions below match nodes in a...
Our collection of the most useful Cucumber steps, Spreewald, now supports exact matching of form fields and lets you use...
I am talking about development speed. When your application starts growing and you start adding gems, it starts to take...
The step definition below lets you say: Then I should see a field "Password" But I should not see a...
This is surprisingly difficult when there is a with the same text on the page, but you really want to...
The step definition below allows you to write: Then I should see a link labeled "Foo" But I should not...
Use bundler > 1.15 to fix Gem::LOADED_SPECS_MUTEX (NameError). Given the following project: ruby -v ruby 1.8.7
Great presentation about writing Javascript like you write everything else: Well-structured and tested. JavaScript is no longer a toy language. Many of our applications can’t function without it...
...and love work just as well in JavaScript as they do any other language. Test driven development forces us to write modular, decoupled code...
The step definitions below allow you to write this in both Webrat and Capybara: When I follow "Download as PDF...
Don't simply test for the presence of the magic Paperclip attribute, it will return a paperclip Attachment object and thus always be true: - if user.photo.present? # always true
Reading user input in console applications is usually done using Kernel#gets. Stubbing that can be a bit hairy.
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...
Here's a pretty useful steps that hasn't made it into Spreewald yet. It is best used with the...
Copy the attached file to features/support. This gets you a convenience method: Capybara.javascript_test? Is true for Selenium, capybara-webkit, Poltergeist and a custom driver called :chrome (which we sometimes...