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.
rspec-feature_helpers
Advanced tools
This gem aims to allow developers to write focussed spec files by making heavy use of RSpec's memoization and tagging features. This project is intended to be used in the context of testing a Rails application, although it shouldn't strictly depend on it.
A few things that you get:
Warden::Test::Helpers
get injected into the context of feature specs automatically. Tag your specs with logged_in
and you get a user logged in automatically prior to specs:
scenario 'test something', :logged_in do
# now your user should be logged in.
end
The following code is executed as part of a before
block:
login_as user
In case of using Warden (Devise), the login_as
method is automatically injected. If you use a different authentication solution, you can still define your own login_as
method that would log the user in automatically. For example:
module MyCustomAuthentication
def login_as(user)
# Do it here...
end
end
RSpec.configure do |config|
config.include MyCustomAuthentication, type: :feature
end
By default, user
corresponds to a create(:user)
block which is what FactoryGirl users use. Again, you can customize what the user
method lends. You can do this globally or on a per scenario, even a per context basis:
feature "Administering our site" do
background do
visit admin_path
end
context 'as an admin', :logged_in do
# All scenarios in this given context will
# have an admin_user logged in prior to running.
let(:user) { create(:admin_user) }
scenario 'test something' do
# ...
end
end
context 'as a regular user', :logged_in do
# All scenarios in this given context will
# have a regular user logged in prior to running.
# This will use the fefault memoized user:
# let(:user) { create(:user) }
scenario 'test soething' do
# ...
end
end
end
The gem also configures Capybara to run all feature tests using a JavaScript capable driver. This might not work for everyone, but I find that having JS errors surfaced as soon as possible is benefitial to testing only business-critical scenarios.
The gem also cleans up Capybara sessions and reverts it to use the default driver after each feature spec is completed. This way you get a nice and clean state between each spec run.
Add this line to your application's Gemfile, into the test group:
group :test do
gem 'rspec-feature_helpers'
end
And then execute:
$ bundle
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that rspec-feature_helpers 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.
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.