Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

small refactoring of handling before/after blocks and also add missin…

…g docstrings
  • Loading branch information...
commit ffdc62b5ec94bdd00365532d64e198f0527341e7 1 parent 601dc44
@bakkdoor authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/fancy_spec.fy
View
14 lib/fancy_spec.fy
@@ -13,6 +13,8 @@ class FancySpec {
@spec_tests = []
@before_blocks = []
@after_blocks = []
+ @before_all_block = {}
+ @after_all_block = {}
}
def FancySpec describe: test_obj with: block {
@@ -95,10 +97,18 @@ class FancySpec {
alias_method: 'it:for:when: for: 'it:with:when:
def before: block {
+ """
+ @block @Block@ to be run before all test cases.
+ """
+
@before_all_block = block
}
def after: block {
+ """
+ @block @Block@ to be run after all test cases.
+ """
+
@after_all_block = block
}
@@ -125,7 +135,7 @@ class FancySpec {
# " " ++ @description ++ ": " print
- { @before_all_block call } if: @before_all_block
+ @before_all_block call
@spec_tests each: |test| {
@before_blocks each: |b| {
@@ -137,7 +147,7 @@ class FancySpec {
}
}
- { @after_all_block call } if: @after_all_block
+ @after_all_block call
# untested_methods = @test_obj methods select: |m| {
# m tests size == 0
Please sign in to comment.
Something went wrong with that request. Please try again.