Last active
December 1, 2015 05:12
-
-
Save LanceOlsen/9da9f92816a3a3f7c933 to your computer and use it in GitHub Desktop.
Unexpressive Specs
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
describe Invoice do | |
subject { described_class.new(user: user, items: items) } | |
let(:user) { FactoryGirl.create(:user) } | |
let(:items) { 2.times.map { FactoryGirl.create(:item, price: 100) } } | |
describe '#sales_tax' do | |
it 'charges sales tax when the user is in CA' do | |
user.state = 'CA' | |
invoice.finalize! | |
expect(subject.sales_tax).to eq(200 * 0.0875) | |
end | |
it 'does not charge sales tax when the user is OR' do | |
user.state = 'OR' | |
invoice.finalize! | |
expect(subject.sales_tax).to eq(0) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment