Skip to content

Commit

Permalink
[ci] Add missing test for Kiwi::Repository#name
Browse files Browse the repository at this point in the history
  • Loading branch information
Moises Deniz Aleman committed Jul 24, 2017
1 parent 678af69 commit 0d3b6de
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/api/spec/models/kiwi/repository_spec.rb
Expand Up @@ -4,6 +4,20 @@
RSpec.describe Kiwi::Repository, type: :model do
let(:kiwi_repository) { create(:kiwi_repository) }

describe '#name' do
context 'with an alias' do
subject { create(:kiwi_repository, alias: 'my_alias_repo') }

it { expect(subject.name).to eq('my_alias_repo') }
end

context 'without alias' do
subject { create(:kiwi_repository, alias: nil, source_path: 'http://example.org/my_repo') }

it { expect(subject.name).to eq('http:__example.org_my_repo') }
end
end

describe 'validations' do
context 'for source_path' do
it { is_expected.to validate_presence_of(:source_path) }
Expand Down Expand Up @@ -68,7 +82,7 @@
it { is_expected.to allow_value(nil).for(:prefer_license) }
end

describe '.to_xml' do
describe '#to_xml' do
subject { kiwi_repository.to_xml }

it { expect(subject).to eq("<repository type=\"apt-deb\">\n <source path=\"http://example.com/\"/>\n</repository>\n") }
Expand Down

0 comments on commit 0d3b6de

Please sign in to comment.