Skip to content

Instantly share code, notes, and snippets.

@JasonSpatial
Last active August 29, 2015 14:18
Show Gist options
  • Save JasonSpatial/07ffbb2f761ccfc2dd1e to your computer and use it in GitHub Desktop.
Save JasonSpatial/07ffbb2f761ccfc2dd1e to your computer and use it in GitHub Desktop.
copy_list_spec.rb
require 'rails_helper'
require './app/services/copy_list'
describe CopyList, type: :service do
describe 'given an existing list and a list name' do
let(:list) { list = List.create(name: 'my list') }
let(:category) { Category.create(name: 'my category', list: list) }
let!(:item) { Item.create(name: 'my item', category: category)
let(:new_name) { 'my new list' }
subject(:new_list) { CopyList.new(list, new_name).call }
it 'copies a list using the new name' do
expect(new_list.name).to eq 'my new list'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment