Keep a blank line before and after private Keep a blank line before and after protected Remove extra empty line at class body end Remove extra blank line Add final newline Use 2 (not 3) spaces for indentation Use 2 (not 4) spaces for indentation Remove space before comma Add space after comma Remove trailing whitespaces Remove unnecessary spacing Use snake_case for variable names Do not use then for multi-line if Remove unused block argument - i Use the new Ruby 1.9 hash syntax Remove unused assignment to variable Indent when as deep as case Align attributes Align end with def
22 lines
703 B
Ruby
22 lines
703 B
Ruby
require 'rails_helper'
|
|
|
|
describe Verification::Sms do
|
|
it "should be valid" do
|
|
sms = build(:verification_sms)
|
|
expect(sms).to be_valid
|
|
end
|
|
|
|
it "should validate uniqness of phone" do
|
|
create(:user, confirmed_phone: "699999999")
|
|
sms = Verification::Sms.new(phone: "699999999")
|
|
expect(sms).to_not be_valid
|
|
end
|
|
|
|
it "only allows spaces, numbers and the + sign" do
|
|
expect(build(:verification_sms, phone: "0034 666666666")).to be_valid
|
|
expect(build(:verification_sms, phone: "+34 666666666")).to be_valid
|
|
expect(build(:verification_sms, phone: "hello there")).to_not be_valid
|
|
expect(build(:verification_sms, phone: "555; DROP TABLE USERS")).to_not be_valid
|
|
end
|
|
|
|
end |