mirror of
https://github.com/wahyd4/ocelots.git
synced 2026-08-09 04:56:21 +10:00
added machinist and a spec for person to verify that uniqueness of account is guaranteed
This commit is contained in:
@@ -18,6 +18,7 @@ gem 'jquery-rails'
|
||||
group :development, :test do
|
||||
gem 'sqlite3'
|
||||
gem 'rspec-rails'
|
||||
gem 'machinist'
|
||||
end
|
||||
|
||||
group :production do
|
||||
|
||||
@@ -59,6 +59,7 @@ GEM
|
||||
railties (>= 3.1.0, < 5.0)
|
||||
thor (~> 0.14)
|
||||
json (1.7.5)
|
||||
machinist (2.0)
|
||||
mail (2.4.4)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
@@ -146,6 +147,7 @@ DEPENDENCIES
|
||||
coffee-rails (~> 3.2.1)
|
||||
faker
|
||||
jquery-rails
|
||||
machinist
|
||||
paperclip
|
||||
pg
|
||||
rails (= 3.2.8)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Person do
|
||||
it 'should not generate valid user with non unique account' do
|
||||
person1 = Person.make! account: 'the_one'
|
||||
person2 = Person.make account: 'the_one'
|
||||
person2.should_not be_valid
|
||||
end
|
||||
|
||||
describe '#create_for_email' do
|
||||
it 'should generate a valid person' do
|
||||
Person.create_for_email('user@email.com').should be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
require 'machinist/active_record'
|
||||
require 'uuid_generator'
|
||||
|
||||
include UuidGenerator
|
||||
|
||||
Person.blueprint do
|
||||
full_name { 'Jane Smith' }
|
||||
account { uuid }
|
||||
auth_token { uuid }
|
||||
end
|
||||
Reference in New Issue
Block a user