...scrollbars ? '==' : '!=' scroll_height.should.send(comparison, offset_height) end This should respect padding. However, I have not tested if margins have an effect on it...
The linked site hosts a simple test. It shows two images with narrow vertical/horizontal lines. The more they resemble each other, the more Retina your display is...
...the usual notification rules, i.e. you won't get anything in the development or test environments. Obiously, this only works with tasks that actually depend on :environment...
...so it should be a drop-in replacement for all your projects. For Rack::Test the step no longer uses XPath so you should be able to understand it when...
...you need additional form fields (like tax IDs) to bill customers in another language. Tests Tests should continue to use the base language you had before starting localization. Don't...
...rewrite all tests and don't test every screens with every language unless repeatedly broken translations becomes a pain point. Do test non-trivial language-specific customizations like the parsing...
RSpec 1 (Rails 2) With the most recent spec_candy.rb helpers you can say: User.stub_any_instance(:foo => :bar) user = User.new...
In most of our applications, users have their first and last name stored in separate columns. However, specifying them separately...
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...
Updated the card with our current best practice (shared app code and specs via symlinks).
Sometimes you need to look at the filter chain in specs. You can do it like that on Rails 2...
...created. When editing a movie there is a "Year" field that can be changed. Testing: Learn techniques Write tests for both exercises. Write multiple variants, each using a different approach...
...you minimize the number of lines of code that now no longer run during tests? Mock out the network request to the API using Webmock Mock out the network request...
In the tradition of our PostgreSQL cheat sheet for MySQL lamers, here is a cheat sheet for Jasmine when you...
.../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...
...pack is application.js): = image_pack_tag('media/application/images/logo.png') Deployment Follow Configuring Webpacker deployments with Capistrano. Tests In your cucumber test, you will want to regenerate your assets before each test suite...
...run. Since this is a bit slow, especially when using multiple processes with parallel_test, read this card. jQuery If you still require jQuery, add it to your webpacker project...
...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
Haml HTML generated by Haml 5 HTML generated by Haml 6 %button(up-test) %button(up-test=true) %button(up-test=false) %button(up-test=nil) %button(up-test...
same %button(up-test='false') same %button(up-test='') same Extending the list of attributes considered "boolean" You can add to the list of "boolean attributes", but please do...
...write the password hash to a file: echo firstname.lastname:$2y$05$4JXxd2GM/J2...9c3KJmFS > htpass_test Check, if it is correct: htpasswd -v htpass_test firstname.lastname You probably should not use...
When testing JavaScript functionality in Selenium (E2E), you may need to access a class or function inside of a evaluate_script block in one of your steps. Capybara may only...
...are exporting your definition(s) in Webpacker, these won't be available in your tests (and neither in the dev console). The following principles/concepts also apply to Sprockets.
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...