Skip to content

Instantly share code, notes, and snippets.

@the-undefined
Created October 18, 2013 10:24
Show Gist options
  • Save the-undefined/7039557 to your computer and use it in GitHub Desktop.
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.
# 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