filtration 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/spec/filtration_spec.rb +52 -12
  2. metadata +1 -1
@@ -33,6 +33,16 @@ describe Filtration do
33
33
  end
34
34
  end
35
35
 
36
+ context 'and both a filter method and a block' do
37
+ it 'raises an error' do
38
+ test = Class.new(Good) do
39
+ extend RSpec::Matchers
40
+ expect { prefilter(:foo,:double) {|x| x * 2} }.to raise_error
41
+ def double(x) x * 2; end
42
+ end
43
+ end
44
+ end
45
+
36
46
  end
37
47
 
38
48
  context 'given an invalid target method' do
@@ -48,21 +58,31 @@ describe Filtration do
48
58
 
49
59
  context 'and a valid filter method' do
50
60
  it 'raises an error' do
51
- test = Class.new(Good) do
52
- prefilter :foo, :double
61
+ test = Class.new(Bad) do
62
+ extend RSpec::Matchers
63
+ expect { prefilter :foo, :double }.to raise_error
53
64
  def double(x) x * 2; end
54
65
  end
55
- expect { test.new.foo }.to raise_error
56
66
  end
57
67
  end
58
68
 
59
69
  context 'and an invalid filter method' do
60
70
  it 'raises an error' do
61
- test = Class.new(Good) do
62
- prefilter :foo, :double
71
+ test = Class.new(Bad) do
72
+ extend RSpec::Matchers
73
+ expect { prefilter :foo, :double }.to raise_error
63
74
  def double() 2; end
64
75
  end
65
- expect { test.new.foo }.to raise_error
76
+ end
77
+ end
78
+
79
+ context 'and both a filter method and a block' do
80
+ it 'raises an error' do
81
+ test = Class.new(Bad) do
82
+ extend RSpec::Matchers
83
+ expect { prefilter(:foo,:double) {|x| x * 2} }.to raise_error
84
+ def double(x) x * 2; end
85
+ end
66
86
  end
67
87
  end
68
88
 
@@ -101,6 +121,16 @@ describe Filtration do
101
121
  end
102
122
  end
103
123
 
124
+ context 'and both a filter method and a block' do
125
+ it 'raises an error' do
126
+ test = Class.new(Bad) do
127
+ extend RSpec::Matchers
128
+ expect { postfilter(:foo,:double) {|x| x * 2} }.to raise_error
129
+ def double(x) x * 2; end
130
+ end
131
+ end
132
+ end
133
+
104
134
  end
105
135
 
106
136
  context 'given an invalid target method' do
@@ -116,21 +146,31 @@ describe Filtration do
116
146
 
117
147
  context 'and a valid filter method' do
118
148
  it 'raises an error' do
119
- test = Class.new(Good) do
120
- postfilter :foo, :double
149
+ test = Class.new(Bad) do
150
+ extend RSpec::Matchers
151
+ expect { postfilter :foo, :double }.to raise_error
121
152
  def double(x) x * 2; end
122
153
  end
123
- expect { test.new.foo }.to raise_error
124
154
  end
125
155
  end
126
156
 
127
157
  context 'and an invalid filter method' do
128
158
  it 'raises an error' do
129
- test = Class.new(Good) do
130
- postfilter :foo, :double
159
+ test = Class.new(Bad) do
160
+ extend RSpec::Matchers
161
+ expect { postfilter :foo, :double }.to raise_error
131
162
  def double() 2; end
132
163
  end
133
- expect { test.new.foo }.to raise_error
164
+ end
165
+ end
166
+
167
+ context 'and both a filter method and a block' do
168
+ it 'raises an error' do
169
+ test = Class.new(Bad) do
170
+ extend RSpec::Matchers
171
+ expect { postfilter(:foo,:double) {|x| x * 2} }.to raise_error
172
+ def double(x) x * 2; end
173
+ end
134
174
  end
135
175
  end
136
176
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: filtration
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - R. Scott Reis