lou 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dea25041b0ad0a9ec2e1bf43bcceff1c300d9b6
4
- data.tar.gz: 92d368f757c66030610c3b6492d3773456dc384f
3
+ metadata.gz: 28c63ebde579744fcaee08a01ce150a25dae1327
4
+ data.tar.gz: 9bfc1ce762996482145ee8e5c7ba443a780e46a9
5
5
  SHA512:
6
- metadata.gz: 3456df775aada99d3f62fe854e65f92a230c67a6ca0d3af2c526da35244b7892722018118f51ac0319505a5db4fa802e6cdcad0d2fa701af6ce4881d41bd80c4
7
- data.tar.gz: 53cfccb9aa2ef91cd5b1f64a56ad7cb5cd19888d40d0190d61418db1207dd993e28e17250cea5fb9625b67d00fbb0f3490b871affa89eaccfa62b03d46230f73
6
+ metadata.gz: 0e4caa193f4612fa1ad5720b77cfb81e220e825a1b664f97851433220a06db1a1a32210d0e92a9791b52a2376e6062756b53a1c295aa762aceb10485621812c7
7
+ data.tar.gz: 146ad87b42954dabd6066cb7955316ae0ca041a708f18660a9d4b245ddf919caad9d4d8dfbb936eb5c1a7192847a6a75d7b660f9dd439c82fa8326c0e804c728
@@ -8,9 +8,9 @@ module Lou
8
8
 
9
9
  def self.extended(base)
10
10
  base.class_eval do
11
- class_attribute(:steps)
11
+ class_attribute :steps
12
12
  self.steps = []
13
- class_attribute(:error_class)
13
+ class_attribute :error_class
14
14
  self.error_class = Lou::Transformer::NeverError
15
15
  end
16
16
  end
@@ -21,7 +21,7 @@ module Lou
21
21
 
22
22
  def step
23
23
  Step.new.tap do |t|
24
- steps << t
24
+ self.steps += [t]
25
25
  end
26
26
  end
27
27
 
data/lib/lou/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lou
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
  module Lou
5
5
  describe Transformer do
6
6
  context 'with no steps defined' do
7
- let(:klass) do
7
+ let!(:klass) do
8
8
  Class.new do
9
9
  extend Lou::Transformer
10
10
  end
@@ -24,7 +24,7 @@ module Lou
24
24
  end
25
25
 
26
26
  context 'with one step' do
27
- let(:klass) do
27
+ let!(:klass) do
28
28
  Class.new do
29
29
  extend Lou::Transformer
30
30
  step.up { |x| x.push 'world' }.down { |x| x.delete_if { |y| y == 'world' } }
@@ -45,7 +45,7 @@ module Lou
45
45
  end
46
46
 
47
47
  context 'with two steps' do
48
- let(:klass) do
48
+ let!(:klass) do
49
49
  Class.new do
50
50
  extend Lou::Transformer
51
51
  step.up { |x| x + ', or not to be' }.down { |x| x.gsub(/, or not to be$/, '') }
@@ -67,18 +67,18 @@ module Lou
67
67
  end
68
68
 
69
69
  context 'when extended from another transformer' do
70
- let(:parent) do
70
+ let!(:parent) do
71
71
  Class.new do
72
72
  extend Lou::Transformer
73
73
  step.up { |x| x.create; x }.down { |x| x.destroy; x }
74
74
  end
75
75
  end
76
- let(:child) do
76
+ let!(:child) do
77
77
  Class.new(parent) do
78
78
  step.up { |x| x.create; x }.down { |x| x.destroy; x }
79
79
  end
80
80
  end
81
- let(:grandchild) do
81
+ let!(:grandchild) do
82
82
  Class.new(child) do
83
83
  step.up { |x| x.create; x }.down { |x| x.destroy; x }
84
84
  end
@@ -112,7 +112,7 @@ module Lou
112
112
  end
113
113
 
114
114
  context 'when an error is raised' do
115
- let(:klass) do
115
+ let!(:klass) do
116
116
  Class.new do
117
117
  extend Lou::Transformer
118
118
  step.up { |_| fail 'error on up' }.down { |_| fail 'error on down' }
@@ -137,7 +137,7 @@ module Lou
137
137
  class SpecialError < StandardError; end
138
138
  end
139
139
 
140
- let(:parent) do
140
+ let!(:parent) do
141
141
  Class.new do
142
142
  extend Lou::Transformer
143
143
 
@@ -148,7 +148,7 @@ module Lou
148
148
  let(:target) { instance_double('Target') }
149
149
 
150
150
  context 'and an error is raised on the first step' do
151
- let(:klass) do
151
+ let!(:klass) do
152
152
  Class.new(parent) do
153
153
  step.up { |_| fail SpecialError }.down { |x| x.destroy(1); x }
154
154
  step.up { |x| x.create(2); x }.down { |_| fail SpecialError }
@@ -173,7 +173,7 @@ module Lou
173
173
  end
174
174
 
175
175
  context 'and an error is raised part-way through the transform' do
176
- let(:klass) do
176
+ let!(:klass) do
177
177
  Class.new(parent) do
178
178
  step.up { |x| x.create(1); x }.down { |x| x.destroy(1); x }
179
179
  step.up { |_| fail SpecialError }.down { |_| fail SpecialError }
@@ -201,7 +201,7 @@ module Lou
201
201
  end
202
202
 
203
203
  context 'and the up and down steps should lead to an infinite loop' do
204
- let(:klass) do
204
+ let!(:klass) do
205
205
  Class.new(parent) do
206
206
  step.up { |x| x.create(1); x }.down { |_| fail SpecialError, 'fail on down' }
207
207
  step.up { |_| fail SpecialError, 'fail on up' }.down { |x| x.destroy(2); x }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lou
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iain Beeston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-11 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler