Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

fix failing specs

Behrokh Satarnejad91565cd14d09
diff --git a/spec/views/custom_styles/branding.html.erb_spec.rb b/spec/views/custom_styles/branding.html.erb_spec.rb
new file mode 100644
index 00000000000..00318c2a37d
--- /dev/null
+++ b/spec/views/custom_styles/branding.html.erb_spec.rb
@@ -0,0 +1,60 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require "spec_helper"
+
+RSpec.describe "custom_styles/branding" do
+ shared_let(:admin) { create(:admin) }
+
+ before do
+ login_as admin
+ end
+
+ context "no custom logo yet" do
+ before do
+ assign(:custom_style, CustomStyle.new)
+ allow(view).to receive(:options_for_select).and_return("")
+ render
+ end
+
+ it "shows an upload button" do
+ expect(rendered).to include "Upload"
+ end
+ end
+ context "with existing custom logo" do
+ before do
+ assign(:custom_style, build(:custom_style_with_logo))
+ allow(view).to receive(:options_for_select).and_return("")
+ render
+ end
+
+ it "shows a replace button" do
+ expect(rendered).to include "Replace"
+ end
+ end
+end
diff --git a/spec/views/custom_styles/pdf_export_styles.html.erb_spec.rb b/spec/views/custom_styles/pdf_export_styles.html.erb_spec.rb
new file mode 100644
index 00000000000..71218c07573
--- /dev/null
+++ b/spec/views/custom_styles/pdf_export_styles.html.erb_spec.rb
@@ -0,0 +1,61 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require "spec_helper"
+
+RSpec.describe "custom_styles/pdf_export_styles" do
+ shared_let(:admin) { create(:admin) }
+
+ before do
+ login_as admin
+ end
+
+ context "no custom logo yet" do
+ before do
+ assign(:custom_style, CustomStyle.new)
+ allow(view).to receive(:options_for_select).and_return("")
+ render
+ end
+
+ it "shows an upload button" do
+ expect(rendered).to include "Upload"
+ expect(rendered).to have_text I18n.t(:label_custom_export_cover_overlay)
+ end
+ end
+ context "with existing custom logo" do
+ before do
+ assign(:custom_style, build(:custom_style_with_export_logo))
+ allow(view).to receive(:options_for_select).and_return("")
+ render
+ end
+
+ it "shows a replace button" do
+ expect(rendered).to include "Replace"
+ end
+ end
+end
diff --git a/spec/views/custom_styles/show.html.erb_spec.rb b/spec/views/custom_styles/show.html.erb_spec.rb
index d33631f1c31..883fa19f3bb 100644
--- a/spec/views/custom_styles/show.html.erb_spec.rb
+++ b/spec/views/custom_styles/show.html.erb_spec.rb
@@ -33,31 +33,24 @@ RSpec.describe "custom_styles/show" do
before do
login_as user
+ allow(view).to receive(:options_for_select).and_return("")
+ render
end
- context "no custom logo yet" do
+ context "interface tab" do
before do
- assign(:custom_style, CustomStyle.new)
- assign(:current_theme, "")
allow(view).to receive(:options_for_select).and_return("")
render
end
- it "shows an upload button" do
- expect(rendered).to include "Upload"
+ it "doesn't show an upload button" do
+ expect(rendered).not_to include "Upload"
end
- end
-
- context "with existing custom logo" do
- before do
- assign(:custom_style, build(:custom_style_with_logo))
- assign(:current_theme, "")
- allow(view).to receive(:options_for_select).and_return("")
- render
+ it "doesn't show a replace button" do
+ expect(rendered).not_to include "Replace"
end
-
- it "shows a replace button" do
- expect(rendered).to include "Replace"
+ it "shows advanced settings" do
+ expect(rendered).to have_text I18n.t(:label_advanced_settings)
end
end
end