...of the application. For alternatives see Cucumber: Testing file downloads with Selenium. Usage in RSpec feature specs Copy the DownloadHelpers module to spec/support. You can now include the helper in...
...all your feature specs: RSpec.configure do |config| config.include(DownloadHelpers, type: :feature) end Usage in Cucumber scenarios Copy the DownloadHelpers module to features/support. Then include the helper in your scenarios and...
Currently we often use geordi to run cucumber and rspec tests. Geordi takes care of installing a matching chromedriver for the installed google-chrome binary. The google-chrome binary is...
...DatabaseCleaner configured to take care of not bloating your test database with old records: RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.clean_with(:deletion) end config.before(:each) do DatabaseCleaner.strategy = :transaction
...migration database. This means we can now specify this second database when using DatabaseCleaner: RSpec.configure do |config| config.before(:suite) do DatabaseCleaner[:active_record].clean_with(:deletion) DatabaseCleaner[:active_record, db...
...to fix these errors in development instead of ignoring these in the logs. For RSpec you might want to use allow(ActionController::Parameters).to receive(:action_on_unpermitted_parameters).and...
Please note that the changed behavior can also be observed in Capybara's RSpec matchers like have_text...
Simply add this to your .rspec instead: --require spec_helper If you are on rspec >= 3 and use a rails_helper.rb require this instead of the spec_helper: --require rails_helper...
...If you are using parallel_tests and this is not working for you, .rspec might be ignored. Try using a .rspec_parallel file...
...only set this if you use a light terminal theme Improving Diffs for Ruby, RSpec and Cucumber files See Rails developers: Have better context in Git diffs. This will correctly...
...name, like "Europe/Berlin" or "Asia/Tokyo". page.driver.browser.execute_cdp('Emulation.setTimezoneOverride', timezoneId: iana_zone_name) end end RSpec.configure do |config| config.include(TimeZoneHelpers, type: :feature) config.after(type: :feature, js: true) do set_browser_time...
...the rerun, but we'll lose that in the future anyways when migrating to RSpec
...works in weird ways. Use the allow_value matcher instead: describe Email, '#sender' do # > Rspec 3 should syntax it { should allow_value("email@addresse.foo").for(:sender) } it { should_not allow_value...
...foo").for(:sender) } # Rspec 3 expect syntax it { is_expected.to allow_value("email@addresse.foo").for(:sender) } it { is_expected.not_to allow_value("foo").for(:sender) } end Errors that may occur if you do...
...yet. Otherwise you could resize your window before every example just to be sure: RSpec.configure do |config| config.before(type: :feature) do case Capybara.current_driver when :desktop resize_browser_to(DESKTOP...
...on how to migrate legacy approaches to assignable_values. Testing There is a custom RSpec matcher...
...file type and adjust the code template according to your preferences. For example, the RSpec code template generates way too much boilerplate. Something like this is far more suitable for...
...following test was taken from a project using ActionDispatch::IntegrationTest. Though we usually use RSpec, this should give you the general idea. context 'favicons' do def link_selectors [ ['link[href...
...the console IRB. console command: Ctrl + C now properly exits a local Rails console rspec and cucumber commands: Run specs even if the automatic chromedriver update fails Improve detection of...
This only applies to RSpec below version 1.3.2. The issue has been fixed in RSpec 1.3.2, and most likely RSpec 2 and later versions. When you have a helper that...
...get('@content_for_title').should == 'Hello Universe' end Unfortunately, this may only work once. RSpec instanciates the helper object only once, thus keeping instance variables -- and since content_for always...
...instructions in the README. Most likely you want: to add the Ruby, Rails and RSpec cops to include the unit test 2. Report all existing offenses and exclude them initially...
...container you can run your tests export CHROMEDRIVER_URL=http://localhost:9999 bundle exec rspec specs/system/test_spec.rb # You might need to set remove `--headless` from your chromedriver options in e.g. selenium...
...applications that use RSpec, so don't upgrade if that is your setup. The rspec-rails gem has a fatal bug that was only fixed for rspec-rails-2.x...
...which only supports Rails 3. There is no fix for the rspec-rails-1.3.x series of the gem which supports Rails 2. Anyway, here are upgrade instructions if you...
...out which test throws this deprecation warning. There are other workarounds, too: Geordi with Rspec: geordi rspec spec/ (providing a path will lead to a run in a single process...
...Rspec: bundle exec rspec Cucumber: DISPLAY=:17 bundle exec cucumber (Just like geordi uses port 17 for VNC to not see a test browser...
...adapter = :sidekiq To set specific adapters in tests, you can create a spec/support/active_job.rb with: RSpec.configure do |config| config.before(:suite) do ActiveJob::Base.queue_adapter = :test end end and a features/support/active_job.rb with...
...write specs on how many database queries you expect. Use the make_database_queries RSpec matcher from the linked Ruby Gem...
...Only for running tests in a real browser (suggested) gem 'capybara-screenshot' # Optionally gem 'rspec' # Dependency of Spreewald end Now run bundle exec cucumber --init and add this code to...
...your features, specs or unit tests: rake parallel:test # Test::Unit rake parallel:spec # RSpec rake parallel:features # Cucumber rake parallel:features[2] # example how to execute cucumber features with...
...comment out this line at least (in your env.rb) end Issues parallel_tests breaks rspec matcher =~ for array comparision\ Solution: Use == if possible or just compare ids for example (xxx.collect...