-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add spec for BuildResultForArchitectureComponent
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/api/spec/components/build_result_for_architecture_component_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe BuildResultForArchitectureComponent, type: :component do | ||
let(:project) { 'fake_project' } | ||
let(:package) { 'fake_package' } | ||
|
||
before do | ||
render_inline(described_class.new(result, project, package)) | ||
end | ||
|
||
context 'with succeeded result' do | ||
let(:result) do | ||
LocalBuildResult.new( | ||
repository: '15.4', | ||
architecture: 'x86_64', | ||
code: 'succeeded', | ||
state: 'blocked', | ||
is_repository_in_db: 'true' | ||
) | ||
end | ||
|
||
it { expect(rendered_content).to have_selector('.build-result', class: 'border-success') } | ||
it { expect(rendered_content).to have_selector('.build-status i', class: 'fa-check text-success') } | ||
it { expect(rendered_content).to have_selector('.build-status span', text: 'succeeded') } | ||
it { expect(rendered_content).to have_selector('.repository-status i', class: 'fa-lock') } | ||
it { expect(rendered_content).to have_selector('.repository-status span', text: 'blocked') } | ||
it { expect(rendered_content).not_to have_selector("div[data-content*='Details']") } | ||
end | ||
|
||
context 'with excluded but visible result' do | ||
let(:result) do | ||
LocalBuildResult.new( | ||
repository: '15.4', | ||
architecture: 'x86_64', | ||
code: 'excluded', | ||
state: 'published', | ||
is_repository_in_db: 'true', | ||
details: 'fake details' | ||
) | ||
end | ||
|
||
it { expect(rendered_content).to have_selector('.build-result', class: 'border-gray-300') } | ||
it { expect(rendered_content).to have_selector('.build-status i', class: 'fa-xmark text-gray-500') } | ||
it { expect(rendered_content).to have_selector('.build-status span', text: 'excluded') } | ||
it { expect(rendered_content).to have_selector('.repository-status i', class: 'fa-truck') } | ||
it { expect(rendered_content).to have_selector('.repository-status span', text: 'published') } | ||
it { expect(rendered_content).to have_selector("div[data-content*='fake details']") } | ||
end | ||
end |