Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
xdotcommer-rspec-custom-matchers
Advanced tools
This gem makes it really easy to define your own RSpec custom matchers in 1 line of code.
This class / project is created by xdotcommer.
I forked it to make it an easy-to-install RubyGem
sudo gem install remi-rspec-custom-matchers -s http://gems.github.com
Wherever you want to include the matcher
method, include CustomMatcher::Helper
Remember, if you want to be able to call matcher(:foo)
in the body of a class,
you might want to extend CustomMatcher::Helper
instead of including it.
Personally, I like to keep all of my own custom matchers for a project in a module, so I do ...
require 'rspec-custom-matchers'
module MyMatchers
extend CustomMatcher::Helper
matcher(:be_divisible_by) { |number, divisor| number % divisor == 0 }
matcher(:be_even) { |even| even % 2 == 0 }
matcher(:be_odd) { |odd| odd % 2 != 0 }
matcher(:be_equal_to)
end
and then, in my spec_helper.rb
require 'my_matchers'
Spec::Runner.configure do |config|
config.include MyMatchers # this will make the matchers available to your specs
end
That's how I do it!
matcher(:x){}
as well as merb's Spec::Matcher.create
, which has more features and can be found at merb-core/lib/merb-core/test/test_ext/rspec.rb
FAQs
Unknown package
We found that xdotcommer-rspec-custom-matchers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.