users_spec.rb 457 B

12345678910111213141516171819
  1. require 'spec_helper'
  2. describe User do
  3. describe "validations" do
  4. describe "invitation_code" do
  5. it "only accepts valid invitation codes" do
  6. User::INVITATION_CODES.each do |v|
  7. should allow_value(v).for(:invitation_code)
  8. end
  9. end
  10. it "can reject invalid invitation codes" do
  11. %w['foo', 'bar'].each do |v|
  12. should_not allow_value(v).for(:invitation_code)
  13. end
  14. end
  15. end
  16. end
  17. end