mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 19:02:46 +08:00
Support ruby 2.5.0
This commit is contained in:
parent
6c1ebbb95c
commit
bc56d86a63
|
@ -21,8 +21,6 @@ addons:
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
|
||||||
- rvm: 2.5.0
|
|
||||||
|
|
||||||
rvm:
|
rvm:
|
||||||
- 2.5.0
|
- 2.5.0
|
||||||
|
|
|
@ -29,7 +29,8 @@ module Jobs
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_csv_file(csv_path)
|
def read_csv_file(csv_path)
|
||||||
CSV.foreach(csv_path, encoding: "bom|utf-8") do |csv_info|
|
file = File.open(csv_path, encoding: 'bom|utf-8')
|
||||||
|
CSV.new(file).each do |csv_info|
|
||||||
if csv_info[0]
|
if csv_info[0]
|
||||||
if (EmailValidator.email_regex =~ csv_info[0])
|
if (EmailValidator.email_regex =~ csv_info[0])
|
||||||
# email is valid
|
# email is valid
|
||||||
|
@ -45,6 +46,8 @@ module Jobs
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
log "Bulk Invite Process Failed -- '#{e.message}'"
|
log "Bulk Invite Process Failed -- '#{e.message}'"
|
||||||
@failed += 1
|
@failed += 1
|
||||||
|
ensure
|
||||||
|
file.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_group_ids(group_names, csv_line_number)
|
def get_group_ids(group_names, csv_line_number)
|
||||||
|
|
|
@ -12,7 +12,7 @@ describe Jobs::BulkInvite do
|
||||||
context '.read_csv_file' do
|
context '.read_csv_file' do
|
||||||
let(:user) { Fabricate(:user) }
|
let(:user) { Fabricate(:user) }
|
||||||
let(:bulk_invite) { Jobs::BulkInvite.new }
|
let(:bulk_invite) { Jobs::BulkInvite.new }
|
||||||
let(:csv_file) { File.new("#{Rails.root}/spec/fixtures/csv/discourse.csv") }
|
let(:csv_file) { "#{Rails.root}/spec/fixtures/csv/discourse.csv" }
|
||||||
|
|
||||||
it 'reads csv file' do
|
it 'reads csv file' do
|
||||||
bulk_invite.current_user = user
|
bulk_invite.current_user = user
|
||||||
|
|
Loading…
Reference in New Issue
Block a user