Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Plugin for contracts.ruby that fixes issues with rspec-mocks.
Add this line to your application's Gemfile:
gem 'contracts-rspec'
And then execute:
$ bundle
Or install it yourself as:
$ gem install contracts-rspec
Just require 'contracts/rspec'
and include Contracts::RSpec::Mocks
into your example group and you will be able to use enhanced instance_double
:
require 'contracts'
require 'contracts/rspec'
class Example
include Contracts
Contract Something => Any
def do_something(something)
something.call
end
end
RSpec.describe Example do
# If you not include this, you will get ContractError, telling you
# that `RSpec::Mocks::InstanceVerifyingDouble` is not a `Something`.
include Contracts::RSpec::Mocks
subject(:example) { Example.new }
let(:something) { instance_double(Something) }
it "works" do
expect { example.do_something(something) }.not_to raise_error
end
end
When you include Contracts::RSpec::Mocks
, you basically make your instance_double
calls additionally stub out :is_a?
message, when received with specified class to return true. Which makes contract succeed.
You can do it yourself simply:
something = instance_double(Something)
allow(something).to receive(:is_a?).with(Something).and_return(true)
This library only provides a shortcut.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that contracts-rspec demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.