Skip to content

Instantly share code, notes, and snippets.

@MaryKuz
Created March 28, 2019 11:43
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 MaryKuz/5e67580591a53cd248dd9bbdc8082a19 to your computer and use it in GitHub Desktop.
Save MaryKuz/5e67580591a53cd248dd9bbdc8082a19 to your computer and use it in GitHub Desktop.
Cover the decorator with tests
require 'rails_helper'
RSpec.describe UserDecorator do
describe '#as_json' do
let(:user) { stub_model User, name: 'Test name', email: 'test@test.com' }
subject { user.decorate.as_json }
its([:name]) { should eq 'Test name' }
its([:email]) { should eq 'test@test.com' }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment