...will encounter validation errors being added twice occasionally. This happened to me when during tests: a spec was referring to Foo, which was not yet loaded, because it was in...
...ran its manual validation method twice. Consider the fun you'll have when running tests in parallel...
...to organize features in subdirectories, you won't have any problems when running the whole test-suite. Cucumber will automatically load and run features in subdirectories, too. However, running features...
...working on the project don't have to provide the option for every cucumber test run execution...
After installing Bundler 1.1 you will get the following warning when running tests: WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is...
To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile The warning is misleading because it has nothing to do with moving cucumber-rails...
...their default distribution from Ubuntu 14.04 (trusty) to 16.04 (precise). This might break your test setup for new builds. You can solve this issue by freezing your test distribution in...
...builds might have started failing on the usual psql -c 'create database active_type_test;' -U postgres with an error psql: could not connect to server: No such file or...
Travis CI is a free continuous integration testing service. However, it is really fragile and will break more than it will work. If you choose to use it anyway, learn...
...add before_script: rvm rubygems latest-1.8 --force to .travis.yml. However, if you run tests for multiple Ruby versions, you need to add before_script: travis:prepare to .travis.yml. In...
...already have a database.yml which defines the database for the cucumber environment instead of test. (Spreewald database.sample.yml has changed) Fix Change cucumber to test in your databse.yml test: # <--- adapter: mysql2...
...database: spreewald_test encoding: utf8 host: localhost username: root password: password
If your application does something specific on certain hostnames and you want to test this in a feature, you need to tell Capybara to assume a different host.
...scenario (i.e. you do not need an After step to clean up). Notes: Selenium tests will actually visit the app_host, so you can't really use it for those...
...that has two disadvantages: You're doing something that never happens in reality. Your tests shouldn't do things your code never does. You're fiddling with internal state. When...
...writing tests, stay on your chosen abstraction level. Solution 1 record.unmemoize_all Solution 2 Perform a full reload by re-finding your record: it 'updates on changes' do subject.seat_counts...
...SOAP API, you may want to use Savon::SpecHelper to mock requests in your tests as described in their documentation. When sending a message body, the savon mock object requires...
...note: You could use VCR to record your SOAP talk. In my case my tests had to talk to the same service the staging servers talk to, so any recorded...
.../home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/capistrano-3.14.1/lib/capistrano/tasks/deploy.rake:90:in `block (5 levels) in <top (required)>' 11: from /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:50:in `test' 10: from /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:137:in `create_command_and_execute' 9: from /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:137:in `tap...
Our rspec_candy gem now gives you three matchers: be_same_number_as Tests if the given number is the "same" as the receiving number, regardless of whether you're...
...purposes". Internally the matcher compares normalized results of #to_s. be_same_second_as Tests if the given Time or DateTime is the same as the receiving Time or DateTime...
capybara-lockstep can help you with flaky end-to-end tests: This Ruby gem synchronizes Capybara commands with client-side JavaScript and AJAX requests. This greatly improves the stability of...
...a full-stack integration test suite, even if that suite has timing issues...
require 'spreadsheet' Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => 'test' money_format = Spreadsheet::Format.new :number_format => "#,##0.00 [$€-407]" date_format = Spreadsheet::Format.new :number_format => 'DD.MM.YYYY...
...sheet1.column(2).default_format = date_format sheet1.row(0).push "just text", 5.98, DateTime.now book.write 'test.xls' That's how to insert Links into a excel cell book = Spreadsheet::Workbook.new sheet1 = book.create...
...and qualified:fields') This trait used to be a huge blob of code without tests and documentation, so I made a gem out of it. Check out https://github.com/makandra/dusen...
...for code, tests, and a huge README. You should use the Dusen gem and delete SearchableTrait in all future projects. Note that the syntax to define query processors has changed...
...SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=unknown state SSL Server Test This SSL Server Test can help finding out which SSL/TLS versions the server can handle...
...server from time to time. Before doing a full deploy, you might want to test that server in an isolated deploy. There is a single way to do this: the...
...run for servers matching {:roles=> }, but no servers matched. Instead, specify the server-under-test like this: HOSTFILTER=separate-sidekiq.makandra.de cap production deploy Capistrano is aware of this env variable and...
...from you Rails timezone settings / system timezone. I usually have this use case in tests. Example Time.parse('2020-08-09 00:00') will return different results e.g...
...headless chrome via Selenium. This might be useful for debugging issues with flaky integration tests or slow page simulations. page.driver.browser.network_conditions = {offline: false, latency: 5, download_throughput: 2 * 1024, upload...
...staging', 'production']. Remove better_errors from Gemfile if existing and bundle. With Raven.capture_message('Test from development') you can test your setting on console. Raising an exception will now report...
Sometimes you need a file of some size (possibly for testing purposes). On Linux, you can use dd to create one. Let's say you want a 23 MB file...
...called test.file. You would then run this: dd if=/dev/zero of=test.file bs=1048576 count=23 The block size (bs) is set to 1 MB (1024^2 bytes) here, writing...
In Ruby you can communicate between processes with sockets. This might be helpful in tests that validate parallel executions or custom finalization logic after the garbage collector. Here is an...
...through of unknown options to Cucumber Add --rerun=N option to rerun failed Cucumber tests up to N times. Reboots the test environment between runs, thus will pick up fixes...
If you want to freeze a different version of a dependency for your tests, prefer putting it into the Gemfile in your gem project directory. In the example above...
...gemspec like this: spec.add_dependency 'activesupport' Then, in your Gemfile, add the dependency for tests: gem 'activesupport', '~> 2.3'
This describes how to migrate an existing cucumber test suite to Spreewald. Add the gem Include spreewald into your cucumber environment by putting require 'spreewald/web_steps' require 'spreewald/email_steps' # ... or just
...web_steps, shared_steps, table_steps, email_steps etc. Comment it out. Run your test suite. It will probably complain about missing steps, those that didn't make it into...