Created
March 6, 2020 16:15
-
-
Save amkisko/6b662282f430f867781ca77aabbbae4b to your computer and use it in GitHub Desktop.
Rails app tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Brakeman test | |
* Bundle audit test | |
* Rubocop test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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