<commit_before>//
//  NSHTTPClientTests.swift
//  BothamNetworking
//
//  Created by <NAME> on 20/11/15.
//  Copyright © 2015 GoKarumi S.L. All rights reserved.
//

import Foundation

import Foundation
import XCTest
import Nocilla
import Nimble
import BrightFutures
@testable import BothamNetworking

class NSHTTPClientTests: NocillaTestCase {

    private let anyUrl = "http://www.any.com"
    private let anyStatusCode = 201
    private let anyBody = "{HttpResponseBody = true}"
    private let anyError = NSError(domain: "DomainError", code: 123, userInfo: nil)

    func testSendsGetRequestToAnyPath() {
        stubRequest("GET", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.GET, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsPostRequestToAnyPath() {
        stubRequest("POST", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.POST, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsPutRequestToAnyPath() {
        stubRequest("PUT", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.PUT, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsDeleteRequestToAnyPath() {
        stubRequest("DELETE", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.DELETE, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }
<commit_msg>Add some extra tests to cover the rest of the HTTPMethods<commit_after>//
//  NSHTTPClientTests.swift
//  BothamNetworking
//
//  Created by <NAME> on 20/11/15.
//  Copyright © 2015 GoKarumi S.L. All rights reserved.
//

import Foundation

import Foundation
import XCTest
import Nocilla
import Nimble
import BrightFutures
@testable import BothamNetworking

class NSHTTPClientTests: NocillaTestCase {

    private let anyUrl = "http://www.any.com"
    private let anyStatusCode = 201
    private let anyBody = "{HttpResponseBody = true}"
    private let anyError = NSError(domain: "DomainError", code: 123, userInfo: nil)

    func testSendsGetRequestToAnyPath() {
        stubRequest("GET", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.GET, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsPostRequestToAnyPath() {
        stubRequest("POST", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.POST, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsPutRequestToAnyPath() {
        stubRequest("PUT", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.PUT, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsDeleteRequestToAnyPath() {
        stubRequest("DELETE", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.DELETE, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsOptionsRequestToAnyPath() {
        stubRequest("OPTIONS", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.OPTIONS, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsHeadRequestToAnyPath() {
        stubRequest("HEAD", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.HEAD, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsTraceRequestToAnyPath() {
        stubRequest("TRACE", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.TRACE, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

    func testSendsConnectRequestToAnyPath() {
        stubRequest("CONNECT", anyUrl)
        let httpClient = NSHTTPClient()
        let request = givenOneHttpRequest(.CONNECT, url: anyUrl)

        let result = httpClient.send(request)

        expect(result).toEventually(beSuccess())
    }

{'fraction_non_alphanumeric': 0.09872817417546885, 'fraction_numerical': 0.006898038370338435, 'mean_word_length': 3.052401746724891, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2392446', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1319, 'n_words': 314}