2019-11-20 21:06:38 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-04-03 13:29:27 +00:00
|
|
|
require "spec_helper"
|
|
|
|
|
2020-06-24 18:09:03 +00:00
|
|
|
RSpec.describe Gitlab::GoogleCodeImport::Client do
|
2020-05-01 00:09:59 +00:00
|
|
|
let(:raw_data) { Gitlab::Json.parse(fixture_file("GoogleCodeProjectHosting.json")) }
|
2019-12-12 12:07:33 +00:00
|
|
|
|
2015-04-03 13:29:27 +00:00
|
|
|
subject { described_class.new(raw_data) }
|
|
|
|
|
|
|
|
describe "#valid?" do
|
|
|
|
context "when the data is valid" do
|
|
|
|
it "returns true" do
|
|
|
|
expect(subject).to be_valid
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when the data is invalid" do
|
|
|
|
let(:raw_data) { "No clue" }
|
|
|
|
|
|
|
|
it "returns true" do
|
2015-06-18 01:30:58 +00:00
|
|
|
expect(subject).not_to be_valid
|
2015-04-03 13:29:27 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#repos" do
|
|
|
|
it "returns only Git repositories" do
|
|
|
|
expect(subject.repos.length).to eq(1)
|
2015-04-29 07:33:49 +00:00
|
|
|
expect(subject.incompatible_repos.length).to eq(1)
|
2015-04-03 13:29:27 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#repo" do
|
|
|
|
it "returns the referenced repository" do
|
|
|
|
expect(subject.repo("tint2").name).to eq("tint2")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|