Skip to content

Commit

Permalink
Add spec for BuildResultForArchitectureComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
saraycp committed Nov 21, 2022
1 parent 04d07b2 commit 830d9d5
Showing 1 changed file with 49 additions and 0 deletions.
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

0 comments on commit 830d9d5

Please sign in to comment.