specdown 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
data/bin/specdown CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'specdown'
3
3
  STDOUT.sync = true
4
- Specdown::Command.new.execute
4
+ Specdown::Command.new.execute_with_hooks
@@ -65,9 +65,9 @@ Given /^If your test throws an exception, you can access it via the `exception`
65
65
  @test.exception.should_not be(nil)
66
66
  end
67
67
 
68
- Given /^The `Specdown::Test\.before_execute` method allows you to add code that runs before every test:$/ do |string|
68
+ Given /^The `Specdown::Test\.hook_before\(:execute\)` method allows you to add code that runs before every test:$/ do |string|
69
69
  before = false
70
- Specdown::Test.before_execute do
70
+ Specdown::Test.hook_before(:execute) do
71
71
  before = true
72
72
  end
73
73
 
@@ -75,9 +75,9 @@ Given /^The `Specdown::Test\.before_execute` method allows you to add code that
75
75
  before.should be(true)
76
76
  end
77
77
 
78
- Given /^The `Specdown::Test\.after_execute` method allows you to add code that runs after every test:$/ do |string|
78
+ Given /^The `Specdown::Test\.hook_after\(:execute\)` method allows you to add code that runs after every test:$/ do |string|
79
79
  after = false
80
- Specdown::Test.after_execute do
80
+ Specdown::Test.hook_after(:execute) do
81
81
  after = true
82
82
  end
83
83
 
@@ -85,9 +85,9 @@ Given /^The `Specdown::Test\.after_execute` method allows you to add code that r
85
85
  after.should be(true)
86
86
  end
87
87
 
88
- Given /^The `Specdown::Test\.around_execute` method allows you to add code that runs around every test:$/ do |string|
88
+ Given /^The `Specdown::Test\.hook_around\(:execute\)` method allows you to add code that runs around every test:$/ do |string|
89
89
  around = nil
90
- Specdown::Test.around_execute do
90
+ Specdown::Test.hook_around(:execute) do
91
91
  if around
92
92
  around = false
93
93
  else
@@ -100,13 +100,13 @@ Given /^The `Specdown::Test\.around_execute` method allows you to add code that
100
100
  end
101
101
 
102
102
  Given /^You can remove all `Specdown::Test` callbacks by calling `Specdown::Test\.remove_callbacks!`$/ do
103
- Specdown::Test.before_execute do |test|
103
+ Specdown::Test.hook_before(:execute) do |test|
104
104
  puts "I'm a callback!"
105
105
  end
106
106
 
107
107
  Specdown::Test.before_hooks["execute"].should_not be_empty
108
108
 
109
- Specdown::Test.remove_callbacks!
109
+ Specdown::Test.remove_all_callbacks!
110
110
 
111
111
  Specdown::Test.before_hooks["execute"].should be_empty
112
112
  end
@@ -61,9 +61,9 @@ Feature: Specdown::Test
61
61
 
62
62
  If a test throws an exception, that exception will be captured and made accessible via the `exception` method.
63
63
 
64
- You can add callbacks to tests via the "before_execute", "after_execute", and "around_execute" methods:
64
+ You can add callbacks to tests via the "hook_before(:execute)", "hook_after(:execute)", and "hook_around(:execute)" methods:
65
65
 
66
- Specdown::Test.after_execute do |test|
66
+ Specdown::Test.hook_after(:execute) do |test|
67
67
  case test.status
68
68
  when :passing then Specdown.reporter.print_success(test)
69
69
  when :failing then Specdown.reporter.print_failure(test)
@@ -109,21 +109,21 @@ Feature: Specdown::Test
109
109
  * If your test throws an exception, you can access it via the `exception` method
110
110
 
111
111
  Scenario: Hooks
112
- * The `Specdown::Test.before_execute` method allows you to add code that runs before every test:
112
+ * The `Specdown::Test.hook_before(:execute)` method allows you to add code that runs before every test:
113
113
  """
114
114
  Specdown::Test.before do |test|
115
115
  puts "I run before every test!"
116
116
  end
117
117
  """
118
118
 
119
- * The `Specdown::Test.after_execute` method allows you to add code that runs after every test:
119
+ * The `Specdown::Test.hook_after(:execute)` method allows you to add code that runs after every test:
120
120
  """
121
121
  Specdown::Test.after do |test|
122
122
  puts "I run after every test!"
123
123
  end
124
124
  """
125
125
 
126
- * The `Specdown::Test.around_execute` method allows you to add code that runs around every test:
126
+ * The `Specdown::Test.hook_around(:execute)` method allows you to add code that runs around every test:
127
127
  """
128
128
  Specdown::Test.around do |test|
129
129
  puts "I run around every test!"
@@ -1,7 +1,6 @@
1
1
  module Specdown
2
2
  class Command
3
3
  include ::Hook
4
- hook :execute
5
4
 
6
5
  attr_reader :readmes
7
6
 
@@ -9,15 +8,18 @@ module Specdown
9
8
  @readmes = []
10
9
  end
11
10
 
12
- def execute
13
- with_hooks :execute do
14
- load_test_environment
15
- parse_options
16
- run
17
- end
11
+ def execute_with_hooks
12
+ execute
18
13
 
19
14
  exit exit_status
20
15
  end
16
+
17
+ +hook
18
+ def execute
19
+ load_test_environment
20
+ parse_options
21
+ run
22
+ end
21
23
 
22
24
  private
23
25
  def parse_options
@@ -1,4 +1,4 @@
1
- Specdown::Command.after_execute do |command|
1
+ Specdown::Command.hook_after(:execute) do |command|
2
2
  Specdown.reporter.print_summary command.readmes
3
3
  Specdown.reporter.print_end
4
4
  end
@@ -1,7 +1,7 @@
1
- Specdown::Readme.before_execute do |readme|
1
+ Specdown::Readme.hook_before(:execute) do |readme|
2
2
  Specdown.reporter.print_readme_start readme if Specdown::Config.format == :condensed
3
3
  end
4
4
 
5
- Specdown::Readme.after_execute do |readme|
5
+ Specdown::Readme.hook_after(:execute) do |readme|
6
6
  Specdown.reporter.print_readme_end readme if Specdown::Config.format == :condensed
7
7
  end
@@ -1,4 +1,4 @@
1
- Specdown::Test.after_execute do |test|
1
+ Specdown::Test.hook_after(:execute) do |test|
2
2
  case test.status
3
3
  when :passing then Specdown.reporter.print_success test
4
4
  when :failing then Specdown.reporter.print_failure test
@@ -1,7 +1,6 @@
1
1
  module Specdown
2
2
  class Readme
3
3
  include ::Hook
4
- hook :execute
5
4
 
6
5
  attr_reader :tests, :stats, :file_path
7
6
 
@@ -32,10 +31,9 @@ module Specdown
32
31
  File.basename @file_path
33
32
  end
34
33
 
34
+ +hook
35
35
  def execute
36
- with_hooks :execute do
37
- @tests.map &:execute
38
- end
36
+ @tests.map &:execute
39
37
 
40
38
  self
41
39
  end
@@ -14,7 +14,7 @@ module Specdown
14
14
  end
15
15
 
16
16
  def before(*filters, &callback)
17
- Specdown::Test.before_execute do |test|
17
+ Specdown::Test.hook_before(:execute) do |test|
18
18
  if filters.empty? || filters.any? {|filter| filter.match test.readme.file_name}
19
19
  callback.call
20
20
  end
@@ -22,7 +22,7 @@ module Specdown
22
22
  end
23
23
 
24
24
  def after(*filters, &callback)
25
- Specdown::Test.after_execute do |test|
25
+ Specdown::Test.hook_after(:execute) do |test|
26
26
  if filters.empty? || filters.any? {|filter| filter.match test.readme.file_name}
27
27
  callback.call
28
28
  end
@@ -30,7 +30,7 @@ module Specdown
30
30
  end
31
31
 
32
32
  def around(*filters, &callback)
33
- Specdown::Test.around_execute do |test|
33
+ Specdown::Test.hook_around(:execute) do |test|
34
34
  if filters.empty? || filters.any? {|filter| filter.match test.readme.file_name}
35
35
  callback.call
36
36
  end
data/lib/specdown/test.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  module Specdown
2
2
  class Test
3
3
  include ::Hook
4
- hook :execute
5
4
 
6
5
  attr_accessor :code, :undefined_implicits
7
6
  attr_reader :status, :exception, :readme
@@ -12,10 +11,9 @@ module Specdown
12
11
  @undefined_implicits = []
13
12
  end
14
13
 
14
+ +hook
15
15
  def execute
16
- with_hooks(:execute) do
17
- execute_code
18
- end
16
+ execute_code
19
17
  end
20
18
 
21
19
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
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-05-25 00:00:00.000000000 Z
12
+ date: 2012-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gitdown
16
- requirement: &70337292991060 !ruby/object:Gem::Requirement
16
+ requirement: &70124707628300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.0.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70337292991060
24
+ version_requirements: *70124707628300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: term-ansicolor
27
- requirement: &70337292990580 !ruby/object:Gem::Requirement
27
+ requirement: &70124707627560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: 1.0.7
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70337292990580
35
+ version_requirements: *70124707627560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hook
38
- requirement: &70337292990120 !ruby/object:Gem::Requirement
38
+ requirement: &70124707626640 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.0.2
43
+ version: 0.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70337292990120
46
+ version_requirements: *70124707626640
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cucumber
49
- requirement: &70337292989740 !ruby/object:Gem::Requirement
49
+ requirement: &70124707619780 !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: *70337292989740
57
+ version_requirements: *70124707619780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70337287099060 !ruby/object:Gem::Requirement
60
+ requirement: &70124707619300 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70337287099060
68
+ version_requirements: *70124707619300
69
69
  description:
70
70
  email: moonmaster9000@gmail.com
71
71
  executables: