Skip to content

Commit

Permalink
Remove "is_bootstrap?" from all feature specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarcoux committed Aug 28, 2019
1 parent f0935d3 commit 1277918
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 48 deletions.
Expand Up @@ -25,7 +25,7 @@

context 'update as admin user' do
it_behaves_like 'updatable' do
let(:title) { is_bootstrap? ? 'Notifications' : 'Global Notification Settings' }
let(:title) { 'Notifications' }
let(:user) { create(:admin_user, login: 'king') }
let(:path) { notifications_path }
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/features/webui/notifications_spec.rb
Expand Up @@ -40,7 +40,7 @@

context 'update as admin user' do
it_behaves_like 'updatable' do
let(:title) { is_bootstrap? ? 'Notifications' : 'Global Notification Settings' }
let(:title) { 'Notifications' }
let(:user) { create(:admin_user, login: 'king') }
let(:path) { notifications_path }
end
Expand Down
9 changes: 3 additions & 6 deletions src/api/spec/features/webui/projects_spec.rb
Expand Up @@ -63,7 +63,7 @@

scenario 'with invalid data (validation fails)' do
fill_in 'name', with: 'cool stuff'
is_bootstrap? ? click_button('Create') : click_button('Accept')
click_button('Create')

expect(page).to have_text("Invalid package name: 'cool stuff'")
expect(page.current_path).to eq("/project/new_package/#{user.home_project_name}")
Expand All @@ -73,7 +73,7 @@
create(:package, name: 'coolstuff', project: user.home_project)

fill_in 'name', with: 'coolstuff'
is_bootstrap? ? click_button('Create') : click_button('Accept')
click_button('Create')

expect(page).to have_text("Package 'coolstuff' already exists in project '#{user.home_project_name}'")
expect(page.current_path).to eq("/project/new_package/#{user.home_project_name}")
Expand Down Expand Up @@ -102,7 +102,7 @@
click_link('Create Package')

fill_in 'name', with: 'coolstuff'
is_bootstrap? ? click_button('Create') : click_button('Accept')
click_button('Create')

expect(page).to have_text("Package 'coolstuff' was created successfully")
expect(page.current_path).to eq(package_show_path(project: global_project.to_s, package: 'coolstuff'))
Expand Down Expand Up @@ -311,7 +311,6 @@
scenario 'an existing package' do
fill_in('linked_project', with: other_user.home_project_name)
fill_in('linked_package', with: package_of_another_project.name)
expect(page).to(have_text('1 result is available')) unless is_bootstrap?
# This needs global write through
click_button('Accept')

Expand Down Expand Up @@ -348,7 +347,6 @@

fill_in('linked_project', with: other_user.home_project_name)
fill_in('linked_package', with: package_of_another_project.name)
expect(page).to(have_text('1 result is available')) unless is_bootstrap?
# This needs global write through
click_button('Accept')

Expand Down Expand Up @@ -426,7 +424,6 @@
login(admin_user)
visit project_show_path(project)

click_link('Advanced') unless is_bootstrap?
click_link('Attributes')
click_link('Add a new attribute')
select('OBS:MaintenanceProject')
Expand Down
50 changes: 14 additions & 36 deletions src/api/spec/features/webui/search_spec.rb
Expand Up @@ -44,12 +44,7 @@

fill_in 'search_input', with: apache2.name
click_button 'Advanced'
if is_bootstrap?
select('Projects', from: 'search_for')
else
check('project')
uncheck('package')
end
select('Projects', from: 'search_for')

click_button 'Search'

Expand All @@ -70,12 +65,7 @@

fill_in 'search_input', with: 'goal'
click_button 'Advanced'
if is_bootstrap?
select('Packages', from: 'search_for')
else
check('package')
uncheck('project')
end
select('Packages', from: 'search_for')

check 'title', allow_label_click: true
click_button 'Search'
Expand Down Expand Up @@ -140,13 +130,10 @@
fill_in 'search_input', with: 'fooo'
click_button 'Search'

if is_bootstrap?
within('#flash') do
expect(page).to have_text('Your search did not return any results.')
end
else
expect(find('#flash-messages')).to have_text('Your search did not return any results.')
within('#flash') do
expect(page).to have_text('Your search did not return any results.')
end

expect(page).to have_selector('#search-results', count: 0)
end

Expand All @@ -164,13 +151,10 @@
uncheck 'package'
click_button 'Search'

if is_bootstrap?
within('#flash') do
expect(page).to have_text('Your search did not return any results.')
end
else
expect(find('#flash-messages')).to have_text('Your search did not return any results.')
within('#flash') do
expect(page).to have_text('Your search did not return any results.')
end

expect(page).to have_selector('#search-results', count: 0)
end

Expand All @@ -188,13 +172,10 @@
uncheck 'description', allow_label_click: true
click_button 'Search'

if is_bootstrap?
within('#flash') do
expect(page).to have_text('You have to search for awesome in something. Click the advanced button...')
end
else
expect(find('#flash-messages')).to have_text('You have to search for awesome in something. Click the advanced button...')
within('#flash') do
expect(page).to have_text('You have to search for awesome in something. Click the advanced button...')
end

expect(page).to have_selector('#search-results', count: 0)
end

Expand Down Expand Up @@ -231,13 +212,10 @@
check 'title', allow_label_click: true
click_button 'Search'

if is_bootstrap?
within('#flash') do
expect(page).to have_text('Your search did not return any results.')
end
else
expect(find('#flash-messages')).to have_text('Your search did not return any results.')
within('#flash') do
expect(page).to have_text('Your search did not return any results.')
end

expect(page).to have_selector('#search-results', count: 0)
end

Expand Down
4 changes: 0 additions & 4 deletions src/api/spec/support/features/features_bootstrap.rb
@@ -1,8 +1,4 @@
module FeaturesBootstrap
def is_bootstrap?
ENV['BOOTSTRAP'].present?
end

def skip_if_bootstrap
msg = 'The feature tests are executed with BOOTSTRAP enabled, therefore we skip this test.'
skip(msg) if ENV['BOOTSTRAP'].present?
Expand Down

0 comments on commit 1277918

Please sign in to comment.