Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Route switchto action via POST - Replace links in themes admin with a single button
- Loading branch information
Showing
8 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
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
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
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,25 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "Admin::Themes", type: :request do | ||
before do | ||
create(:blog) | ||
henri = create(:user, :as_admin) | ||
sign_in henri | ||
end | ||
|
||
describe "GET /admin/themes/switchto" do | ||
it "is not available" do | ||
expect { get switchto_admin_themes_path(theme: "bootstrap-2") }. | ||
to raise_error ActiveRecord::RecordNotFound | ||
end | ||
end | ||
|
||
describe "POST /admin/themes/switchto" do | ||
it "redirects to the themes list" do | ||
post switchto_admin_themes_path(theme: "bootstrap-2") | ||
expect(response).to redirect_to admin_themes_path | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.feature "Changing themes", type: :feature do | ||
let(:admin) { create :user, :as_admin } | ||
let(:blog) { Blog.first } | ||
|
||
before do | ||
load Rails.root.join("db/seeds.rb") | ||
Blog.first.update blog_name: "Awesome!", base_url: "http://www.example.com/" | ||
end | ||
|
||
scenario "switching themes by clicking links in the themes admin" do | ||
sign_in admin | ||
visit "/admin/themes" | ||
|
||
expect(page).to have_text "plain - Active theme" | ||
|
||
click_link_or_button "Use this theme" | ||
|
||
expect(page).to have_text "bootstrap-2 - Active theme" | ||
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