Created
February 23, 2015 05:59
-
-
Save ukstudio/21e4e2e607df83f94726 to your computer and use it in GitHub Desktop.
hogehgoe
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
RSpec.configure do |config| | |
config.mock_with :rspec | |
end | |
class PriceCalc | |
def initialize(order) | |
@order = order | |
end | |
def price_with_tax | |
@order.total_price * 1.08 | |
end | |
end | |
describe 'Hoge' do | |
let(:order_mock) { double('order') } | |
before do | |
allow(order_mock).to receive(:total_price) { 1000 } | |
expect(order_mock).to receive(:total_price).once | |
end | |
subject { PriceCalc.new(order_mock).price_with_tax } | |
it { is_expected.to eq 1080 } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment