...ENV['TEST_ENV_NUMBER'] %> Create test databases script/dbconsole -p CREATE DATABASE `xxx_test2`; ... Generate RSpec files script/generate rspec (you'll probably only let it overwrite files in script/)
removes confusion with Rails' built in integration tests (you put capybara rspec integration tests into the spec/feature/... folder) and the :type metadata has been changed from :request to...
...by the identifier) has a new syntax for writing integration tests with capybara in rspec (describe => feature, it => scenario) Excerpt of some other major changes has_content? doesn't match...
...are affected by the issue: The field's content "" did not match "some-text" (RSpec::Expectations::ExpectationNotMetError) Issue with headless Chrome After removing the line above in the configuration it...
...copy the attached file to lib/tasks/rcov.rake. After that rake rcov:all will run all RSpec examples and Cucumber features. The report will be written RAILS_ROOT/coverage/index.html. Here is what the...
...task does in detail: Generates aggregated coverage of both RSpec and Cucumber Works with Rails 2 and Rails 3 Reports for app/**/*.rb and nothing else If called with an...
With Rspec you can mock objects or functions, for example like this: expect(my_object).to receive(:my_function).and_return('hello world') It's also easy to remove mocks...
RSpec::Mocks.space.proxy_for(my_object).reset
Warnings like those below may originate from rspec or shoulda-matchers or other gems that have not updated yet to the new MiniTest API. One Warning: you should require 'minitest/autorun...
...minitest"' before 'require "minitest/autorun"' # (backtrace) Solution: Add gem 'minitest' to your Gemfile, before any rspec gem. Another MiniTest::Unit::TestCase is now Minitest::Test. From /Users/makandra/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/test/unit/testcase.rb:8:in ` '
Run rspec-and-cucumber from any project directory to run both RSpec and Cucumber. If available, rspec_spinner or cucumber_spinner are used. Note that features are not run when...
...use webmock like you are used to. Here is how to do this in rspec. RSpec.configure do |config| config.around do | example | if example.metadata[:turn_off_vcr] VCR.turn_off! example.run VCR.turn...
...file_fixture is not available by default. To enable it, include a support module from rspec-rails: FactoryBot::SyntaxRunner.include(RSpec::Rails::FileFixtureSupport) That includes ActiveSupport::Testing::FileFixtures, where file_fixture...
...the test database. NoMethodError: undefined method 'last_comment' for # Rake 11 removes a method that rspec-core < 3.4.4 depends on. To fix, lock Rake to < 11 in your Gemfile:
...rake', '< 11', # Removes a method that rspec-core < 3.4 depends on
Show failing specs instantly. Show passing spec as green dots as usual. Configuration: # spec/spec.opts (.rspec for rspec 2) --require rspec/instafail --format RSpec::Instafail
...executable-flags from files that should not be executable geordi rs[pec] [FILES] # Run RSpec geordi sec[urity-update] [STEP] # Support for performing security updates geordi set[up] # Setup a...
...Rubymine if you need to do so. Debugging in your tests When you run RSpec or Cucumber, Ruby is already in debug mode. Tests will open a debugging shell when...
...Temporarily change the current power When you set Power.current to a power in an RSpec example, you must remember to nilify it afterwards. Otherwise other examples will see your global...
Our awesome collection of rspec helpers (formerly known as "spec_candy.rb") is now available as a gem. It works, it is tested and there will be updates. Usage Add rspec_candy...
...to your Gemfile. Add require 'rspec_candy/helpers' to your spec_helper.rb, after the rspec requires. List of features
...Chrome, you can spawn a new Chrome using the --user-agent command line switch. RSpec In controller specs, you can just modify the Rack environment before making your request:
...and re-create your test database before each run of your test suite. Configure RSpec to wrap each example in a transaction that is rolled back when the example ends...
...Then I should get a download with filename "..." expected: /filename="some.pdf"$/ got: nil (using =~) (RSpec::Expectations::ExpectationNotMetError) Solution One solution is to check the Content-Type header only with the...
...of this. See How to set up database_cleaner for Rails with Cucumber and RSpec...
...own Gemfile for each Rails app, which freezes the correct versions of Rails and RSpec and referencing the gem itself. Shared specs live in spec/shared/library_name. A Rakefile in the project...
...the runtime of different strategies using an average-sized Rails project (with MySQL): Cucumber RSpec Transaction 87.14, 86.65 10.20, 10.11 Truncation 90.43, 90.69 26.82, 26.46
...attached file to features/support. For this to work you also need the following things: RSpec stubs and mocks in Cucumber rspec_candy Cucumber: Detect if the current Capybara driver supports...
...backported functionality from modern Rubies Migrating from require to require_relative where I loaded RSpec factories in Cucumber's env.rb (the Rails application root is no longer in the load...
Webmocks hash_including is similar to RSpec::Mocks::ArgumentMatchers#hash_including. Be aware that hash_including (webmock v3.0.1) doesn't parse integer values to String. Without hash including you would...