Skip to content

Commit

Permalink
Prevent unintended network requests when matching fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyoung committed Jan 19, 2016
1 parent 9d9a4cc commit e44a818
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions PortalTests/Networking/Resources/Site/GetSiteSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ class GetSiteSpec: QuickSpec {
repo: repo
)

let error = NSError(domain: "io.thegrid.PortalTests", code: 0, userInfo: [ NSLocalizedDescriptionKey: "Unexpected request." ])
self.stub(everything, builder: failure(error))

let matcher = api(.GET, "https://api.thegrid.io/site/\(id)", token: token)
let builder = json(responseBody)
self.stub(matcher, builder: builder)
Expand Down
3 changes: 3 additions & 0 deletions PortalTests/Networking/Resources/Site/GetSitesSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class GetSitesSpec: QuickSpec {

let sites = [ site ]

let error = NSError(domain: "io.thegrid.PortalTests", code: 0, userInfo: [ NSLocalizedDescriptionKey: "Unexpected request." ])
self.stub(everything, builder: failure(error))

let matcher = api(.GET, "https://api.thegrid.io/site", token: token)
let builder = json(responseBody)
self.stub(matcher, builder: builder)
Expand Down
3 changes: 3 additions & 0 deletions PortalTests/Networking/Resources/User/GetUserSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class GetUserSpec: QuickSpec {
sitesQuota: sitesQuota
)

let error = NSError(domain: "io.thegrid.PortalTests", code: 0, userInfo: [ NSLocalizedDescriptionKey: "Unexpected request." ])
self.stub(everything, builder: failure(error))

let matcher = api(.GET, "https://api.thegrid.io/user", token: token)
let builder = json(responseBody)
self.stub(matcher, builder: builder)
Expand Down

0 comments on commit e44a818

Please sign in to comment.