Created
October 18, 2013 10:24
-
-
Save the-undefined/7039557 to your computer and use it in GitHub Desktop.
The main difference between Minitest and Rspec for ME is the conciseness of the assertion you can impose using Rspec.
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
# Minitest | |
it "should create a new credit card" do | |
from_hash = CreditCard.create_from_hash(hash) | |
assert from_hash.valid? | |
assert from_hash.number == number | |
assert from_hash.cvv == cvv | |
assert from_hash.expiry_month == expiry_month | |
assert from_hash.expiry_year == expiry_year | |
end | |
# Rspec | |
context "create a new credit card" do | |
subject { CreditCard.create_from_hash(hash) } | |
it { should be valid? } | |
its(:number) { should eq number } | |
its(:csvv) { should eq cvv } | |
its(:expiry_month) { should eq expiry_month } | |
its(:expiry_year) { should eq expiry_year } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment