Skip to content

Commit

Permalink
Fixed crashed tests (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonovk authored May 13, 2024
1 parent bd75d37 commit 022f27b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions spec/app/clients_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

context 'when there is already a configuration file without clients' do
before do
FileUtils.cp('spec/fixtures/empty_wg0.json', wg_conf_path)
create_conf_file('spec/fixtures/empty_wg0.json')
end

it 'returns an empty array' do
Expand All @@ -54,7 +54,7 @@

context 'when there is already a configuration file with clients' do
before do
FileUtils.cp('spec/fixtures/wg0.json', wg_conf_path)
create_conf_file('spec/fixtures/wg0.json')
end

let(:expected_result) do
Expand Down Expand Up @@ -115,7 +115,7 @@

describe '#show' do
before do
FileUtils.cp('spec/fixtures/wg0.json', wg_conf_path)
create_conf_file('spec/fixtures/wg0.json')
end

context 'when the necessary config is available' do
Expand Down Expand Up @@ -150,4 +150,11 @@
end
end
end

private

def create_conf_file(from)
FileUtils.mkdir_p(Settings.wg_path)
FileUtils.cp(from, wg_conf_path)
end
end

0 comments on commit 022f27b

Please sign in to comment.