Created
March 28, 2019 09:12
-
-
Save MaryKuz/b38d06dac256e41cd42e876b37975720 to your computer and use it in GitHub Desktop.
Write tests for the decorator
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
require 'rails_helper' | |
describe ProductDecorator do | |
describe '#as_json' do | |
let(:product) { stub_model Product, id: 1, name: 'apple', price: 10.0, description: 'green' } | |
subject { product.decorate.as_json } | |
its([:id]) { should eq 1 } | |
its([:name]) { should eq 'apple' } | |
its([:price]) { should eq 10.0 } | |
its([:description]) { should eq 'green' } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment