-
Notifications
You must be signed in to change notification settings - Fork 22k
Closed
Description
This issue has been ported from the report at rspec/rspec-rails#1658, as it can be replicated purely with Rails using public API. This test passes using Rails 4.2
Steps to reproduce
Reproduction Script
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
end
require "action_controller/railtie"
class TestApp < Rails::Application
config.root = File.dirname(__FILE__)
secrets.secret_token = "secret_token"
secrets.secret_key_base = "secret_key_base"
config.logger = Logger.new($stdout)
Rails.logger = config.logger
routes.draw do
get "/" => "test#index"
end
end
class TestController < ActionController::Base
include Rails.application.routes.url_helpers
def index
render plain: "Home"
end
def foo_cookie
cookies.encrypted["foo"]
end
end
require "rails/test_help"
require "minitest/autorun"
class TestControllerTest < ActionController::TestCase
setup do
cookies.encrypted["foo"] = "bar"
end
test "accessing cookies directly" do
get :index
assert_equal "bar", cookies.encrypted["foo"]
end
test "accessing helper method" do
get :index
assert_equal "bar", @controller.foo_cookie
end
end
Expected behavior
Changes to cookies.encrypted
in the test setup should appear in the controller's cookies
Actual behavior
Changes to cookies.encrypted
in the test setup do not affect the controller's cookies
System configuration
Rails version: 5.0.0, 5.0.0.1, master
Ruby version: 2.3.3
dsandstrom, EdgarOrtegaRamirez, arich, donv, texpert and 10 more