Skip to content
Browse files

nicked wjessop's gemspec, renamed back to NoIE

  • Loading branch information...
1 parent 9ef9ec7 commit 89c4b2698f58502c10003b680c8ad7e7884f0f57 Julio Cesar Ody committed
Showing with 26 additions and 26 deletions.
  1. +7 −7 Rakefile
  2. +3 −3 lib/{noie6.rb → noie.rb}
  3. +6 −6 rack-noie6.gemspec → rack-noie.gemspec
  4. +10 −10 test/{noie6_test.rb → noie_test.rb}
View
14 Rakefile
@@ -3,19 +3,19 @@ require 'rake/testtask'
task :default => [:test]
Rake::TestTask.new do |task|
- task.pattern = 'test/noie6_test.rb'
+ task.pattern = 'test/noie_test.rb'
task.warning, task.verbose = true, true
end
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
- gemspec.name = "rack-noie6"
- gemspec.summary = "A Rack middleware to redirect IE6 users out of your website"
- gemspec.email = "jerod.santo@gmail.com"
- gemspec.homepage = "http://github.com/sant0sk1/rack-noie6"
- gemspec.authors = ["Jerod Santo", "Julio Cesar Ody"]
+ gemspec.name = "rack-noie"
+ gemspec.summary = "A Rack middleware to redirect IE users out of your website"
+ gemspec.email = "julioody@gmail.com"
+ gemspec.homepage = "http://github.com/juliocesar/rack-noie"
+ gemspec.authors = ["Julio Cesar Ody"]
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
-end
+end
View
6 lib/noie6.rb → lib/noie.rb
@@ -1,5 +1,5 @@
module Rack
- class NoIE6
+ class NoIE
def initialize(app, options = {})
@app = app
@options = options
@@ -8,11 +8,11 @@ def initialize(app, options = {})
end
def call(env)
- ie6_found_in?(env) ? kick_it : @app.call(env)
+ ie_found_in?(env) ? kick_it : @app.call(env)
end
private
- def ie6_found_in?(env)
+ def ie_found_in?(env)
if env['HTTP_USER_AGENT']
is_ie?(env['HTTP_USER_AGENT']) and ie_version(env['HTTP_USER_AGENT']) < @options[:minimum] and @options[:redirect] != env['PATH_INFO']
end
View
12 rack-noie6.gemspec → rack-noie.gemspec
@@ -1,13 +1,13 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
- s.name = %q{rack-noie6}
- s.version = "1.0.1"
+ s.name = %q{rack-noie}
+ s.version = "1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Jerod Santo", "Julio Cesar Ody"]
+ s.authors = ["Julio Cesar Ody"]
s.date = %q{2009-05-11}
- s.email = %q{jerod.santo@gmail.com}
+ s.email = %q{julioody@gmail.com}
s.extra_rdoc_files = [
"README.markdown"
]
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
"README.markdown",
"Rakefile",
"VERSION.yml",
- "lib/noie6.rb",
- "test/noie6_test.rb"
+ "lib/noie.rb",
+ "test/noie_test.rb"
]
s.has_rdoc = true
s.homepage = %q{http://github.com/sant0sk1/rack-noie6}
View
20 test/noie6_test.rb → test/noie_test.rb
@@ -3,7 +3,7 @@
require 'rubygems'
require 'rack/mock'
-require File.join(File.dirname(__FILE__), '..', 'lib', 'noie6')
+require File.join(File.dirname(__FILE__), '..', 'lib', 'noie')
class TestApp
def call(env)
@@ -13,46 +13,46 @@ def call(env)
class NoieTest < Test::Unit::TestCase
- def test_redirects_to_where_it_should_if_ie6
- request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
+ def test_redirects_to_where_it_should_if_ie
+ request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
response = request.get('/', {'HTTP_USER_AGENT' => 'MSIE 6.0' })
assert_equal 301, response.status
assert_equal response.location, 'http://slashdot.org'
end
def test_redirects_to_where_it_should_if_user_specified_minimum_not_met
- request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org', :minimum => 6.0}))
+ request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => 'http://slashdot.org', :minimum => 6.0}))
response = request.get('/', {'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE 5.5b1; Mac_PowerPC)' })
assert_equal 301, response.status
assert_equal response.location, 'http://slashdot.org'
end
def test_redirects_to_local_urls
- request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => '/foo'}))
+ request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => '/foo'}))
response = request.get('/foo', {'HTTP_USER_AGENT' => 'MSIE 6.0' })
assert_equal "Hi Internets!", response.body
end
- def test_allows_if_not_ie6
- request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
+ def test_allows_if_not_ie
+ request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
response = request.get('/', {'HTTP_USER_AGENT' => 'Mozilla/5.0'})
assert_equal "Hi Internets!", response.body
end
def test_allows_if_UA_version_greater_than_minimum
- request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
+ request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
response = request.get('/', {'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows XP)'})
assert_equal "Hi Internets!", response.body
end
def test_allows_if_no_UA_version_no_available
- request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
+ request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
response = request.get('/', {'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE l4me; Windows XP)'})
assert_equal "Hi Internets!", response.body
end
def test_allows_if_no_user_agent_specified
- request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
+ request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
response = request.get('/')
assert_equal "Hi Internets!", response.body
end

0 comments on commit 89c4b26

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