added machinist and a spec for person to verify that uniqueness of account is guaranteed

This commit is contained in:
Mark Ryall
2012-09-13 09:06:10 +10:00
parent cc74bed20f
commit 3358b5894d
4 changed files with 28 additions and 0 deletions
+1
View File
@@ -18,6 +18,7 @@ gem 'jquery-rails'
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem 'machinist'
end
group :production do
+2
View File
@@ -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)
+15
View File
@@ -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
+10
View File
@@ -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