restpack-web 0.0.2 → 0.0.3
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/lib/restpack-web/app.rb +18 -0
- data/lib/restpack-web/version.rb +1 -1
- data/lib/restpack-web.rb +1 -17
- data/spec/restpack_web_spec.rb +25 -0
- metadata +5 -2
@@ -0,0 +1,18 @@
|
|
1
|
+
module RestPack
|
2
|
+
module Web
|
3
|
+
class App
|
4
|
+
def initialize(app)
|
5
|
+
@app = app
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(env)
|
9
|
+
env["restpack"] ||= {}
|
10
|
+
host = env["SERVER_NAME"]
|
11
|
+
|
12
|
+
env["restpack"][:host] = host #TODO: GJ: add some magic
|
13
|
+
|
14
|
+
@app.call(env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/restpack-web/version.rb
CHANGED
data/lib/restpack-web.rb
CHANGED
@@ -1,18 +1,2 @@
|
|
1
1
|
require 'restpack-web/version'
|
2
|
-
|
3
|
-
module RestPack
|
4
|
-
class Web
|
5
|
-
def initialize(app)
|
6
|
-
@app = app
|
7
|
-
end
|
8
|
-
|
9
|
-
def call(env)
|
10
|
-
env["restpack"] ||= {}
|
11
|
-
host = env["SERVER_NAME"]
|
12
|
-
|
13
|
-
env["restpack"][:host] = host #TODO: GJ: add some magic
|
14
|
-
|
15
|
-
@app.call(env)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
2
|
+
require 'restpack-web/app'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rack/test'
|
3
|
+
require 'restpack-web'
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.color_enabled = true
|
7
|
+
config.formatter = 'documentation'
|
8
|
+
end
|
9
|
+
|
10
|
+
describe RestPack::Web do
|
11
|
+
include Rack::Test::Methods
|
12
|
+
|
13
|
+
let(:app) {
|
14
|
+
RestPack::Web::App.new(
|
15
|
+
lambda { |env| [200, {'Content-Type' => 'text/plain'}, 'hello there'] }
|
16
|
+
)
|
17
|
+
}
|
18
|
+
|
19
|
+
it "returns a valid response" do
|
20
|
+
get '/'
|
21
|
+
last_response.should be_ok
|
22
|
+
last_response.body.should == 'hello there'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restpack-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -71,8 +71,10 @@ files:
|
|
71
71
|
- LICENSE
|
72
72
|
- Rakefile
|
73
73
|
- lib/restpack-web.rb
|
74
|
+
- lib/restpack-web/app.rb
|
74
75
|
- lib/restpack-web/version.rb
|
75
76
|
- restpack-web.gemspec
|
77
|
+
- spec/restpack_web_spec.rb
|
76
78
|
homepage: ''
|
77
79
|
licenses: []
|
78
80
|
post_install_message:
|
@@ -97,4 +99,5 @@ rubygems_version: 1.8.24
|
|
97
99
|
signing_key:
|
98
100
|
specification_version: 3
|
99
101
|
summary: ! '...'
|
100
|
-
test_files:
|
102
|
+
test_files:
|
103
|
+
- spec/restpack_web_spec.rb
|