Test suites usually grow over time as more and more development time is spent on a projects. Overall run-time and performance of Cucumber suites in turn increases, too.
...setInterval and setTimeout calls from tabs that are currently in the background. You can test it yourself by running the test below and change to a different...
...tab during its runtime. The expected runtime drastically increases in Chrome, Firefox and Safari: https://testbed.nicon.nl/timeouttest/ See also: Stop animations and network polling when the document tab isn't...
...lazy, i.e. page 2 is only requested after page 1 is done processing in tests, I could write video_service.each_video.to_a.should == [video_1,...] Lazy enumerators It is possible to chain methods on...
Sidekiq.configure_client do |config| if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test' stdout_logger = ActiveSupport::Logger.new(STDOUT) file_logger = ActiveSupport::Logger.new("log/sidekiq_#{ENV['RAILS_ENV']}.log")
end Sidekiq.configure_server do |config| if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test' stdout_logger = ActiveSupport::Logger.new(STDOUT) file_logger = ActiveSupport::Logger.new("log/sidekiq_#{ENV['RAILS_ENV']}.log")
to add the Ruby, Rails and RSpec cops to include the unit test 2. Report all existing offenses and exclude them initially To start your Rubocop integration it...
...rubocop --auto-gen-config to create a file that excludes all current violations. Your tests (including the Rubocop spec) should now all be green. Commit theses changes and consider whether...
...it becomes more difficult to optimize this query when joining other records (for my tests PostgreSQL was not able to use the GIN index on the joined table within a...
In tests, it is sometimes useful to create records with specific ids. On PostgreSQL this can cause problems: Usually, PostgreSQL uses an "autoincrement" sequences to provide sequential ids for new...
...cause an SQL error 'duplicate key value violates unique constraint "records_pkey"' Workaround In tests, one workaround would be to simply initialize all sequences with a large value, so that...
...receive(:env).and_return('production'.inquiry) puts Rails.env # prints "production" end puts Rails.env # prints "test" Note that, when overriding pre-existing mocks inside the block, they are not reverted to...
...See our libvips with CarrierWave card for: Converting colors to sRGB Stripping color profiles Testing ImageMagick provides a compare utility which can be used to measure color differences between two...
...compare writes it's result to STDERR. A lower score is better, I'd test for a threshold like <= 5. There are different comparison metrics available Link to the profile...
...you use Rubocop or Capybara. These gems most often live in your development and/or test group of the Gemfile and require English for you. Therefore to ensure that the library...
...is very important to double-check results to be avoid unexpected consequences. Can I Test Things Locally With a Database Dump? Unfortunately not. Restoring from a logical database backup, i.e...
...an SQL dump, will not reproduce the error and is not suitable for testing changes, since importing dumps will re-create indexes in the first place.
class Client class_attribute :config def self.configure self.config ||= Configuration.new yield(config) end def test uri = URI.parse(FooClient::Client.config.endpoint) Net::HTTP.get_response(uri) end end end module FooClient class Configuration...
...sharing was completed. Note that this will only work on https pages, so to test it in development, you will have to start your development server with SSL...
...only see their own user as an option in the same . Remember to add tests for your authorization code. Tip If you have existing dropdowns that accept a restrict list...
Discussion Discuss with your mentor: We don't want to duplicate our integration tests for every screen and user role. Why? Where to put authorization scenarios? In an authorization.feature...
...text-transform: uppercase - especially on form labels - can cause you serious headaches in Selenium tests. Sometimes the web driver will see the uppercase text, sometimes it won't, and umlauts...
...will be a problem as well. Simply disable it in tests, by adding a body class for tests %body{'data-environment' => Rails.env} overriding the transforms [data-environment="test"] * text-transform...
...display the video. When you deliver your youtube video via https://youtu.be/jyElDp98HdI your test which checks that the embeded video is rendered in the view will fail because your...
...test server doesn't use https Solution Let your links look like //youtu.be/jyElDp98HdI and you will be fine, server side and test side...
...format before you can use it for plotting: Numo.gnuplot do .. # more plot settings plot "'test.csv'", u: "(hist($#{column_to_plot},width)):(1.0)" s: true, f: true, ...
output "hist.jpg" end
...write any array files into a temporary csv file before passing it Numo.gnuplot: CSV.open('test.csv', 'w') do |csv| random_values.zip(additional_values, absolute_values, other_values).each_with_index do |zipped...
...up DOM elements. There are also matchers like have_field to make expectations during tests. These methods also have a number of options to influence the lookup. E.g. the :disabled...
...to use Edge Rider for new projects, which is being actively maintained and has test coverage for all versions of Rails...
...Cucumber the way you want it: Prints some line feeds to easily find your test results when you come back to the console later Configures Cucumber to use cucumber_spinner...
...features if you setup your system that way Runs features in parallel if parallel_tests gem was found in you Gemfile and no rerun.txt with content exists [UPDATE] You can...
In Paperclip you can use the validates_attachment_file_name macro to test the suffix of a filename: class User < ActiveRecord::Base has_attached_file :avatar validates_attachment...
Then I should see a table with exactly the following rows: ... Testing tables with colspan or rowspan Cucumber tables are required to have the same number of...
...cells in every row. This is unfortunate when testing a table that uses colspan or rowspan attributes. The attached step definition offers a workaround for this: Wrap the entire table...
...this prior art when implementing yours? Checklist: I confirm my design implementation has been tested manually by me adheres to the code style of the project (e.g. BEM) avoids "magic...
...navigates through elements in order (or in an order that makes sense). You can test that by clicking into the page, top/left of the new design, and repeatedly pressing the...
...provides some instructions how you can get it to work with your cucumber acceptance tests using selenium webdriver as a capybara driver. Install xvfb if it is not installed yet...
...window, you can tag it with @no-headless. Note: If you are using paralell_tests to run your tests in parallel you have to take care of several things to...