...can use this command: :%s/{{\([^\}]*\)}}/%{\1}/cg Fix deprecation warnings with :overwrite_params Run tests Deploy See the commit log for a detailed list of changes. 2.3.9 to 2.3.10
...Upgrade rails gem Change your environment.rb so it says RAILS_GEM_VERSION = '2.3.10' Run tests Deploy Also see commit log. From 2.3.10 to 2.3.11 Fixes multiple security issues.
Code splitting is a feature of esbuild that can keep huge libraries out of the main bundle. How code splitting...
...using inheritance, modules, traits or partials. When you reuse behavior you want to reuse tests as well. You are probably already reusing examples in unit tests. Unfortunately it is much...
...harder to reuse code when writing integration tests with Cucumber, where you need to express yourself with Gherkin and step definitions instead of Ruby classes and methods.
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.
...a MIT-based polyfill called Hyphenopoly. It applies JS-based hyphenation if a feature test shows that CSS based hyphenation is not supported for the given locale. Note that Hyphenopoly...
...can no longer search for the full word in the pasted text. Note that test browsers will also see the soft hyphens, which makes testing uncomfortable. Automatic insertion of soft...
.../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...
...you use that "db count" and process the loaded elements. A common example is tests: Imagine a test that sets up a few records and finishes the test setup by...
...records have loaded (i.e. cached) their associations too early and now are missing elements. Tests relying on the setup will fail, because they will operate on the loaded records. You...
...your config/database.yml: default: &default adapter: postgresql # ... variables: statement_timeout: 10s # or ms, min, etc Test that it works: ActiveRecord::Base.connection.execute("show statement_timeout;").map { |row| row } => [{"statement_timeout"=>"10s"}]
...by adjusting your config/database.yml: default: &default adapter: mysql2 # ... variables: max_execution_time: 10000 # ms Test that it works: begin ActiveRecord::Base.connection.execute("SELECT 1 WHERE sleep(15)") rescue ActiveRecord::StatementTimeout => e...
...authorized users only 3. Using the same storage folder for multiple Rails environments or test processes This one affects your developers. If an image with ID 4 always ends up...
...as public/system/images/4.jpg, multiple Rails environments (e.g. development and test) will randomly see and overwrite each other's files. See Always store your Paperclip attachments in a separate folder per environment...
...s unhandled prompt behavior to { default: 'ignore' } with the monkey patch below. When running tests in a real browser, we use Selenium. Each browser is controlled by a specific driver...
...receive a Selenium::WebDriver::Error::UnexpectedAlertOpenError. This is probably what you want for running tests. Different types of prompts It is possible to handle different types of prompt separately. For...
...KB or Zousan. You can even polyfill Promise with jQuery itself using 339 bytes. Testing async code We want to test this code: whenLoaded = new Promise(function(resolve, reject) { $(resolve...
...function foo() { } function callFooWhenLoaded() { whenLoaded.then(foo) } This test fails: describe('callFooWhenLoaded()', function() { it('calls foo()', function() { spyOn(window, 'foo') callFooWhenLoaded() expect(foo).toHaveBeenCalled() }) }) The test fails since we're expecting...
...has the line gem 'rails', '~>5.2'). I also experienced that doing upgrades per group (test, development) are easier to do. Thus --groups might also be helpful. $ bundle outdated --strict --groups...
...newest 5.2.6, installed 5.2.4.6) ... ===== Group "development" ===== * binding_of_caller (newest 1.0.0, installed 0.8.0) * parallel_tests (newest 3.7.3, installed 2.32.0) * query_diet (newest 0.7.0, installed 0.6.2) * spring (newest 2.1.1, installed...
...not part of the same network. Maybe you want to use your phone to test a web page, but are only in a guest WiFi. In the past, we often...
...local machine on port 3000. This can also be useful if you need to test with TLS, without having to jump through the hoops of creating some self-signed TLS...
...started your screen reader you can simply navigate to whatever application you want to test and the screen reader will start to do its thing. If your screen reader isn...
...the application. If that still does not work, then the application you want to test may not be supported. Since we are usually building websites though, that should not pose...
...displays a beforeunload confirmation dialog, ChromeDriver will immediately close it. In consequence, any automated tests which try to interact with unload prompts will fail. This is because ChromeDriver now follows...
...that any unload prompts should be closed automatically. However, this applies only to "HTTP" test sessions, i.e. what you're using by default. The spec also defines that bi-directional...
Environment Adapter Jobs Run In Worker Needed? development :async Rails server process No test :test Not executed (stored) No production :solid_queue Separate worker Yes (bin/jobs) Development (:async)
SolidQueue::FailedExecution.last&.error # Find specific job SolidQueue::Job.where(class_name: 'HelloJob').last Test (:test) Jobs are not executed and only stored for assertions. Spawning a debugger will work...
...you are using database-cleaner with DatabaseCleaner.strategy = :transaction, this could lead to problems in tests. You should use DatabaseCleaner.strategy = :truncation for the tests that touch your parallelized code...
...T06:22:17.484221 #2698200] INFO -- : [4cdad7a4-8617-4bc9-84e9-c40364eea2e4] test I, [2024-01-21T06:22:17.484221 #2698200] INFO -- : [4cdad7a4-8617-4bc9-84e9-c40364eea2e4] more
...T06:22:17.484221 #2698200] INFO -- : [6e047fb3-05df-4df7-808e-efa9fcd05f87] test I, [2024-01-21T06:22:17.484221 #2698200] INFO -- : [6e047fb3-05df-4df7-808e-efa9fcd05f87] more
Click around a bit. Fix all errors you can find. Fix tests Fix unit tests. Fix integration tests. Upgrade to new framework defaults Flip each config in...
...change the config.load_defaults to the new Rails version. Fix deprecation warnings. Run your tests and fix all deprecation warnings. If you have added many constraints in your Gemfile to...
The Rails sandbox In development, Rails' sandbox mode might be useful. Testing and the migration codebase The migration code should live in some subdirectory in the project...
...steps, instead of implementing some complicated Sidekiq batch logic etc. You need to write tests as you will usually have to refactor your code several times, and need to know...
...No power to ['creatable_cards'] The reason for this behavior is that the Capybara test server is running in another thread, and the RSpec thread can't "see" the exception...
...not write such assertions in feature specs anyway. Instead, you could: write the same test as a request spec expect what the user sees in this situation, e.g. an error...
...work across all revisions that you will be bisecting. If you're referencing a test file that's under version control, make sure you always run the correct test.There are...
...complicated at first, but there are use cases where it helps to write precise tests. For example it allows to add expectations on objects that will only be created when...
Also see here for further examples. Please note: Usually it is preferrable to test behaviour, not method calls. Since the behaviour of both validators is thoroughly tested in their...