deprecation_toolkit
WebMock
deprecation_toolkit | WebMock | |
---|---|---|
2 | 9 | |
444 | 3,917 | |
1.1% | - | |
8.0 | 7.9 | |
2 months ago | 22 days ago | |
Ruby | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
deprecation_toolkit
-
How much time its takes to upgrade a rails project to rails 5
First, install deprecation toolkit: https://github.com/Shopify/deprecation_toolkit. This will let you record every deprecation warning that fires while running your test suite and basically give you a “todo” list of most of what you need to fix to establish a safe upgrade path.
-
Upgrading a legacy Ruby and Rails application.
depreciation_toolkit was really helpful for me to organizing groups of depreciations across the app when upgrading rails.
WebMock
-
CableReady broadcasts are not working in system tests
If you want to check out an alternative to VCR, have a look at webmock.
-
TDD is super important and useful!
Well, that's why your test says: "When the API responds like this I do that". People hate on ruby but webmock makes it very nice to mock/stub that, or for python there's responses. For the database you can use a local database with factories to easily create the data you need for each test and clear it between tests.
-
It is becoming difficult for me to be productive in Python
Man if you think python has great mocking/testing support, you check out some ruby tests! Honestly some of the best testing libraries that pioneered approaches that are becoming more common elsewhere, such as the expectations syntax. And now that I'm coding more in python I find myself missing libaries like webmock, letting you stub web reqests in a way that's agnostic of the HTTP/web libary, chef's kiss.
- Are there any testing frameworks to intercept HTTP and Database calls?
-
Configure VCR with RSpec
In order to keep our test suite faster and consistent, we need to mock our http requests. A simple and good way to achieve this is using the Webmock gem which allow easily mock the http responses for your requests.
-
Testing Dependencies: Fake It While You Make It
We can avoid managing HTTP communication with our dependency. Instead, we'll stub out how we expect it to respond. In this case, we'll use webmock to stub out a response at the HTTP layer.
-
A Ruby gem to create production grade Kubernetes clusters in Hetzner Cloud in a couple of minutes or less
The other option is to mock the web requests to Hetzner - this: https://github.com/bblimke/webmock or similar may help.
-
When VCR seems to heavy try cURL & WebMock
There are fine istructions in WebMock README. I want to share it here for reference:
-
Testing external APIs with Rspec and WebMock
You can find the setup instructions and examples on how to use WebMock, in their github documentation. WebMock will prevent any external HTTP requests from your application so make sure you add this gem under the test group of your Gemfile.
What are some alternatives?
Next Rails - A toolkit to upgrade your next Rails application
DuckRails - Development tool to mock API endpoints quickly and easily (docker image available)
R Spec - A minimalist RSpec clone with all the essentials. [Moved to: https://github.com/cyril/r_spec-clone.rb]
Fix - Specing framework.
ActiveMocker - Generate mocks from ActiveRecord models for unit tests that run fast because they don’t need to load Rails or a database.
Request Interceptor - Sinatra based foreign API simulation for your testsuite
vcr - Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
TestXml - Small library to test your xml with Test::Unit or RSpec
Faraday - Simple, but flexible HTTP client library, with support for multiple backends.
Impersonator - Ruby library to record and replay object interactions
turbo_tests - Run RSpec tests on multiple cores. Like parallel_tests but with incremental summarized output. Originally extracted from the Discourse and Rubygems source code.
ruby-dns-mock - DNS mock server written on 💎 Ruby. Mimic any DNS records for your test environment with fake DNS server.