newman 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,13 @@
1
+ ### 0.2.1 (2012-02-11)
2
+
3
+ - Fixed a bug with `Newman::Application#match`. It now normalizes keys to
4
+ strings for easy use with `Newman::Application#compile_regex`, which
5
+ fixes our substitution logic in patterns.
6
+
1
7
  ### 0.2.0 (2012-02-08)
2
8
 
3
- - Internals mostly rewritten, changes too numerous to outline meaningfully. We'll keep better track of these changes in the future.
9
+ - Internals mostly rewritten, changes too numerous to outline meaningfully.
10
+ We'll keep better track of these changes in the future.
4
11
 
5
12
  - Basic logging support added.
6
13
 
@@ -175,9 +175,13 @@ module Newman
175
175
  # only high-level mechanism for dynamic filter matches. Low level matching
176
176
  # is possible via `Newman::Application#callback`, but would
177
177
  # be an exercise in tedium for most application developers.
178
-
178
+ #
179
+ # NOTE: `Newman::Application#match` converts the provided `name` to a
180
+ # string using `to_s` to make life easier for the internals. Because
181
+ # `Newman::Application#matchers` is an implementation detail, you probably
182
+ # don't need to worry about this unless you're hacking on Newman itself.
179
183
  def match(name, pattern)
180
- matchers[name] = pattern
184
+ matchers[name.to_s] = pattern
181
185
  end
182
186
 
183
187
  # ---
@@ -5,7 +5,7 @@ module Newman
5
5
  module Version
6
6
  MAJOR = 0
7
7
  MINOR = 2
8
- TINY = 0
8
+ TINY = 1
9
9
  STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
10
10
  end
11
11
  end
@@ -0,0 +1,28 @@
1
+ require_relative "../helper"
2
+
3
+ describe "subject filter" do
4
+ let(:app) do
5
+ Newman::Application.new do
6
+ match :list_id, /[^.]+/
7
+
8
+ to :tag, "{list_id}.subscribe" do
9
+ respond(:subject => "Subscribing you to [#{params[:list_id]}]")
10
+ end
11
+
12
+ default do
13
+ respond(:subject => "Didn't understand you!")
14
+ end
15
+ end
16
+ end
17
+
18
+ let(:server) { Newman.new_test_server(app) }
19
+ let(:mailer) { server.mailer }
20
+
21
+ it "should automatically not match emails without subjects" do
22
+ mailer.deliver_message(:to => "test+foo.subscribe@test.com")
23
+ server.tick
24
+
25
+ mailer.messages.first.subject.must_equal("Subscribing you to [foo]")
26
+ end
27
+ end
28
+
@@ -4,3 +4,4 @@ SimpleCov.start
4
4
  require_relative "integration/acid_tests"
5
5
  require_relative "integration/skip_response_test"
6
6
  require_relative "integration/subject_filter_test"
7
+ require_relative "integration/to_filter_test"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-08 00:00:00.000000000 Z
12
+ date: 2012-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail
16
- requirement: &2154675600 !ruby/object:Gem::Requirement
16
+ requirement: &2153405740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154675600
24
+ version_requirements: *2153405740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tilt
27
- requirement: &2154675020 !ruby/object:Gem::Requirement
27
+ requirement: &2153405240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.3.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2154675020
35
+ version_requirements: *2153405240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitest
38
- requirement: &2154674500 !ruby/object:Gem::Requirement
38
+ requirement: &2153404780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.11.1
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2154674500
46
+ version_requirements: *2153404780
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: simplecov
49
- requirement: &2154674080 !ruby/object:Gem::Requirement
49
+ requirement: &2153404380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2154674080
57
+ version_requirements: *2153404380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: purdytest
60
- requirement: &2154673560 !ruby/object:Gem::Requirement
60
+ requirement: &2153403880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2154673560
68
+ version_requirements: *2153403880
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rocco
71
- requirement: &2154673120 !ruby/object:Gem::Requirement
71
+ requirement: &2153403360 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2154673120
79
+ version_requirements: *2153403360
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rake
82
- requirement: &2154672680 !ruby/object:Gem::Requirement
82
+ requirement: &2153402880 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2154672680
90
+ version_requirements: *2153402880
91
91
  description: A microframework for mail-centric applications
92
92
  email:
93
93
  - gregory.t.brown@gmail.com
@@ -127,6 +127,7 @@ files:
127
127
  - test/integration/acid_tests.rb
128
128
  - test/integration/skip_response_test.rb
129
129
  - test/integration/subject_filter_test.rb
130
+ - test/integration/to_filter_test.rb
130
131
  - test/settings.rb
131
132
  - test/suite.rb
132
133
  - README.md