Skip to content
Browse files

Ensure Set-Cookie is not set on assets.

  • Loading branch information...
1 parent f3b0be8 commit 6d3122445c4778ec85ce7fe66126845c4100304d @josevalim josevalim committed
Showing with 27 additions and 25 deletions.
  1. +2 −1 Gemfile
  2. +25 −24 railties/test/application/assets_test.rb
View
3 Gemfile
@@ -10,7 +10,8 @@ end
gem "coffee-script"
gem "sass"
-gem "uglifier", :git => 'git://github.com/lautis/uglifier.git'
+gem "uglifier", :git => "git://github.com/lautis/uglifier.git"
+gem "rack", :git => "git://github.com/rack/rack.git"
gem "rake", ">= 0.8.7"
gem "mocha", ">= 0.9.8"
View
49 railties/test/application/assets_test.rb
@@ -24,35 +24,36 @@ def app
end
RUBY
+ require "#{app_path}/config/environment"
+
get "/assets/demo.js"
assert_match "alert()", last_response.body
end
test "does not stream session cookies back" do
- puts "PENDING SPROCKETS AND RACK RELEASE"
- # app_file "app/assets/javascripts/demo.js.erb", "<%= :alert %>();"
- #
- # app_file "config/routes.rb", <<-RUBY
- # AppTemplate::Application.routes.draw do
- # match '/omg', :to => "omg#index"
- # end
- # RUBY
- #
- # require "#{app_path}/config/environment"
- #
- # class ::OmgController < ActionController::Base
- # def index
- # flash[:cool_story] = true
- # render :text => "ok"
- # end
- # end
- #
- # get "/omg"
- # assert_equal 'ok', last_response.body
- #
- # get "/assets/demo.js"
- # assert_match "alert()", last_response.body
- # assert_equal nil, last_response.headers["Set-Cookie"]
+ app_file "app/assets/javascripts/demo.js.erb", "<%= :alert %>();"
+
+ app_file "config/routes.rb", <<-RUBY
+ AppTemplate::Application.routes.draw do
+ match '/omg', :to => "omg#index"
+ end
+ RUBY
+
+ require "#{app_path}/config/environment"
+
+ class ::OmgController < ActionController::Base
+ def index
+ flash[:cool_story] = true
+ render :text => "ok"
+ end
+ end
+
+ get "/omg"
+ assert_equal 'ok', last_response.body
+
+ get "/assets/demo.js"
+ assert_match "alert()", last_response.body
+ assert_equal nil, last_response.headers["Set-Cookie"]
end
end
end

1 comment on commit 6d31224

@stephenjudkins

Awesome! Thanks for being so on top of this.

Please sign in to comment.
Something went wrong with that request. Please try again.