This is my ideal design in Minitest
require 'test_helper'
describe "Thing" do
let(:cow) { Array.new }
it "does the thing" do
_(cow.length).must_be :<, 3
value do
cow << :woof
end.must_change "cow.count"
end
end
But this blows up in my face saying assert_difference not defined and the following remedies it.
require 'test_helper'
class ThingTest < ActiveSupport::TestCase
describe "Thing" do
let(:cow) { Array.new }
it "does the thing" do
_(cow.length).must_be :<, 3
value do
cow << :woof
end.must_change "cow.count"
end
end
end
This brings in all the right methods into scope for my tests to work. But I find it ugly and weird to just use a describe block inside a class block. Very un-class-like