Skip to content

Commit

Permalink
Fix tests for new validations
Browse files Browse the repository at this point in the history
  • Loading branch information
hellcp-work committed Apr 30, 2024
1 parent 7d3fe27 commit 1099fa8
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 47 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/api/spec/controllers/webui/package_controller_spec.rb
Expand Up @@ -782,15 +782,15 @@
context 'invalid package name' do
let(:package_name) { 'A' * 250 }

it { expect(response).to redirect_to(new_package_path(source_project)) }
it { expect(flash[:error]).to match("Invalid package name:\s.*") }
it { expect(response).to redirect_to(project_show_path(source_project)) }
it { expect(flash[:error]).to match('Failed to create package: Name is too long (maximum is 200 characters), Name is illegal') }
end

context 'package already exist' do
let(:package_name) { package.name }

it { expect(response).to redirect_to(new_package_path(source_project)) }
it { expect(flash[:error]).to start_with("Package '#{package.name}' already exists in project") }
it { expect(response).to redirect_to(project_show_path(source_project)) }
it { expect(flash[:error]).to start_with("Failed to create package: Project `#{source_project.name}` already has a package with the name `#{package_name}`") }
end

context 'not allowed to create package in' do
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/features/webui/packages_spec.rb
Expand Up @@ -343,8 +343,8 @@
fill_in 'package_name', with: 'cool stuff'
click_button('Create')

expect(page).to have_text("Invalid package name: 'cool stuff'")
expect(page).to have_current_path("/package/new/#{user.home_project_name}", ignore_query: true)
expect(page).to have_text('Failed to create package: Name is illegal')
expect(page).to have_current_path("/project/show/#{user.home_project_name}", ignore_query: true)
end

it 'creates a package' do
Expand Down

0 comments on commit 1099fa8

Please sign in to comment.