...use plain ruby scripts, consider lib/scripts/* as folder. Keeping tasks slim For readability and testing it's easier to keep your tasks slim. We suggest to use folders inside the...

...Your code of exporting all users e.g. into a XSLX file end end end Testing should not be optional Tasks should be tested the same way as other code, even...

...explains which threads and processes interact with each other when you run a Selenium test with Capybara. This will help you understand "impossible" behavior of your tests.

...a Rack::Test (non-Javascript) test with Capybara, there is a single process in play. It runs both your test script and the server responding to the user interactions scripted...

...To improve this, I have successfully been using a little "step" helper in my tests. It marks semantic sections, structuring an example while improving documentation. When the test runs, each...

...spec, as well as tracking progress during execution. # # Example: # it 'offers a login' do # # Test setup # # STEP 'Attempt login with wrong credentials' # # ... # # STEP 'Successful login' # # ... # end # Taken from https://makandracards.com...

DevOps Curriculum

Als DevOps Engineer kann es häufiger vorkommen, dass du ein lokales Testsetup bauen musst, um eine bestimmte Software oder ein Tool zu testen. Dafür bieten sich VMs oder Linux Container...

...dein Notebook mit vorkonfigurierten Firewall-Regeln ausgestattet ist. Starte einen (oder mehrere Container) und teste, wie du dich auf der Shell Ebene zu diesen verbinden kannst. Stelle sicher, dass deine...

Capistrano is by default configured to exclude the gems of the groups development and test when deploying to the stages production and staging. Whenever you create custom groups in your...

...deploy, add the following to config/deploy/production.rb and config/deploy/staging.rb respectively: set :bundle_without, %w[development test cucumber deploy].join(' ') Be aware, that gems that belong to two groups, are only excluded...

makandra Curriculum

Using a gem like rails_state_machine Make sure that you have tests for all the changes you make. Note that your E2E-Tests should rather focus on...

...should create records in a state that is useful for the vast majority of tests. Tip We often use state machines to track the state of "wizard forms", i.e. long...

When using Chrome for Selenium tests, the chromedriver binary will be used to control Chrome. To debug problems that stem from Selenium's Chrome and/or Chromedriver, you might want to...

...the chromedriver itself. Here is how. Option 1: Use Selenium::WebDriver::Service In your test setup, you may already have something like Capybara::Selenium::Driver.new(@app, browser: :chrome, options: ...), especially...

Debugging your integration tests, that run a headless Chrome inside a docker image, is tricky. In many cases you can connect your Chrome to a remote docker container like docker...

...be the preferred way when you try to inspect a page within your integration test. Otherwise you might be able to start your docker container with --net=host and access...

...trashed_changed? end Or, move the conditions into the callback. This also allows you test the conditions more easily using a unit test: after_save :update_offices_people_count

if office_id_changed? || trashed_changed? ... end end Also see the card on testing conditional validations...

DevOps Curriculum

...number of words, lines and paragraphs, and outputs the result. For example: $ ruby count_words.rb test.txt test.txt has 123 words test.txt has 13 lines test.txt has 4 paragraphs Hint

puppet.com

...server before the new version can be used. That also means you can't test functions in a different puppet environment. And also if you have changed functions in a...

...different puppet environment (where you e.g. test some new module version) and this environment runs at first after a puppetserver restart, you have this changed functions also in your production...

Geordi's cucumber command has a --rerun option that reruns failing tests the given number of times. Usage: geordi cucumber path/to/features --rerun=2 geordi cucumber path/to/features -r2 Background and how...

...tmp/parallel_cucumber_failures.log containing the filenames and line number of the failed scenarios after a full test run. Normally you can say cucumber -p rerun (rerun is a profile defined by default...

...instead reference another part of that email by a content ID cid:xxxxx@xxxxx.mail. Your tests will not be able to verify easily that you used the correct image version any...

...last point, it is recommended to use a feature flag and disable inlining in tests by default so you will still be able to easily test that your emails use...

...data-environment=<%= Rails.env %>> Now you can say in a piece of Javascript: if (document.documentElement.dataset.environment == 'test') { // Code that should happen in Selenium tests } else { // Code that should happen for other environments...

...Or in your CSS / Sass: html[data-environment="test"] { * { text-transform: none !important; } } See also Cucumber: Detect if the current Capybara driver supports Javascript

makandra dev

...Binding URL with the LogoutResponse. Keycloak does this when Front channel logout is disabled. Testing in development using a local keycloak server You can test this using a local keycloak...

...and is enabled per default This just worked for me, so no troubleshooting here Testing in development using a local keycloak server You can test this using a local keycloak...

...TLSv1.3 gelöst? Du weißt, wie du eine Webseite auf die Sicherheit der SSL Konfiguration testen kannst. Du kennst Certificate Transparency logs und weißt wofür das gut ist.

...Was kannst du hier herausfinden? Wie ist es möglich, dass die Informationen dort vorliegen? Teste makandra.de auf SSL Labs. Schau dir das Testergebnis an und verstehe welche Ergebnisse dir angezeigt...

config.move_to_store = true We have a separate card about that. Store test files separately. Also add support for parallel tests. You can easily do that by setting...

config.root = "#{Rails.public_path}/system/#{Rails.env}#{ENV['TEST_ENV_NUMBER']}".freeze For debugging purposes (e.g. trying to hunt down a staging bug locally), it might make sense to allow reading...

...main').search('horizon').where('year > 1995').order(:year).to_a Adapt both the integration test and RSpec examples for the search functionality, using the guidelines from the "Testing" chapter in...

...Growing Rails Applications in Practice. RSpec examples should cover all edge cases E2E tests should only cover one "happy path" to show successful integration Open budgets in Project Hero (makandra...

github.com

The issue: You are using stub_const to change a constant value for your test. stub_const "SomeClass::CONST", 'test' All of a sudden, tests fail with undefined method 'some...

...workaround, use stub_const in your Rails specs like this: stub_const "#{SomeClass}::CONST", 'test' This will invoke Rails' autoloading and fix RSpec's behavior for you...

makandra Curriculum

...should be ignored and no validation errors should be shown. Make sure to write tests for the showtimes form. How do you refer to the showtimes fields when there are...

...must not contain any code or names specific to movies or the movie form. Test that the component is reusable by allowing to add an actor's roles from within...

This rule needs to be adapted to your setup and needs to be tested before it's activated. Activating lifecycle rules can instantly delete images from registries.

"tagStatus": "tagged", "countType": "sinceImagePushed", "countUnit": "days", "countNumber": 10 }, "action": { "type": "expire" } } ] } Careful when testing Testing these rules is a little confusing because of the wording in the AWS console...

makandra Curriculum

...should have an overview which kinds of validations are built into Rails. Also read Testing ActiveRecord validations with RSpec. Make the following changes to your MovieDB: Make sure your MovieDB...

...for black and white movies and release_year >= 1917 for color movies. Add tests for your validation. Make sure you have a test for each case...

baz: "example" We can now load it as usual, but pass freeze: true. >> test = YAML.safe_load_file('example.yml', freeze: true) => {"message"=>["hello", "universe"], "foo"=>{"bar"=>{"baz"=>"example"}}}

...itself is frozen: >> test.frozen? => true And no matter how deep you dig, everything inside that Hash is also frozen. >> test['message'].frozen? => true >> test['foo']['bar']['baz'].frozen? => true

github.com

...What you can do is change the time zone of the process running your tests by setting a TZ=CET (or TZ=PDT or TZ=UTC etc.) environment variable.

...way, when the test process spawns another process to run a browser, it will inherit the environment and also believe it lives in that zone. To do so, run the...