-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test the BsRequestActionDescriptionComponent preview
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/api/spec/components/bs_request_action_description_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,32 @@ | ||
RSpec.describe BsRequestActionDescriptionComponent, type: :component do | ||
context 'when testing the previews' do | ||
let(:user) { create(:confirmed_user, :with_home) } | ||
let(:creator) { create(:confirmed_user, login: 'creator', realname: 'Creator') } | ||
let(:source_prj) { create(:project) } | ||
let(:source_pkg) { create(:package, project: source_prj) } | ||
let(:target_prj) { user.home_project } | ||
let(:target_pkg) { create(:package, project: target_prj) } | ||
|
||
context 'when previewing the submit' do | ||
let!(:bs_request) do | ||
create(:bs_request, type: 'submit', source_package: source_pkg, source_project: source_prj, target_project: target_prj, target_package: target_pkg, creator: user) | ||
end | ||
|
||
it 'renders the preview' do | ||
render_preview(:submit_preview) | ||
|
||
expect(rendered_content).to have_text("Submit package #{source_prj} / #{source_pkg} to package #{target_prj} / #{target_pkg}") | ||
end | ||
end | ||
|
||
context 'when previewing the add role' do | ||
let!(:bs_request) { create(:bs_request, type: :add_role, target_project: user.home_project, role: 'maintainer', person_name: user.login, creator: creator) } | ||
|
||
it 'renders the preview' do | ||
render_preview(:add_role_preview) | ||
|
||
expect(rendered_content).to have_text("Creator (creator) wants the user #{user.name} (#{user.login}) to get the role maintainer for project #{user.home_project}") | ||
end | ||
end | ||
end | ||
end |
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