Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: AlchemyCMS/alchemy_cms
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a1aa2276ee76737340c58079ff318ede6d879c6d
Choose a base ref
..
head repository: AlchemyCMS/alchemy_cms
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 45ec14f5df665e05dd877e1ffe52726de400999c
Choose a head ref
Showing with 3 additions and 5 deletions.
  1. +1 −2 app/controllers/alchemy/pages_controller.rb
  2. +2 −3 spec/controllers/alchemy/pages_controller_spec.rb
3 changes: 1 addition & 2 deletions app/controllers/alchemy/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -223,8 +223,7 @@ def signup_required?
# Otherwise all users will see the same cached page, regardless of user's state.
#
def page_etag
@page.cache_key_with_version +
current_alchemy_user.try(:cache_key_with_version).to_s
[@page, current_alchemy_user]
end

# We only render the page if either the cache is disabled for this page
5 changes: 2 additions & 3 deletions spec/controllers/alchemy/pages_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -273,12 +273,11 @@ module Alchemy
subject { controller.send(:page_etag) }

before do
expect(page).to receive(:cache_key_with_version).and_return("aaa")
controller.instance_variable_set("@page", page)
end

it "returns the etag for response headers" do
expect(subject).to eq("aaa")
expect(subject).to include(page)
end

context "with user logged in" do
@@ -287,7 +286,7 @@ module Alchemy
end

it "returns another etag for response headers" do
expect(subject).to eq("aaabbb")
expect(subject).to include(an_instance_of(Alchemy.user_class))
end
end
end