Skip to content

Instantly share code, notes, and snippets.

@LanceOlsen
Last active December 1, 2015 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LanceOlsen/9da9f92816a3a3f7c933 to your computer and use it in GitHub Desktop.
Save LanceOlsen/9da9f92816a3a3f7c933 to your computer and use it in GitHub Desktop.
Unexpressive Specs
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