geo_tasks_spec.rb 598 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
require 'spec_helper'

describe Gitlab::Geo::GeoTasks do
  describe '.set_primary_geo_node' do
    before do
      allow(GeoNode).to receive(:current_node_url).and_return('https://primary.geo.example.com')
    end

    it 'sets the primary node' do
10
      expect { subject.set_primary_geo_node }.to output(%r{https://primary.geo.example.com/ is now the primary Geo node}).to_stdout
11 12 13 14 15 16 17 18 19
    end

    it 'returns error when there is already a Primary node' do
      create(:geo_node, :primary)

      expect { subject.set_primary_geo_node }.to output(/Error saving Geo node:/).to_stdout
    end
  end
end