Commit 211ad124 authored by Philip Cunningham's avatar Philip Cunningham

Use generate(:url) instead of FFaker::Internet.uri

Invalid URLs (localhost, etc) were being generated in tests.
parent f5f1a283
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
FactoryBot.define do FactoryBot.define do
factory :dast_site_token do factory :dast_site_token do
token { SecureRandom.uuid } token { SecureRandom.uuid }
url { FFaker::Internet.uri(:https) } url { generate(:url) }
before(:create) do |dast_site_token| before(:create) do |dast_site_token|
dast_site_token.project ||= FactoryBot.create(:project) dast_site_token.project ||= FactoryBot.create(:project)
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
FactoryBot.define do FactoryBot.define do
factory :dast_site do factory :dast_site do
project project
url { FFaker::Internet.uri(:https) } url { generate(:url) }
end end
end end
...@@ -8,7 +8,7 @@ RSpec.describe Mutations::DastSiteProfiles::Create do ...@@ -8,7 +8,7 @@ RSpec.describe Mutations::DastSiteProfiles::Create do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:full_path) { project.full_path } let(:full_path) { project.full_path }
let(:profile_name) { SecureRandom.hex } let(:profile_name) { SecureRandom.hex }
let(:target_url) { FFaker::Internet.uri(:https) } let(:target_url) { generate(:url) }
let(:dast_site_profile) { DastSiteProfile.find_by(project: project, name: profile_name) } let(:dast_site_profile) { DastSiteProfile.find_by(project: project, name: profile_name) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
......
...@@ -10,7 +10,7 @@ RSpec.describe Mutations::DastSiteProfiles::Update do ...@@ -10,7 +10,7 @@ RSpec.describe Mutations::DastSiteProfiles::Update do
let!(:dast_site_profile) { create(:dast_site_profile, project: project) } let!(:dast_site_profile) { create(:dast_site_profile, project: project) }
let(:new_profile_name) { SecureRandom.hex } let(:new_profile_name) { SecureRandom.hex }
let(:new_target_url) { FFaker::Internet.uri(:https) } let(:new_target_url) { generate(:url) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
......
...@@ -7,7 +7,7 @@ RSpec.describe Mutations::Pipelines::RunDastScan do ...@@ -7,7 +7,7 @@ RSpec.describe Mutations::Pipelines::RunDastScan do
let(:project) { create(:project, :repository, group: group) } let(:project) { create(:project, :repository, group: group) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project_path) { project.full_path } let(:project_path) { project.full_path }
let(:target_url) { FFaker::Internet.uri(:https) } let(:target_url) { generate(:url) }
let(:branch) { project.default_branch } let(:branch) { project.default_branch }
let(:scan_type) { Types::DastScanTypeEnum.enum[:passive] } let(:scan_type) { Types::DastScanTypeEnum.enum[:passive] }
......
...@@ -6,7 +6,7 @@ RSpec.describe 'Creating a DAST Site Profile' do ...@@ -6,7 +6,7 @@ RSpec.describe 'Creating a DAST Site Profile' do
include GraphqlHelpers include GraphqlHelpers
let(:profile_name) { FFaker::Company.catch_phrase } let(:profile_name) { FFaker::Company.catch_phrase }
let(:target_url) { FFaker::Internet.uri(:https) } let(:target_url) { generate(:url) }
let(:dast_site_profile) { DastSiteProfile.find_by(project: project, name: profile_name) } let(:dast_site_profile) { DastSiteProfile.find_by(project: project, name: profile_name) }
let(:mutation_name) { :dast_site_profile_create } let(:mutation_name) { :dast_site_profile_create }
......
...@@ -8,7 +8,7 @@ RSpec.describe 'Creating a DAST Site Profile' do ...@@ -8,7 +8,7 @@ RSpec.describe 'Creating a DAST Site Profile' do
let!(:dast_site_profile) { create(:dast_site_profile, project: project) } let!(:dast_site_profile) { create(:dast_site_profile, project: project) }
let(:new_profile_name) { SecureRandom.hex } let(:new_profile_name) { SecureRandom.hex }
let(:new_target_url) { FFaker::Internet.uri(:https) } let(:new_target_url) { generate(:url) }
let(:mutation_name) { :dast_site_profile_update } let(:mutation_name) { :dast_site_profile_update }
let(:mutation) do let(:mutation) do
......
...@@ -8,7 +8,7 @@ RSpec.describe 'Running a DAST Scan' do ...@@ -8,7 +8,7 @@ RSpec.describe 'Running a DAST Scan' do
let(:project) { create(:project, :repository, creator: current_user) } let(:project) { create(:project, :repository, creator: current_user) }
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
let(:project_path) { project.full_path } let(:project_path) { project.full_path }
let(:target_url) { FFaker::Internet.uri(:https) } let(:target_url) { generate(:url) }
let(:branch) { project.default_branch } let(:branch) { project.default_branch }
let(:scan_type) { Types::DastScanTypeEnum.enum[:passive] } let(:scan_type) { Types::DastScanTypeEnum.enum[:passive] }
......
...@@ -6,7 +6,7 @@ RSpec.describe Ci::RunDastScanService do ...@@ -6,7 +6,7 @@ RSpec.describe Ci::RunDastScanService do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository, creator: user) } let(:project) { create(:project, :repository, creator: user) }
let(:branch) { project.default_branch } let(:branch) { project.default_branch }
let(:target_url) { FFaker::Internet.uri(:http) } let(:target_url) { generate(:url) }
before do before do
stub_licensed_features(security_on_demand_scans: true) stub_licensed_features(security_on_demand_scans: true)
......
...@@ -6,7 +6,7 @@ RSpec.describe DastSiteProfiles::CreateService do ...@@ -6,7 +6,7 @@ RSpec.describe DastSiteProfiles::CreateService do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository, creator: user) } let(:project) { create(:project, :repository, creator: user) }
let(:name) { FFaker::Company.catch_phrase } let(:name) { FFaker::Company.catch_phrase }
let(:target_url) { FFaker::Internet.uri(:http) } let(:target_url) { generate(:url) }
before do before do
stub_licensed_features(security_on_demand_scans: true) stub_licensed_features(security_on_demand_scans: true)
......
...@@ -8,7 +8,7 @@ RSpec.describe DastSiteProfiles::UpdateService do ...@@ -8,7 +8,7 @@ RSpec.describe DastSiteProfiles::UpdateService do
let(:dast_site_profile) { create(:dast_site_profile) } let(:dast_site_profile) { create(:dast_site_profile) }
let(:new_profile_name) { SecureRandom.hex } let(:new_profile_name) { SecureRandom.hex }
let(:new_target_url) { FFaker::Internet.uri(:https) } let(:new_target_url) { generate(:url) }
before do before do
stub_licensed_features(security_on_demand_scans: true) stub_licensed_features(security_on_demand_scans: true)
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe DastSites::FindOrCreateService do RSpec.describe DastSites::FindOrCreateService do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository, creator: user) } let(:project) { create(:project, :repository, creator: user) }
let(:url) { FFaker::Internet.uri(:http) } let(:url) { generate(:url) }
before do before do
stub_licensed_features(security_on_demand_scans: true) stub_licensed_features(security_on_demand_scans: true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment