<commit_before>
import Quick
import Nimble

import Faro
@testable import Faro_Example

class BarSpec: QuickSpec {
    override func spec() {
        describe("Bar") {
            context("when Bar returns with Result.Model()") {
                var baseURL: String!
                var configuration: Faro.Configuration!
                var bar: Bar!
                var mockJSON: AnyObject!

                beforeEach({
                    mockJSON = ["key": "value"]
                    baseURL = "http://www.something.be"
                    configuration = Configuration(baseURL: baseURL)
                    bar = Bar(configuration: configuration)

                })

                it("should have a configuration with the correct baseUrl") {
                    expect(bar.configuration.baseURL).to(equal(baseURL))
                }

                it("should return in sync with the mock model") {
                    let order = Order(path: "unitTest")
                    var isInSync = false

                    bar.serve(order, service: MockService(mockJSON: mockJSON)) { (result: Result <MockModel>) in
                        isInSync = true
                        switch result {
                        case .Model(model: let model):
                            expect(model.value).to(equal("value"))
                        default:
                            XCTFail("You should succeed")
                        }
                    }

                    expect(isInSync).to(beTrue())
                }
            }
        }
    }
}<commit_msg>refactor barSpec to have a dedicated service<commit_after>
import Quick
import Nimble

import Faro
@testable import Faro_Example

class BarSpec: QuickSpec {
    override func spec() {
        describe("Bar") {
            context(".Model(model)") {
                var bar: Bar!
                var mockJSON: AnyObject!

                beforeEach({
                    mockJSON = ["key": "value"]
                    bar = Bar(service: MockService(mockJSON: mockJSON))

                })

                it("should have a configuration with the correct baseUrl") {
                    expect(bar.service.configuration.baseURL).to(equal("mockService"))
                }

                it("should return in sync with the mock model") {
                    let order = Order(path: "unitTest")
                    var isInSync = false

                    bar.serve(order) { (result: Result <MockModel>) in
                        isInSync = true
                        switch result {
                        case .Model(model: let model):
                            expect(model.value).to(equal("value"))
                        default:
                            XCTFail("You should succeed")
                        }
                    }

                    expect(isInSync).to(beTrue())
                }
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.08755129958960328, 'fraction_numerical': 0.0, 'mean_word_length': 1.1602658788774003, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2740401', 'n_tokens_mistral': 701, 'n_tokens_neox': 639, 'n_words': 173}