cloudfoundry/collector — pull request #10 by dengwa (2014-06-18 19:15:53+00:00)
Title: Reset Collector::Config after each test-case run.

Previously, Collector::Config is global while running test cases, the lack of resetting Collector::Config after each test case can cause failure in this case:
Test cases run randomly,when test case1 runs last in spec/unit/collector/historian_spec.rb, Collector::Config.graphite is assigned.
Then running test case2 in spec/unit/collector_spec.rb,there is an expection:
EventMachine.should_receive(:connect).with("dummy", 14242, Collector::TsdbConnection),
because Collector::Config.graphite isn't nill, it triggers EventMachine.connect of Collector::Historian::Graphite:code1=>code2=>code3=>code4
This causes the failure:

```
Collector::Collector local metrics should send nats latency rolling metric
Failure/Error: create_fake_collector do |collector, _, _|
EventMachine received :connect with unexpected arguments
expected: ("dummy", 14242, Collector::TsdbConnection)
got: ("graphite.host.domain.com", 1234, Collector::GraphiteConnection)
# ./lib/collector/historian/graphite.rb:10:in `initialize'
# ./lib/collector/historian.rb:34:in `new'
# ./lib/collector/historian.rb:34:in `build'
# ./lib/collector.rb:37:in `initialize'
# ./spec/unit/collector_spec.rb:239:in `send_local_metrics'
# ./spec/unit/collector_spec.rb:256:in `block (3 levels) in '
```
The sulution is reset Collector::Config after each test case.