-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
102 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
--format documentation | ||
--color | ||
--require spec_helper | ||
--warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,6 @@ | |
|
||
module Rack | ||
module Freeze | ||
VERSION = "1.0.0" | ||
VERSION = "1.1.0" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,20 +2,22 @@ | |
require_relative 'lib/rack/freeze/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "rack-freeze" | ||
spec.version = Rack::Freeze::VERSION | ||
spec.authors = ["Samuel Williams"] | ||
spec.email = ["[email protected]"] | ||
spec.name = "rack-freeze" | ||
spec.version = Rack::Freeze::VERSION | ||
spec.authors = ["Samuel Williams"] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = "Provides a policy for frozen rack middleware." | ||
spec.homepage = "https://github.com/ioquatix/rack-freeze" | ||
spec.summary = "Provides a policy for frozen rack middleware." | ||
spec.homepage = "https://github.com/ioquatix/rack-freeze" | ||
|
||
spec.files = `git ls-files -z`.split("\x0").reject do |f| | ||
f.match(%r{^(test|spec|features)/}) | ||
end | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_development_dependency "bundler", "~> 1.14" | ||
spec.add_development_dependency "rake", "~> 10.0" | ||
spec.add_development_dependency "rspec", "~> 3.0" | ||
spec.files = `git ls-files -z`.split("\x0").reject do |f| | ||
f.match(%r{^(test|spec|features)/}) | ||
end | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_dependency "rack", "~> 2.0" | ||
|
||
spec.add_development_dependency "bundler", "~> 1.14" | ||
spec.add_development_dependency "rake", "~> 10.0" | ||
spec.add_development_dependency "rspec", "~> 3.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
RSpec.shared_context "app builder" do | ||
it "should generate frozen app" do | ||
# We need to give lexical scope for ruby to find it :) | ||
middleware = described_class | ||
|
||
app = Rack::Builder.new do | ||
use middleware | ||
|
||
run lambda { |env| [404, {}, []] } | ||
end.to_app | ||
|
||
expect(app.frozen?).to be_truthy | ||
end | ||
end | ||
|
||
class NonConformingMiddleware | ||
def initialize(app) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
return @app.call(env) | ||
end | ||
end | ||
|
||
RSpec.describe NonConformingMiddleware do | ||
include_context "app builder" | ||
end | ||
|
||
class ConformingMiddleware < NonConformingMiddleware | ||
def freeze | ||
@app.freeze | ||
|
||
super | ||
end | ||
end | ||
|
||
RSpec.describe ConformingMiddleware do | ||
include_context "app builder" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe Rack::Freeze do | ||
it "should detect class has \#freeze" do | ||
|