File _service:set_version:obs_scm:obs-api-testsuite-rspec.spec of Package obs-server
#
# spec file for package obs-api-testsuite-rspec
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%if 0%{?fedora} || 0%{?rhel} || 0%{?centos}
%define __obs_ruby_bin /usr/bin/ruby
%define __obs_rake_bin /usr/bin/rake
%else
%define __obs_ruby_bin /usr/bin/ruby.ruby3.1
%define __obs_rake_bin /usr/bin/rake.ruby3.1
%endif
Name: obs-api-testsuite-rspec
Version: 2.11~alpha.20230420T205147.bcbc62f7
Release: 0
Summary: The Open Build Service -- RSpec test suite
License: GPL-2.0-only OR GPL-3.0-only
Group: Productivity/Networking/Web/Utilities
Url: http://www.openbuildservice.org
Source0: open-build-service-%version.tar.xz
BuildRequires: obs-api-testsuite-deps
# rspec specific dependencies
BuildRequires: chromedriver
%if 0%{?fedora} || 0%{?rhel} || 0%{?centos}
BuildRequires: chromium
BuildRequires: xorg-x11-fonts-Type1
BuildRequires: xorg-x11-fonts-cyrillic
BuildRequires: xorg-x11-fonts-misc
# Needed for rubygem-byebug
BuildRequires: rubygem-irb
%else
BuildRequires: xorg-x11-fonts
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?disable_obs_frontend_test_suite} || 0%{?disable_obs_test_suite}
ExclusiveArch: nothere
%else
ExclusiveArch: x86_64
%endif
%description
Running the RSpec test suite of the OBS frontend independently
of packaging the application
%prep
%setup -q -n open-build-service-%{version}
%if 0%{?fedora} || 0%{?rhel} || 0%{?centos}
sed -i \
-e '1s|^#!/usr/bin/env ruby\.ruby.*|#!%{__obs_ruby_bin}|' \
-e '1s|^#!/usr/bin/env ruby|#!%{__obs_ruby_bin}|' \
-e '1s|^#! */usr/bin/ruby\.ruby.*|#!%{__obs_ruby_bin}|' \
docs/api/restility/bin/* \
src/api/bin/* \
src/api/script/*
sed -i \
-e '1s|^#! */usr/bin/rake\.ruby.*|#!%{__obs_rake_bin}|' \
src/api/Rakefile \
sed -i \
-e "s|'/usr/lib64/chromium/chromedriver'|'/usr/lib64/chromium-browser/chromedriver'|" \
src/api/spec/support/capybara.rb
%endif
bundler_version="`bundle version | sed 's/^Bundler version \([^ ]*\) .*$/\1/'`"
sed -i "\$s/^\\( *\\)[^ ]*\$/\\1$bundler_version/" src/api/Gemfile.lock
%build
# run in build environment
pushd src/backend/
rm -rf build
ln -sf /usr/lib/build build
popd
pushd src/api
# configure to the bundled gems
bundle --local --path %_libdir/obs-api/
./script/prepare_spec_tests.sh
export RAILS_ENV=test
bin/rake db:setup
bin/rails assets:precompile
bin/rspec -f d --exclude-pattern 'spec/db/**/*_spec.rb'
# now migration tests (if they fail they create tons of follow up errors, so run them last)
bin/rspec -f d -P 'spec/db/**/*_spec.rb'
%install
# no result
%files
%changelog