
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
A nice assert_difference method similar to the one provided by Rails but with some improvements. For example:
assert_difference "Company.count" => +1, "User.count" => +5, "Slot.count" => -1 do
post :something
end
will assert that a company and 5 users were create (the plus sign is only for the visual aid) and a slot was removed.
Rails' assert_difference would require a more verbose syntax:
assert_difference "Company.count" do
assert_difference "User.count", +5 do
assert_difference "Article.count", -1 do
post :something
end
end
end
Expectations can also be ranges, for example:
assert_difference "Blog.count" => +1, "Post.count" => 2..5 do # Generate some sample posts when creating a blog
post :create
end
On top of that, error reporting is improved by displaying all the counters that didn't match.
To use it with Test::Unit add this code:
class Test::Unit::TestCase
include AssertDifference
end
or in Rails:
class ActiveSupport::TestCase
# ...
include AssertDifference
end
and to use it with RSpec:
RSpec.configure do |config|
config.include AssertDifference
end
This gem should work without Rails but it does depend on active support >= 3.0.0 and it's tested with active support 3.0, 3.1, 3.2, 4.0 and 4.1 as well as Ruby 1.9.3, 2.0 and 2.1.
This gem is being used by:
git checkout -b my-new-feature
)git commit -am "Add some feature"
)git push origin my-new-feature
)Copyright (c) 2010, 2011, 2012, 2014 José Pablo Fernández. See LICENSE for details.
FAQs
Unknown package
We found that assert_difference 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
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.