catalyst 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
data/catalyst.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{catalyst}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ari Lerner"]
12
- s.date = %q{2011-07-26}
12
+ s.date = %q{2011-07-27}
13
13
  s.description = %q{Quickly build a framework for providing a middleware-like structure}
14
14
  s.email = %q{arilerner@mac.com}
15
15
  s.extra_rdoc_files = [
@@ -26,7 +26,7 @@ module Catalyst
26
26
  klass.new(*[self, args].flatten.compact, &block)
27
27
  elsif klass.respond_to?(:call)
28
28
  lambda do |env|
29
- self.call(klass.call(env))
29
+ klass.call(*[env, self].flatten.compact)
30
30
  end
31
31
  else
32
32
  raise
@@ -28,11 +28,24 @@ class TestCatalyst < Test::Unit::TestCase
28
28
  end
29
29
  end
30
30
 
31
+ should "not call the next app if @app.call is not invoked" do
32
+ @@count = 0
33
+ rs = Catalyst::RunStack.new do
34
+ use lambda {|env, app| @@count += 1; app.call(env) }
35
+ use lambda {|env, app| @@count += 1 }
36
+ use lambda {|env, app| @@count += 1 }
37
+ use lambda {|env, app| @@count += 1 }
38
+ end
39
+
40
+ rs.call({'i' => 0})
41
+ assert_equal 2, @@count
42
+ end
43
+
31
44
  should "be able to call a stack" do
32
45
  @@filtered_through_stack = false
33
46
  @rs = Catalyst::RunStack.new do
34
47
  use TestCatalystMiddleware
35
- use lambda {|env| @@filtered_through_stack = true }
48
+ use lambda {|env, app| @@filtered_through_stack = true }
36
49
  end
37
50
 
38
51
  @rs.call({})
@@ -42,9 +55,9 @@ class TestCatalyst < Test::Unit::TestCase
42
55
  should "be able to define a Catalyst run_Stack from the module" do
43
56
  @@count = 0
44
57
  rs = Catalyst.run_stack do
45
- use lambda {|env| @@count += 1}
46
- use lambda {|env| @@count += 1}
47
- use lambda {|env| @@count += 1}
58
+ use lambda {|env, app| @@count += 1; app.call}
59
+ use lambda {|env, app| @@count += 1; app.call}
60
+ use lambda {|env, app| @@count += 1; app.call}
48
61
  end
49
62
  rs.call()
50
63
  assert_equal @@count, 3
@@ -54,8 +67,9 @@ class TestCatalyst < Test::Unit::TestCase
54
67
  should "be able to call run in place of use" do
55
68
  @@count = 0
56
69
  rs = Catalyst.run_stack do
57
- use lambda {|env| @@count += 1}
58
- run lambda {|env| @@count += 1}
70
+
71
+ use lambda {|env, app| @@count += 1; app.call()}
72
+ run lambda {|env, app| @@count += 1; app.call()}
59
73
  end
60
74
 
61
75
  rs.call
data/test/test_runner.rb CHANGED
@@ -26,7 +26,7 @@ class TestRunner < Test::Unit::TestCase
26
26
  env = new_environment
27
27
  env.expects(:foo).once
28
28
 
29
- func = lambda { |x| x.foo }
29
+ func = lambda { |x, app| x.foo }
30
30
  @instance.setup_action(func).call(env)
31
31
  end
32
32
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: catalyst
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ari Lerner
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-26 00:00:00 -07:00
13
+ date: 2011-07-27 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
- hash: 2270288001949601855
130
+ hash: 1632582077347683059
131
131
  segments:
132
132
  - 0
133
133
  version: "0"