Created
January 1, 2020 05:52
-
-
Save minghz/2d1c28dc0dccbb558993670cfaafda9b to your computer and use it in GitHub Desktop.
Making MiniTest work like RSpec - pt3
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
require 'minitest/hooks' | |
require 'minitest/autorun' | |
class ActiveSupport::TestCase | |
extend MiniTest::Spec::DSL | |
end | |
class ActionDispatch::IntegrationTest | |
extend MiniTest::Spec::DSL | |
end | |
class MyTest < ActiveSupport::TestCase | |
include Minitest::Hooks # You need to add this to your test classes | |
before(:all) do | |
@heavy_variable = HeavyThing.create!( | |
something: 'that', | |
takes: 'a lot', | |
of: 'time', | |
to: 'setup' | |
) | |
end | |
after(:all) do | |
@heavy_variable.destroy! | |
end | |
it { assert_equal 'that', @heavy_variable.something } | |
it { assert_equal 'a lot', @heavy_variable.takes } | |
it { assert_equal 'time', @heavy_variable.of } | |
it { assert_equal 'setup', @heavy_variable.to } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment