Skip to content

Instantly share code, notes, and snippets.

@Griminy
Created February 26, 2015 13:46
Show Gist options
  • Save Griminy/8143c7984090fe1a2893 to your computer and use it in GitHub Desktop.
Save Griminy/8143c7984090fe1a2893 to your computer and use it in GitHub Desktop.
require 'test_helper'
module MagazCore
class ShopServices::CreateInviteTest < ActiveSupport::TestCase
include Rails.application.routes.url_helpers
setup do
@shop = create(:shop, name: 'shop_name')
@host = shop_name.magaz.local:3000
@email = 'some@email.com'
end
test 'create user with token and email' do
service = MagazCore::ShopServices::CreateInvite
.call(shop: @shop, email: @email, host: @host)
assert service.user.persisted?
assert_equal @shop.id, service.user.shop_id
assert_not service.user.invite_token.blank?
assert_equal @email, service.user.email
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment