specta/specta — pull request #75 by modocache (2014-05-05 06:33:04+00:00)
Title: Mirror RSpec behavior for around hooks and pending

RSpec executes before- and after-all blocks regardless of whether any
examples in an example group are actually executed. Specta only executes
before- and after-all blocks if at least one example group in run.
Change Specta behavior to mirror RSpec's.

---

The following RSpec spec demonstrates the RSpec 3.0 behavior:

```ruby
require 'rspec'

RSpec.describe 'around hooks for pending examples' do
before(:all) { puts "\nbefore(:all)" }
before(:each) { puts "\nbefore(:each)" }
after(:each) { puts "\nafter(:each)" }
after(:all) { puts "\nafter(:all)" }
pending 'a pending example'
end
```

When run, the program outputs:

```
before(:all)
*
after(:all)
```

Note that before- and after-all blocks are run, while -each blocks are
not. Prior to this commit, a similar spec using Specta would not output
anything; no -all or -each blocks would be executed. In order to execute
only -all blocks:

- Split `-[SPTExampleGroup runBeforeHooks:]` and `-runAfterHooks:` into
methods that run -each and -all hooks.
- Compile pending examples with a block that executes only -all hooks.
- Execute example blocks for all enabled examples, even pending ones.

> I made a small note on this issue in pull request #67.