Commit 61fffbe0 authored by Ryan Cobb's avatar Ryan Cobb

Dont use class_eval

parent b521c390
......@@ -192,9 +192,7 @@ describe GitlabSchema do
# We cannot use an anonymous class here as `GlobalID` expects `.name` not
# to return `nil`
before do
stub_const('TestGlobalId', Class.new)
TestGlobalId.class_eval do
test_global_id = Class.new do
include GlobalID::Identification
attr_accessor :id
......@@ -202,6 +200,8 @@ describe GitlabSchema do
@id = id
end
end
stub_const('TestGlobalId', test_global_id)
end
it 'falls back to a regular find' do
......
......@@ -149,19 +149,19 @@ describe VisibilityLevelHelper do
# This is a subset of all the permutations
where(:requested_level, :max_allowed, :global_default_level, :restricted_levels, :expected) do
public_vis = Gitlab::VisibilityLevel::PUBLIC
internal = Gitlab::VisibilityLevel::INTERNAL
internal_vis = Gitlab::VisibilityLevel::INTERNAL
private_vis = Gitlab::VisibilityLevel::PRIVATE
public_vis | public_vis | public_vis | [] | public_vis
public_vis | public_vis | public_vis | [public_vis] | internal
internal | public_vis | public_vis | [] | internal
internal | private_vis | private_vis | [] | private_vis
public_vis | public_vis | public_vis | [public_vis] | internal_vis
internal_vis | public_vis | public_vis | [] | internal_vis
internal_vis | private_vis | private_vis | [] | private_vis
private_vis | public_vis | public_vis | [] | private_vis
public_vis | private_vis | internal | [] | private_vis
public_vis | internal | public_vis | [] | internal
public_vis | private_vis | internal_vis | [] | private_vis
public_vis | internal_vis | public_vis | [] | internal_vis
public_vis | private_vis | public_vis | [] | private_vis
public_vis | internal | internal | [] | internal
public_vis | public_vis | internal | [] | public_vis
public_vis | internal_vis | internal_vis | [] | internal_vis
public_vis | public_vis | internal_vis | [] | public_vis
end
before do
......
......@@ -6,10 +6,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
before do
# we need to define the classes due to encryption
stub_const('IssueTrackerData', Class.new(ApplicationRecord))
stub_const('JiraTrackerData', Class.new(ApplicationRecord))
IssueTrackerData.class_eval do
issue_tracker_data = Class.new(ApplicationRecord) do
self.table_name = 'issue_tracker_data'
def self.encryption_options
......@@ -26,7 +23,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
attr_encrypted :new_issue_url, encryption_options
end
JiraTrackerData.class_eval do
jira_tracker_data = Class.new(ApplicationRecord) do
self.table_name = 'jira_tracker_data'
def self.encryption_options
......@@ -43,6 +40,9 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
attr_encrypted :username, encryption_options
attr_encrypted :password, encryption_options
end
stub_const('IssueTrackerData', issue_tracker_data)
stub_const('JiraTrackerData', jira_tracker_data)
end
let(:url) { 'http://base-url.tracker.com' }
......
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