ie_iframe_cookies 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source :rubygems
2
2
 
3
3
  group :dev do # not development <-> would add unneeded development dependencies in gemspec
4
- gem 'rails', '~>2'
4
+ gem 'rails', ENV['RAILS']
5
5
  gem 'redgreen'
6
6
  gem 'rake'
7
7
  gem 'jeweler'
data/Gemfile.lock CHANGED
@@ -1,37 +1,96 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actionmailer (2.3.14)
5
- actionpack (= 2.3.14)
6
- actionpack (2.3.14)
7
- activesupport (= 2.3.14)
8
- rack (~> 1.1.0)
9
- activerecord (2.3.14)
10
- activesupport (= 2.3.14)
11
- activeresource (2.3.14)
12
- activesupport (= 2.3.14)
13
- activesupport (2.3.14)
4
+ actionmailer (3.1.2)
5
+ actionpack (= 3.1.2)
6
+ mail (~> 2.3.0)
7
+ actionpack (3.1.2)
8
+ activemodel (= 3.1.2)
9
+ activesupport (= 3.1.2)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ i18n (~> 0.6)
13
+ rack (~> 1.3.5)
14
+ rack-cache (~> 1.1)
15
+ rack-mount (~> 0.8.2)
16
+ rack-test (~> 0.6.1)
17
+ sprockets (~> 2.1.0)
18
+ activemodel (3.1.2)
19
+ activesupport (= 3.1.2)
20
+ builder (~> 3.0.0)
21
+ i18n (~> 0.6)
22
+ activerecord (3.1.2)
23
+ activemodel (= 3.1.2)
24
+ activesupport (= 3.1.2)
25
+ arel (~> 2.2.1)
26
+ tzinfo (~> 0.3.29)
27
+ activeresource (3.1.2)
28
+ activemodel (= 3.1.2)
29
+ activesupport (= 3.1.2)
30
+ activesupport (3.1.2)
31
+ multi_json (~> 1.0)
32
+ arel (2.2.1)
33
+ builder (3.0.0)
34
+ erubis (2.7.0)
14
35
  git (1.2.5)
36
+ hike (1.2.1)
37
+ i18n (0.6.0)
15
38
  jeweler (1.6.4)
16
39
  bundler (~> 1.0)
17
40
  git (>= 1.2.5)
18
41
  rake
19
- rack (1.1.2)
20
- rails (2.3.14)
21
- actionmailer (= 2.3.14)
22
- actionpack (= 2.3.14)
23
- activerecord (= 2.3.14)
24
- activeresource (= 2.3.14)
25
- activesupport (= 2.3.14)
26
- rake (>= 0.8.3)
42
+ json (1.6.1)
43
+ mail (2.3.0)
44
+ i18n (>= 0.4.0)
45
+ mime-types (~> 1.16)
46
+ treetop (~> 1.4.8)
47
+ mime-types (1.17.2)
48
+ multi_json (1.0.3)
49
+ polyglot (0.3.3)
50
+ rack (1.3.5)
51
+ rack-cache (1.1)
52
+ rack (>= 0.4)
53
+ rack-mount (0.8.3)
54
+ rack (>= 1.0.0)
55
+ rack-ssl (1.3.2)
56
+ rack
57
+ rack-test (0.6.1)
58
+ rack (>= 1.0)
59
+ rails (3.1.2)
60
+ actionmailer (= 3.1.2)
61
+ actionpack (= 3.1.2)
62
+ activerecord (= 3.1.2)
63
+ activeresource (= 3.1.2)
64
+ activesupport (= 3.1.2)
65
+ bundler (~> 1.0)
66
+ railties (= 3.1.2)
67
+ railties (3.1.2)
68
+ actionpack (= 3.1.2)
69
+ activesupport (= 3.1.2)
70
+ rack-ssl (~> 1.3.2)
71
+ rake (>= 0.8.7)
72
+ rdoc (~> 3.4)
73
+ thor (~> 0.14.6)
27
74
  rake (0.9.2)
75
+ rdoc (3.11)
76
+ json (~> 1.4)
28
77
  redgreen (1.2.2)
78
+ sprockets (2.1.1)
79
+ hike (~> 1.2)
80
+ rack (~> 1.0)
81
+ tilt (~> 1.1, != 1.3.0)
82
+ thor (0.14.6)
83
+ tilt (1.3.3)
84
+ treetop (1.4.10)
85
+ polyglot
86
+ polyglot (>= 0.3.1)
87
+ tzinfo (0.3.31)
29
88
 
30
89
  PLATFORMS
31
90
  ruby
32
91
 
33
92
  DEPENDENCIES
34
93
  jeweler
35
- rails (~> 2)
94
+ rails
36
95
  rake
37
96
  redgreen
data/Rakefile CHANGED
@@ -1,10 +1,18 @@
1
1
  require 'rake/testtask'
2
- Rake::TestTask.new(:default) do |test|
2
+ Rake::TestTask.new(:test) do |test|
3
3
  test.libs << 'lib'
4
4
  test.pattern = 'test/**/*_test.rb'
5
5
  test.verbose = true
6
6
  end
7
7
 
8
+ task :default do
9
+ sh "RAILS=2.3.12 && (bundle || bundle install) && bundle exec rake test"
10
+ sh "RAILS=3.0.10 && (bundle || bundle install) && exec rake test"
11
+ sh "RAILS=3.1.2 && (bundle || bundle install) && exec rake test"
12
+ sh "git checkout Gemfile.lock"
13
+ end
14
+
15
+
8
16
  begin
9
17
  require 'jeweler'
10
18
  Jeweler::Tasks.new do |gem|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ie_iframe_cookies}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2011-09-08}
12
+ s.date = %q{2011-11-18}
13
13
  s.email = %q{michael@grosser.it}
14
14
  s.files = [
15
15
  "Gemfile",
@@ -2,6 +2,7 @@ class IEIframeCookies
2
2
  VERSION = File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip
3
3
  end
4
4
 
5
+
5
6
  module ActionController
6
7
  class Base
7
8
  before_filter :normal_cookies_for_ie_in_iframes
@@ -17,24 +18,32 @@ module ActionController
17
18
  headers['P3P'] = 'CP="ALL DSP COR CURa ADMa DEVa OUR IND COM NAV"' if request.normal_cookies_for_ie_in_iframes? or options[:force]
18
19
  end
19
20
  end
21
+ end
20
22
 
21
- class Request
22
- def ie_iframe_cookies_browser_is_ie?
23
- (env['HTTP_USER_AGENT'] || "").include?("MSIE")
24
- end
23
+ if ActionPack::VERSION::MAJOR > 2
24
+ request = ActionDispatch::Http::Cache::Request
25
+ method = :module_eval
26
+ else
27
+ request = ActionController::Request
28
+ method = :class_eval
29
+ end
25
30
 
26
- def normal_cookies_for_ie_in_iframes?
27
- ie_iframe_cookies_browser_is_ie? and cookies["using_iframes_in_ie"]
28
- end
31
+ request.send(method) do
32
+ def ie_iframe_cookies_browser_is_ie?
33
+ (env['HTTP_USER_AGENT'] || "").include?("MSIE")
34
+ end
29
35
 
30
- alias_method :etag_matches_without_ie_iframe_cookies?, :etag_matches?
31
- def etag_matches?(*args)
32
- not normal_cookies_for_ie_in_iframes? and etag_matches_without_ie_iframe_cookies?(*args)
33
- end
36
+ def normal_cookies_for_ie_in_iframes?
37
+ ie_iframe_cookies_browser_is_ie? and cookies["using_iframes_in_ie"]
38
+ end
34
39
 
35
- alias_method :not_modified_without_ie_iframe_cookies?, :not_modified?
36
- def not_modified?(*args)
37
- not normal_cookies_for_ie_in_iframes? and not_modified_without_ie_iframe_cookies?(*args)
38
- end
40
+ alias_method :etag_matches_without_ie_iframe_cookies?, :etag_matches?
41
+ def etag_matches?(*args)
42
+ not normal_cookies_for_ie_in_iframes? and etag_matches_without_ie_iframe_cookies?(*args)
43
+ end
44
+
45
+ alias_method :not_modified_without_ie_iframe_cookies?, :not_modified?
46
+ def not_modified?(*args)
47
+ not normal_cookies_for_ie_in_iframes? and not_modified_without_ie_iframe_cookies?(*args)
39
48
  end
40
49
  end
@@ -65,7 +65,7 @@ class IEIFrameCookiesTest < ActionController::TestCase
65
65
  set_ie
66
66
  get :activate
67
67
  is_ok!
68
- assert_equal "true", cookies['using_iframes_in_ie']
68
+ assert_equal "true", cookies['using_iframes_in_ie'].to_s
69
69
  end
70
70
 
71
71
  test "does not set tracking cookie for nice users" do
data/test/test_helper.rb CHANGED
@@ -1,9 +1,43 @@
1
- require 'rubygems'
2
1
  require 'action_pack'
3
2
  require 'action_controller'
4
- require 'action_controller/test_process'
3
+
4
+ if ActionPack::VERSION::MAJOR > 2
5
+ require 'action_dispatch/testing/test_process'
6
+
7
+ ROUTES = ActionDispatch::Routing::RouteSet.new
8
+ ROUTES.draw do
9
+ match ':controller(/:action(/:id(.:format)))'
10
+ end
11
+ ROUTES.finalize!
12
+
13
+ # funky patch to get @routes working, in 'setup' did not work
14
+ module ActionController::TestCase::Behavior
15
+ def process_with_routes(*args)
16
+ @routes = ROUTES
17
+ process_without_routes(*args)
18
+ end
19
+ alias_method_chain :process, :routes
20
+ end
21
+
22
+ class ActionController::Base
23
+ self.view_paths = 'test/views'
24
+
25
+ def self._routes
26
+ ROUTES
27
+ end
28
+ end
29
+
30
+ class ActionController::TestRequest
31
+ def cookie_jar
32
+ cookies
33
+ end
34
+ end
35
+ else
36
+ require 'action_controller/test_process'
37
+ ActionController::Routing::Routes.reload rescue nil
38
+ end
39
+
5
40
  require 'test/unit'
6
- require 'redgreen' rescue nil
7
41
 
8
42
  $LOAD_PATH << 'lib'
9
43
 
@@ -11,6 +45,4 @@ $LOAD_PATH << 'lib'
11
45
  # when Rails is defined, backtrace_cleaner is used, when assert fails
12
46
  RAILS_ENV='development'
13
47
 
14
- ActionController::Routing::Routes.reload
15
-
16
48
  require "init"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ie_iframe_cookies
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-08 00:00:00 +02:00
18
+ date: 2011-11-18 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21