Skip to content

Commit

Permalink
do not infer spec type from location
Browse files Browse the repository at this point in the history
  • Loading branch information
thejonroberts committed Nov 15, 2024
1 parent 760eea4 commit d78fa52
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 70 deletions.
2 changes: 1 addition & 1 deletion spec/helpers/banner_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe BannerHelper do
RSpec.describe BannerHelper, type: :helper do
describe "#conditionally_add_hidden_class" do
it "returns d-none if current banner is inactive" do
current_organization = double
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/case_contacts_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe CaseContactsHelper do
RSpec.describe CaseContactsHelper, type: :helper do
describe "#render_back_link" do
it "renders back link to home page when user is a volunteer" do
current_user = create(:volunteer)
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/court_dates_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe CourtDatesHelper do
RSpec.describe CourtDatesHelper, type: :helper do
describe "#when_do_we_have_court_dates" do
subject { helper.when_do_we_have_court_dates(casa_case) }

Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/court_orders_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe CourtDatesHelper do
RSpec.describe CourtDatesHelper, type: :helper do
describe "#court_order_select_options" do
context "when no court orders" do
it "empty" do
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/followup_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe FollowupHelper do
RSpec.describe FollowupHelper, type: :helper do
describe "#followup_icon" do
context "volunteer created followup" do
it "is orange circle with an exclamation point" do
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/mileage_rates_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe MileageRatesHelper do
RSpec.describe MileageRatesHelper, type: :helper do
describe "#effective_date_parser" do
context "with date" do
let(:date) { DateTime.parse("01-01-2021") }
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/notifications_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe NotificationsHelper do
RSpec.describe NotificationsHelper, type: :helper do
context "notifications with respect to deploy time" do
let(:notification_created_after_deploy_a) { create(:notification) }
let(:notification_created_after_deploy_b) { create(:notification, created_at: 1.day.ago) }
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/other_duties_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe OtherDutiesHelper do
RSpec.describe OtherDutiesHelper, type: :helper do
describe "#duration_minutes" do
it "returns remainder if duration_minutes is set" do
other_duty = build(:other_duty, duration_minutes: 80)
Expand Down
108 changes: 52 additions & 56 deletions spec/helpers/phone_number_helper_spec.rb
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
2 changes: 1 addition & 1 deletion spec/helpers/report_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe ReportHelper do
RSpec.describe ReportHelper, type: :helper do
describe "#boolean_choices" do
it "returns array with correct options" do
expect(helper.boolean_choices).to eq [["Both", ""], ["Yes", true], ["No", false]]
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/sidebar_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe SidebarHelper do
RSpec.describe SidebarHelper, type: :helper do
describe "#menu_item" do
it "does not render sidebar menu item when not visible" do
menu_item = helper.menu_item(label: "Supervisors", path: supervisors_path, visible: false)
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/sms_body_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe SmsBodyHelper do
RSpec.describe SmsBodyHelper, type: :helper do
describe "#account_activation_msg" do
it "correct short links provided" do
expected_response = account_activation_msg("primogems", {0 => "www.pasta.com", 1 => "www.yogurt.com"})
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/ui_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe UiHelper do
RSpec.describe UiHelper, type: :helper do
describe "#grouped_options_for_assigning_case" do
before(:each) do
@casa_cases = create_list(:casa_case, 4)
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
# behaviour is considered legacy and will be removed in a future version.
#
# To enable this behaviour uncomment the line below.
config.infer_spec_type_from_file_location!
# config.infer_spec_type_from_file_location!
# Auto detect datatable type specs
config.define_derived_metadata(file_path: Regexp.new("/spec/datatables/")) do |metadata|
metadata[:type] = :datatable
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/all_casa_admins/casa_admins_spec.rb
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) }
Expand Down

0 comments on commit d78fa52

Please sign in to comment.