Skip to content

Commit

Permalink
Use bundler in Rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
presidentbeef committed Sep 14, 2017
1 parent 99f3cfa commit 5fcd773
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
task :default do
sh "ruby test/test.rb --pride"
require 'bundler/setup'
require 'rake/testtask'

Rake::TestTask.new do |t|
t.pattern = 'test/tests/*.rb'
end

task default: :test
12 changes: 10 additions & 2 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
## Testing

Run `rake` or if you want to avoid bundler `cd test && ruby test.rb`.
Run `bundle` then `rake` or if you want to avoid bundler `ruby test/test.rb`.

This runs Brakeman against full apps in the `apps` directory and checks the results against what is expected.

## Test Generation

Run `cd test && ruby to_test.rb apps/some_app > tests/test_some_app.rb` to generate a test suite with tests for each warning reported.
Run `cd test && ruby to_test.rb apps/some_app > tests/some_app.rb` to generate a test suite with tests for each warning reported.

## Single File

Run `ruby test/tests/some_file.rb` to run a single file of tests.

## Single Test

Ruby `ruby test/test.rb --name test_something` to run a single test.
7 changes: 5 additions & 2 deletions test/test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#Set paths
TEST_PATH = File.expand_path(File.dirname(__FILE__)) unless defined? TEST_PATH
$LOAD_PATH.unshift "#{TEST_PATH}/../lib"
unless defined? TEST_PATH
TEST_PATH = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift "#{TEST_PATH}/../lib"
end

begin
require 'simplecov'
Expand All @@ -13,6 +15,7 @@
require 'brakeman'
require 'brakeman/scanner'
require 'minitest/autorun'
require 'minitest/pride'

class Minitest::Test
def assert_nothing_raised *args
Expand Down

0 comments on commit 5fcd773

Please sign in to comment.