61 Matching Annotations
- Sep 2024
-
-
The snag is that when the top-level match grabs the published_at value and applies it to the be_within(...), it is working with a string representation of the timestamp. We first need to parse that into a date object and there is no affordance for that here.
-
RSpec gives us the tools to make custom matchers so that we can preserve all the expressiveness while adding specialized or even domain-specific matchers.
-
- May 2024
-
github.com github.com
-
# This is manual way to describe complex parameters parameter :one_level_array, type: :array, items: {type: :string, enum: ['string1', 'string2']}, default: ['string1'] parameter :two_level_array, type: :array, items: {type: :array, items: {type: :string}} let(:one_level_array) { ['string1', 'string2'] } let(:two_level_array) { [['123', '234'], ['111']] }
-
- Feb 2024
-
github.com github.com
-
Regression in 3.13: custom matcher hash argument improperly converted to keyword args, results in ArgumentError
-
- Dec 2023
-
github.com github.com
-
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
Tags
Annotators
URL
-
- Sep 2023
- Jul 2023
-
stackoverflow.com stackoverflow.com
-
expect(described_class.active).not_to include_any_of [records_not_to_be_included]
-
- Oct 2022
-
- Aug 2022
-
github.com github.com
-
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.
Tags
Annotators
URL
-
- May 2022
-
github.com github.com
-
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
Tags
Annotators
URL
-
-
gist.github.com gist.github.comLICENSE2
-
group.run(double.as_null_object)
What does this actually do/mean?
-
-
- Dec 2021
-
-
config.define_derived_metadata(let_it_be_frost: true) do |metadata| metadata[:let_it_be_modifiers] ||= {freeze: true} end
-
-
github.com github.com
-
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)
-
- Oct 2021
-
stackoverflow.com stackoverflow.com
-
Rspec hangs after it finishes running through my tests
-
- Jun 2021
-
docs.gitlab.com docs.gitlab.com
-
We use the RSpec::Parameterized gem
first sighting: rspec-parameterized
-
-
github.com github.com
-
github.com github.com
-
-
using RSpec::Parameterized::TableSyntax where(:a, :b, :answer) do 1 | 2 | 3 5 | 8 | 13 0 | 0 | 0 end
-
-
gitlab.com gitlab.com
-
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.
-
- Apr 2021
-
stackoverflow.com stackoverflow.com
-
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?
-
-
If you look at the source code you'll see that they're exactly the same thing.
-
Very trivial and cosmetic, but include_context doesn't output "behaves like" in --format documentation.
-
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.
-
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.
-
-
github.com github.com
-
alias shared_context shared_examples
-
-
blog.dnsimple.com blog.dnsimple.com
- Mar 2021
- Feb 2021
-
github.com github.com
-
describe '.validate(context, filters, inputs)' do let(:inputs) { {} } let(:filter) { ActiveInteraction::Filter.new(:name, {}) } let(:interaction) do
-
- Sep 2020
-
github.com github.com
Tags
Annotators
URL
-
- Jul 2020
-
docs.gitlab.com docs.gitlab.com
-
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).
-
- Jun 2020
-
github.com github.com
-
a technique that enable a test suite to perform as well as using fixtures (or better if you're running just a few tests from the suite) and read as good as you are used to when using factories
-
No need for DatabaseCleaner (rolling back transactions are usually faster than truncate).
-
-
-
github.com github.com
- Apr 2020
-
tenderlovemaking.com tenderlovemaking.com
-
But where is the helper method defined? What’s its visibility? Can I put it in a module? Can I use inheritance? Who can call it? Can I call super from the extracted method? If so, where does super go?
-
-
-
github.com github.com
-
github.com github.com
-
docs.seattlerb.org docs.seattlerb.org
-
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.
-
-
github.com github.com
-
github.com github.com
-
heavily inspired in RSpec Expectations
Tags
Annotators
URL
-
-
github.com github.com
-
Only slightly shorter than
is_expected.to
(which they don't mention knowing about)
Tags
Annotators
URL
-
-
www.betterspecs.org www.betterspecs.org
-
- Mar 2020
-
stackoverflow.com stackoverflow.com
- Feb 2020