mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,5 Tsd.
aktive Profile

#mocking

1 Beitrag1 Beteiligte*r0 Beiträge heute

Mocha v3.0.0-rc.1 released

Looking for people to test the release candidate! 🙏

Highlights:

* Allow keyword arguments to match an expectation expecting *only* positional arguments
* Explicit support for Ruby v3.4
* Freeze all string literals used internally
* Use Ruby v1.9 Hash syntax in failure messages
* Drop support for Ruby v2.1
* Drop support for Minitest < v5

rubygems.org/gems/mocha/versio

Thanks to Herwin W, Nicholaus Ames, Sean Dilda & @drewnovo.

rubygems.orgmocha | RubyGems.org | Ihre Community des Gem-Hostingservices
#ruby#testing#mock

Mocha v2.6.1 released

* Fix logic added in v2.6.0 for displaying deprecation warnings for expectation with never cardinality - thanks to @DavidStosik for reporting.

The following will still pass despite an erroneous deprecation warning displayed in v2.6.0 suggesting otherwise:

foo.expects(:bar).never
foo.expects(:bar).once
foo.bar

rubygems.org/gems/mocha/versio

rubygems.orgmocha | RubyGems.org | Ihre Community des Gem-Hostingservices
#ruby#testing#mock

Mocha v2.6.0 released

* Expectation with never cardinality should display deprecation warning - thanks to Duke Tran for reporting and testing.

In anticipation of fixing a long-time bug so that the following will fail fast instead of passing:

foo.stubs(:bar)
foo.expects(:bar).never
foo.bar # => deprecation warning / unexpected invocation error

rubygems.org/gems/mocha/versio

rubygems.orgmocha | RubyGems.org | Ihre Community des Gem-Hostingservices
#ruby#testing#mock

I apparently missed this post from @maelle on #mocking #tests in #RStats packages, specifically recommending `testthat::local_mocked_bindings()` over `mockery::stub()` and giving a clear example of how to mock base functions.

blog.r-hub.io/2024/03/21/mocki

Very pertinent today as one of the codebases I'm working on used `mockery::stub()` and my colleague found that it was leaking to other tests in a pattern that could only be described as...

vicious mockery (roll 1d4 for damage)

blog.r-hub.ioUpdate on mocking for testing R packages - R-hub blogThis blog featured a post on mocking, the art of replacing a function with whatever fake we need for testing, years ago. Since then, we’ve entered a new decade, the second edition of Hadley Wickham’s and Jenny Bryan’s R packages book was published, and mocking returned to testthat, so it’s time for a new take/resources roundup! Thanks a lot to Hannah Frick for useful feedback on this post!

I'm looking for a way to test my #PHP #Symfony application #BehaviourDriven using #TDD without getting into DI #mocking hell. Currently ~90% of my tests consist of (mockery) mocks and their expectations. Are there ways/approaches to reduce this mocking on unit test level and focus more on the expected behaviour of the functions without having to constantly adapt the mocks during refactorings?

Any ideas/ tools/ articles/ videos/ composer packages?

While I've always tried hard to have Mocha support EOL versions of Ruby unless there was a compelling reason not to, I'm starting to think about dropping support for Ruby v2 because of all the hassle around the transition to support for keyword arguments.

Ruby v2.7 was EOL on 31 Mar 2023, i.e. 18 months ago.

Mocha still notionally supports Ruby v2.1 and later.

#ruby#mocha#opensource
Fortgeführter Thread

…but in case any of you want to do something similar, here’s me mocking a WritableStream using a Proxy to provide mock stdout and stderr streams to Console instances to capture the output and save them in my database:

codeberg.org/kitten/app/src/br

And here’s the actual monkeypatching code:

codeberg.org/kitten/app/src/br

Codeberg.orgapp/src/Logs.js at logsapp - A web development kit that’s small, purrs, and loves you.