Skip to content

Commit

Permalink
small refactoring of handling before/after blocks and also add missin…
Browse files Browse the repository at this point in the history
…g docstrings
  • Loading branch information
bakkdoor committed Mar 5, 2013
1 parent 601dc44 commit ffdc62b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/fancy_spec.fy
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand All @@ -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| {
Expand All @@ -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
Expand Down

0 comments on commit ffdc62b

Please sign in to comment.