Power Assert

Public
Power Assert for Minitest - https://github.com/hsbt/minitest-power_assert
Icons/chart bar
Used 17 times
Created by
I Ivan Nemytchenko

Usage

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/xjNsY4"
Template Source

Review the code before running this template on your machine.

run "spring stop"

gem_group :test do
  gem 'minitest-power_assert'
end

if defined? RSpec
  puts "Sorry, it works only for minitest"
else
  # We assume you're using MiniTest Rails
  File.open(Rails.root.join("test", "test_helper.rb"), "r+") do |file|
    lines = file.each_line.to_a
    config_index = lines.map.with_index { |line, index| index if line.start_with? "require" }.compact.last
    lines.insert(config_index, "require 'minitest/power_assert'\n");
    file.rewind
    file.write(lines.join)
  end
end
Comments

Sign up or Login to leave a comment.

© 2022 GoRails, LLC