tengu 0.0.1 → 0.0.2

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: 12e7d2f0783ace8519c31deb1b36a70057c2ddb2
4
- data.tar.gz: 22900571d9768970c13b1fe6bb42cdfa220e45b4
3
+ metadata.gz: 5af8bd49ab18c5df87f95597d85710931e43b70c
4
+ data.tar.gz: f10cda26754deeb775e208ac09c9af549d33437c
5
5
  SHA512:
6
- metadata.gz: 575f49bd06887612dfa45a755047358e2f8ec8b9ad6ad7745cb9c1b7d9b0eabd3356ef7858d8642e9f3f8556d103d4f21ea31b24541919ca481e2884736e2180
7
- data.tar.gz: a20dc50058a5bc07118fa8cf12d0d5172e1b3f7f9bd05eecc1a25d3be98cc0e9657396960a4e76d400008c7b56f69c5c15f76af5614fe712a1e5afed3ee43533
6
+ metadata.gz: 45e37d875c7a30f6cd2aff30b316f7c1cb5a72ec0283339fe23e0c81415ac9b6d8515d825ea9cbbfa5d9d095809088b4ca0e063e2f8178b7a2787a14df9b2db7
7
+ data.tar.gz: dfd14c8623329403908f6ae11add774b1256a517c135b06a8876007e34d9bac0edc694cb618ea584cece2e591647baef701795b6fde18dfa3a57aa12864ddec4
@@ -4,8 +4,8 @@ module Tengu
4
4
  @description = description
5
5
  @block = block
6
6
  @test_cases = []
7
- @before_hooks = []
8
- @after_hooks = []
7
+ @before_each_hooks = []
8
+ @after_each_hooks = []
9
9
  load_test_cases
10
10
  end
11
11
 
@@ -31,12 +31,16 @@ module Tengu
31
31
  singleton_class.send(:include, included_module)
32
32
  end
33
33
 
34
- def before(&block)
35
- @before_hooks << block
34
+ def before(type, &block)
35
+ if type == :each
36
+ @before_each_hooks << block
37
+ end
36
38
  end
37
39
 
38
- def after(&block)
39
- @after_hooks << block
40
+ def after(type, &block)
41
+ if type == :each
42
+ @after_each_hooks << block
43
+ end
40
44
  end
41
45
 
42
46
 
@@ -46,9 +50,9 @@ module Tengu
46
50
 
47
51
  def run_test_cases(runner, listeners = [])
48
52
  @test_cases.each do |test_case|
49
- @before_hooks.each { |hook| hook.call }
53
+ @before_each_hooks.each { |hook| hook.call }
50
54
  test_case.run(runner, listeners)
51
- @after_hooks.each { |hook| hook.call }
55
+ @after_each_hooks.each { |hook| hook.call }
52
56
  end
53
57
  end
54
58
 
data/lib/tengu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tengu
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -21,7 +21,7 @@ describe Tengu::DescribeBlock do
21
21
  expected = -> {}
22
22
  allow(expected).to receive(:call)
23
23
  allow(ItBlock).to receive(:new).and_return(double(ItBlock, run: true))
24
- code = -> (wombat) { before &expected; it {} }
24
+ code = -> (wombat) { before :each, &expected; it {} }
25
25
  DescribeBlock.new("test", code).run(nil, [])
26
26
  expect(expected).to have_received(:call)
27
27
  end
@@ -30,7 +30,7 @@ describe Tengu::DescribeBlock do
30
30
  expected = -> {}
31
31
  allow(expected).to receive(:call)
32
32
  allow(ItBlock).to receive(:new).and_return(double(ItBlock, run: true))
33
- code = -> (wombat) { after &expected; it {} }
33
+ code = -> (wombat) { after :each, &expected; it {} }
34
34
  DescribeBlock.new("test", code).run(nil, [])
35
35
  expect(expected).to have_received(:call)
36
36
  end
@@ -1,7 +1,7 @@
1
1
  $foo = "bar"
2
2
 
3
3
  describe "True" do
4
- before do
4
+ before(:each) do
5
5
  $foo = "baz"
6
6
  end
7
7
 
@@ -17,7 +17,7 @@ describe "True" do
17
17
  expect($foo).to eq("bar")
18
18
  end
19
19
 
20
- after do
20
+ after(:each) do
21
21
  $foo = "bar"
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tengu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - halogenandtoast