forked from rubyforgood/casa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not infer spec type from location
- Loading branch information
1 parent
760eea4
commit d78fa52
Showing
15 changed files
with
66 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,67 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe PhoneNumberHelper do | ||
describe "phone number helper" do | ||
include PhoneNumberHelper | ||
|
||
context "validates phone number" do | ||
it "with empty string" do | ||
valid, error = valid_phone_number("") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
RSpec.describe PhoneNumberHelper, type: :helper do | ||
context "validates phone number" do | ||
it "with empty string" do | ||
valid, error = valid_phone_number("") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
|
||
it "with 10 digit phone number prepended with US country code" do | ||
valid, error = valid_phone_number("+12223334444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
it "with 10 digit phone number prepended with US country code" do | ||
valid, error = valid_phone_number("+12223334444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
|
||
it "with 10 digit phone number prepended with US country code without the plus sign" do | ||
valid, error = valid_phone_number("12223334444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
it "with 10 digit phone number prepended with US country code without the plus sign" do | ||
valid, error = valid_phone_number("12223334444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
|
||
it "with 10 phone number with spaces" do | ||
valid, error = valid_phone_number("222 333 4444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
it "with 10 phone number with spaces" do | ||
valid, error = valid_phone_number("222 333 4444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
|
||
it "with 10 phone number with parentheses" do | ||
valid, error = valid_phone_number("(222)3334444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
it "with 10 phone number with parentheses" do | ||
valid, error = valid_phone_number("(222)3334444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
|
||
it "with 10 phone number with dashes" do | ||
valid, error = valid_phone_number("222-333-4444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
it "with 10 phone number with dashes" do | ||
valid, error = valid_phone_number("222-333-4444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
|
||
it "with 10 phone number with dots" do | ||
valid, error = valid_phone_number("222.333.4444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
it "with 10 phone number with dots" do | ||
valid, error = valid_phone_number("222.333.4444") | ||
expect(valid).to be(true) | ||
expect(error).to be_nil | ||
end | ||
end | ||
|
||
context "invalidates phone number" do | ||
it "with incorrect country code" do | ||
valid, error = valid_phone_number("+22223334444") | ||
expect(valid).to be(false) | ||
expect(error).to have_text("must be 10 digits or 12 digits including country code (+1)") | ||
end | ||
context "invalidates phone number" do | ||
it "with incorrect country code" do | ||
valid, error = valid_phone_number("+22223334444") | ||
expect(valid).to be(false) | ||
expect(error).to have_text("must be 10 digits or 12 digits including country code (+1)") | ||
end | ||
|
||
it "with short phone number" do | ||
valid, error = valid_phone_number("+122") | ||
expect(valid).to be(false) | ||
expect(error).to have_text("must be 10 digits or 12 digits including country code (+1)") | ||
end | ||
it "with short phone number" do | ||
valid, error = valid_phone_number("+122") | ||
expect(valid).to be(false) | ||
expect(error).to have_text("must be 10 digits or 12 digits including country code (+1)") | ||
end | ||
|
||
it "with long phone number" do | ||
valid, error = valid_phone_number("+12223334444555") | ||
expect(valid).to be(false) | ||
expect(error).to have_text("must be 10 digits or 12 digits including country code (+1)") | ||
end | ||
it "with long phone number" do | ||
valid, error = valid_phone_number("+12223334444555") | ||
expect(valid).to be(false) | ||
expect(error).to have_text("must be 10 digits or 12 digits including country code (+1)") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "All-Casa Admin" do | ||
RSpec.describe "All-Casa Admin", type: :request do | ||
let(:all_casa_admin) { build(:all_casa_admin) } | ||
let(:casa_admin) { create(:casa_admin, email: "[email protected]", display_name: "Example Admin") } | ||
let(:casa_org) { create(:casa_org) } | ||
|