56 Matching Annotations
  1. Feb 2024
  2. Dec 2023
    1. describe AuthenticateUser do subject(:context) { described_class.call(username, password) } describe '.call' do context 'when the context is successful' do let(:username) { 'correct_user' } let(:password) { 'correct_password' } it 'succeeds' do expect(context).to be_success end end context 'when the context is not successful' do let(:username) { 'wrong_user' } let(:password) { 'wrong_password' } it 'fails' do expect(context).to be_failure end end end end
  3. Sep 2023
  4. Jul 2023
  5. Oct 2022
  6. Aug 2022
    1. I created a gem called rspec_n that installs an executable that will do this. It will re-run the test suite N times by default. You can make it stop as soon as it hits a failing iteration via the -s cli option. It will display other stats about the iterations as well.
  7. May 2022
    1. The shared context worked though thanks! RSpec.shared_context "perform_enqueued_jobs" do around(:each) { |example| perform_enqueued_jobs { example.run } } end RSpec.configure do |config| config.include_context "perform_enqueued_jobs" end

      use case for around

  8. Dec 2021
    1. config.define_derived_metadata(let_it_be_frost: true) do |metadata| metadata[:let_it_be_modifiers] ||= {freeze: true} end
    1. Just FYI, there is a nice way to "expect a change" in RSpec. You don't have to use it, what you have is fine, just thought I'd share. expect { widget.paper_trail.update_columns(name: "Bugle") }.to(change { widget.versions.length }).from(1).to(2)
  9. Oct 2021
  10. Jun 2021
    1. Move it to Jest. This potentially requires extending our jsdom mocked browser environment. Move it to RSpec. This will probably require us changing our perspective to a use-case oriented one. We just want to make sure we have the same value coverage.
  11. Apr 2021
    1. Also if I replace the shared_context with shared_examples and accordingly include it in test case. Passes

      Shouldn't make a difference if it's an alias. So why did it?

    2. If you look at the source code you'll see that they're exactly the same thing.
    3. Very trivial and cosmetic, but include_context doesn't output "behaves like" in --format documentation.
    4. It's simple really ... put tests into a shared example that you want multiple things to conform to. Put code into a shared context that you need to include in multiple tests.
    5. shared_contexts is any setup code that you can use to prepare a test case . This allows you to include test helper methods or prepare for the tests to run.
  12. Mar 2021
  13. Feb 2021
    1. describe '.validate(context, filters, inputs)' do let(:inputs) { {} } let(:filter) { ActiveInteraction::Filter.new(:name, {}) } let(:interaction) do
  14. Sep 2020
  15. Jul 2020
    1. We also use a home-made RspecFlaky::Listener listener which records flaky examples in a JSON report file on master (retrieve-tests-metadata and update-tests-metadata jobs).
  16. Jun 2020
  17. Apr 2020
    1. minitest doesn't reinvent anything that ruby already provides, like: classes, modules, inheritance, methods. This means you only have to learn ruby to use minitest and all of your regular OO practices like extract-method refactorings still apply.
  18. Mar 2020
  19. Feb 2020