Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Write tests for the decorator
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