HuaweiTech/collector — pull request #1 by WuLonghui (2014-06-13 09:39:42+00:00)
Title: Reset Collector::Config after each test case

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](https://github.com/WuLonghui/collector/blob/master/spec/unit/collector/historian_spec.rb#L114) runs last in spec/unit/collector/historian_spec.rb, Collector::Config.graphite is assigned.
Then running [test case2](https://github.com/WuLonghui/collector/blob/master/spec/unit/collector_spec.rb#L255) in spec/unit/collector_spec.rb,there is an expection:
[EventMachine.should_receive(:connect).with("dummy", 14242, Collector::TsdbConnection)](https://github.com/WuLonghui/collector/blob/master/spec/spec_helper.rb#L73),
because Collector::Config.graphite isn't nill, it triggers EventMachine.connect of Collector::Historian::Graphite:
[code1](https://github.com/WuLonghui/collector/blob/master/spec/spec_helper.rb#L81)
=>[code2](https://github.com/WuLonghui/collector/blob/master/lib/collector.rb#L37)=>[code3](https://github.com/WuLonghui/collector/blob/master/lib/collector/historian.rb#L33)=>[code4](https://github.com/WuLonghui/collector/blob/master/lib/collector/historian/graphite.rb#L10)
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.