Skip to content

Instantly share code, notes, and snippets.

@amkisko
Created March 6, 2020 16:15
Show Gist options
  • Save amkisko/6b662282f430f867781ca77aabbbae4b to your computer and use it in GitHub Desktop.
Save amkisko/6b662282f430f867781ca77aabbbae4b to your computer and use it in GitHub Desktop.
Rails app tests
* Brakeman test
* Bundle audit test
* Rubocop test
class BrakemanTest < ActiveSupport::TestCase
require "brakeman"
test "breakman returns no errors and warnings" do
result = Brakeman.run Rails.root.to_s
assert_equal [], result.errors
assert_equal [], result.warnings
end
end
class BundleAuditTest < ActiveSupport::TestCase
require "bundler/audit/cli"
test "bundle audit returns no errors" do
`bundle audit update -q`
result = `bundle audit`
code = `echo $?`.squish
assert_equal "0", code, result
puts "\n#{result}"
end
end
class RubocopTest < ActiveSupport::TestCase
require "rubocop"
test "rubocop returns no errors" do
cop = RuboCop::CLI.new
args = [Rails.root.to_s]
assert_equal 0, cop.run(args)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment