The following is a Rails model test:
it "will respond to name" do
@user.must_respond_to :name
end
In minitest, is there a way to shorten this syntax like this?
it { must_respond_to :name }
or even this?
it { must_respond_to (:name) }
The following is a Rails model test:
it "will respond to name" do
@user.must_respond_to :name
end
In minitest, is there a way to shorten this syntax like this?
it { must_respond_to :name }
or even this?
it { must_respond_to (:name) }
I don't know if it is recommended to do that, but maybe you can just do this:
alias :old_it :it
def it test_name = "", ≺ old_it(test_name){@user.instance_eval(&pr)} end
The syntax you are looking for us not possible with the assertions and expectations as defined by methods in minitest. What you want is matchers. Take a look at the minitest-matchers project which enables the syntax you are after.