Skip to content

Commit

Permalink
Merge pull request #99 from ashfurrow/Vkt0r-carthage-fix
Browse files Browse the repository at this point in the history
Fixes CI, Merges #96.
  • Loading branch information
ashfurrow authored May 13, 2017
2 parents e35079a + 18ba69a commit 7be28be
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 57 deletions.
4 changes: 2 additions & 2 deletions Bootstrap/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use_frameworks!
pod 'Forgeries'

target 'BootstrapTests' do
pod 'Quick', '~> 1.1.0'
pod 'Nimble', '~> 6.1.0'
pod 'Quick'
pod 'Nimble'
pod 'FBSnapshotTestCase', git: 'https://github.com/facebook/ios-snapshot-test-case.git'

pod 'Nimble-Snapshots/DynamicType', :path => "../"
Expand Down
24 changes: 12 additions & 12 deletions Bootstrap/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ PODS:
- Forgeries (1.0.0):
- Forgeries/Core (= 1.0.0)
- Forgeries/Core (1.0.0)
- Nimble (6.1.0)
- Nimble-Snapshots/Core (4.4.2):
- Nimble (7.0.0)
- Nimble-Snapshots/Core (5.0.0):
- FBSnapshotTestCase (~> 2.0)
- Nimble
- Quick
- Nimble-Snapshots/DynamicSize (4.4.2):
- Nimble (~> 7.0)
- Quick (~> 1.0)
- Nimble-Snapshots/DynamicSize (5.0.0):
- Nimble-Snapshots/Core
- Nimble-Snapshots/DynamicType (4.4.2):
- Nimble-Snapshots/DynamicType (5.0.0):
- Nimble-Snapshots/Core
- OCMock (~> 3.3)
- OCMock (3.4)
Expand All @@ -23,10 +23,10 @@ PODS:
DEPENDENCIES:
- FBSnapshotTestCase (from `https://github.com/facebook/ios-snapshot-test-case.git`)
- Forgeries
- Nimble (~> 6.1.0)
- Nimble
- Nimble-Snapshots/DynamicSize (from `../`)
- Nimble-Snapshots/DynamicType (from `../`)
- Quick (~> 1.1.0)
- Quick

EXTERNAL SOURCES:
FBSnapshotTestCase:
Expand All @@ -40,13 +40,13 @@ CHECKOUT OPTIONS:
:git: https://github.com/facebook/ios-snapshot-test-case.git

SPEC CHECKSUMS:
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a'
Forgeries: 64ced144ea8341d89a7eec9d1d7986f0f1366250
Nimble: c53e6903fee94041b90ded74f135820437d8bf59
Nimble-Snapshots: 8b21e0d72c0e2a532782ee57f4f83d13ab1ca251
Nimble: 874982b605d4d752fcac6be695d13c502de84b1b
Nimble-Snapshots: 32b9929bcb1ab508429f7a616ae3ad7bc7d5b5d8
OCMock: 35ae71d6a8fcc1b59434d561d1520b9dd4f15765
Quick: dafc587e21eed9f4cab3249b9f9015b0b7a7f71d

PODFILE CHECKSUM: 206301e00d9b7d4f66d75631eed31bed269c2a41
PODFILE CHECKSUM: d31d26e69f9b4f4e931d651a45e3686df495d58a

COCOAPODS: 1.2.1
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Nimble-Snapshots

## master
## Next

## 5.0.0

* Update the Cartfile to use always the latest stable release of Nimble and Quick.
* Fix issue with the installation using Carthage.
* Changed use of deprecated `MatcherFunc` to `Predicate` in favor of `Nimble v7.0.0`.
* Drops support for Swift 2.3 - @marcelofabri
* Adds device agnostic support for testing dynamic sizes - @fsaragoca
* Makes it possible to use it without Quick - @marcelofabri
Expand Down
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Quick/Quick" ~> 1.1.0
github "Quick/Nimble" ~> 6.1.0
github "Quick/Quick"
github "Quick/Nimble"
github "facebook/ios-snapshot-test-case" "2.1.4"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Quick/Nimble" "v6.1.0"
github "Quick/Nimble" "v7.0.0"
github "Quick/Quick" "v1.1.0"
github "facebook/ios-snapshot-test-case" "2.1.4"
8 changes: 4 additions & 4 deletions DynamicSize/DynamicSizeSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public func snapshot(_ name: String? = nil, sizes: [String: CGSize],
public func haveValidDynamicSizeSnapshot(named name: String? = nil, sizes: [String: CGSize],
isDeviceAgnostic: Bool = false, usesDrawRect: Bool = false,
tolerance: CGFloat? = nil,
resizeMode: ResizeMode = .frame) -> MatcherFunc<Snapshotable> {
return MatcherFunc { actualExpression, failureMessage in
resizeMode: ResizeMode = .frame) -> Predicate<Snapshotable> {
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
return performDynamicSizeSnapshotTest(name, sizes: sizes, isDeviceAgnostic: isDeviceAgnostic,
usesDrawRect: usesDrawRect, actualExpression: actualExpression,
failureMessage: failureMessage, tolerance: tolerance,
Expand Down Expand Up @@ -202,8 +202,8 @@ public func recordSnapshot(_ name: String? = nil, sizes: [String: CGSize],

public func recordDynamicSizeSnapshot(named name: String? = nil, sizes: [String: CGSize],
isDeviceAgnostic: Bool = false, usesDrawRect: Bool = false,
resizeMode: ResizeMode = .frame) -> MatcherFunc<Snapshotable> {
return MatcherFunc { actualExpression, failureMessage in
resizeMode: ResizeMode = .frame) -> Predicate<Snapshotable> {
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
return performDynamicSizeSnapshotTest(name, sizes: sizes, isDeviceAgnostic: isDeviceAgnostic,
usesDrawRect: usesDrawRect, actualExpression: actualExpression,
failureMessage: failureMessage, isRecord: true, resizeMode: resizeMode)
Expand Down
40 changes: 20 additions & 20 deletions DynamicType/HaveValidDynamicTypeSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ func shortCategoryName(_ category: UIContentSizeCategory) -> String {
return category.rawValue.replacingOccurrences(of: "UICTContentSizeCategory", with: "")
}

func combineMatchers<T>(_ matchers: [MatcherFunc<T>], ignoreFailures: Bool = false,
deferred: (() -> Void)? = nil) -> MatcherFunc<T> {
return MatcherFunc { actualExpression, failureMessage in
func combinePredicates<T>(_ predicates: [Predicate<T>], ignoreFailures: Bool = false,
deferred: (() -> Void)? = nil) -> Predicate<T> {
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
defer {
deferred?()
}

return try matchers.reduce(true) { acc, matcher -> Bool in
return try predicates.reduce(true) { acc, matcher -> Bool in
guard acc || ignoreFailures else {
return false
}
Expand All @@ -38,57 +38,57 @@ func combineMatchers<T>(_ matchers: [MatcherFunc<T>], ignoreFailures: Bool = fal
public func haveValidDynamicTypeSnapshot(named name: String? = nil, usesDrawRect: Bool = false,
tolerance: CGFloat? = nil,
sizes: [UIContentSizeCategory] = allContentSizeCategories(),
isDeviceAgnostic: Bool = false) -> MatcherFunc<Snapshotable> {
isDeviceAgnostic: Bool = false) -> Predicate<Snapshotable> {
let mock = NBSMockedApplication()

let matchers: [MatcherFunc<Snapshotable>] = sizes.map { category in
let predicates: [Predicate<Snapshotable>] = sizes.map { category in
let sanitizedName = sanitizedTestName(name)
let nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))"

return MatcherFunc { actualExpression, failureMessage in
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
mock.mockPrefferedContentSizeCategory(category)

let matcher: MatcherFunc<Snapshotable>
let predicate: Predicate<Snapshotable>
if isDeviceAgnostic {
matcher = haveValidDeviceAgnosticSnapshot(named: nameWithCategory,
predicate = haveValidDeviceAgnosticSnapshot(named: nameWithCategory,
usesDrawRect: usesDrawRect, tolerance: tolerance)
} else {
matcher = haveValidSnapshot(named: nameWithCategory, usesDrawRect: usesDrawRect, tolerance: tolerance)
predicate = haveValidSnapshot(named: nameWithCategory, usesDrawRect: usesDrawRect, tolerance: tolerance)
}

return try matcher.matches(actualExpression, failureMessage: failureMessage)
return try predicate.matches(actualExpression, failureMessage: failureMessage)
}
}

return combineMatchers(matchers) {
return combinePredicates(predicates) {
mock.stopMockingPrefferedContentSizeCategory()
}
}

public func recordDynamicTypeSnapshot(named name: String? = nil, usesDrawRect: Bool = false,
sizes: [UIContentSizeCategory] = allContentSizeCategories(),
isDeviceAgnostic: Bool = false) -> MatcherFunc<Snapshotable> {
isDeviceAgnostic: Bool = false) -> Predicate<Snapshotable> {
let mock = NBSMockedApplication()

let matchers: [MatcherFunc<Snapshotable>] = sizes.map { category in
let predicates: [Predicate<Snapshotable>] = sizes.map { category in
let sanitizedName = sanitizedTestName(name)
let nameWithCategory = "\(sanitizedName)_\(shortCategoryName(category))"

return MatcherFunc { actualExpression, failureMessage in
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
mock.mockPrefferedContentSizeCategory(category)

let matcher: MatcherFunc<Snapshotable>
let predicate: Predicate<Snapshotable>
if isDeviceAgnostic {
matcher = recordDeviceAgnosticSnapshot(named: nameWithCategory, usesDrawRect: usesDrawRect)
predicate = recordDeviceAgnosticSnapshot(named: nameWithCategory, usesDrawRect: usesDrawRect)
} else {
matcher = recordSnapshot(named: nameWithCategory, usesDrawRect: usesDrawRect)
predicate = recordSnapshot(named: nameWithCategory, usesDrawRect: usesDrawRect)
}

return try matcher.matches(actualExpression, failureMessage: failureMessage)
return try predicate.matches(actualExpression, failureMessage: failureMessage)
}
}

return combineMatchers(matchers, ignoreFailures: true) {
return combinePredicates(predicates, ignoreFailures: true) {
mock.stopMockingPrefferedContentSizeCategory()
}
}
16 changes: 8 additions & 8 deletions HaveValidSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ private func currentTestName() -> String? {
internal var switchChecksWithRecords = false

public func haveValidSnapshot(named name: String? = nil, usesDrawRect: Bool = false,
tolerance: CGFloat? = nil) -> MatcherFunc<Snapshotable> {
tolerance: CGFloat? = nil) -> Predicate<Snapshotable> {

return MatcherFunc { actualExpression, failureMessage in
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
if switchChecksWithRecords {
return recordSnapshot(name, usesDrawRect: usesDrawRect, actualExpression: actualExpression,
failureMessage: failureMessage)
Expand All @@ -224,9 +224,9 @@ public func haveValidSnapshot(named name: String? = nil, usesDrawRect: Bool = fa
}

public func haveValidDeviceAgnosticSnapshot(named name: String? = nil, usesDrawRect: Bool = false,
tolerance: CGFloat? = nil) -> MatcherFunc<Snapshotable> {
tolerance: CGFloat? = nil) -> Predicate<Snapshotable> {

return MatcherFunc { actualExpression, failureMessage in
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
if switchChecksWithRecords {
return recordSnapshot(name, isDeviceAgnostic: true, usesDrawRect: usesDrawRect,
actualExpression: actualExpression, failureMessage: failureMessage)
Expand All @@ -238,18 +238,18 @@ public func haveValidDeviceAgnosticSnapshot(named name: String? = nil, usesDrawR
}
}

public func recordSnapshot(named name: String? = nil, usesDrawRect: Bool = false) -> MatcherFunc<Snapshotable> {
public func recordSnapshot(named name: String? = nil, usesDrawRect: Bool = false) -> Predicate<Snapshotable> {

return MatcherFunc { actualExpression, failureMessage in
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
return recordSnapshot(name, usesDrawRect: usesDrawRect,
actualExpression: actualExpression, failureMessage: failureMessage)
}
}

public func recordDeviceAgnosticSnapshot(named name: String? = nil,
usesDrawRect: Bool = false) -> MatcherFunc<Snapshotable> {
usesDrawRect: Bool = false) -> Predicate<Snapshotable> {

return MatcherFunc { actualExpression, failureMessage in
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
return recordSnapshot(name, isDeviceAgnostic: true, usesDrawRect: usesDrawRect,
actualExpression: actualExpression, failureMessage: failureMessage)
}
Expand Down
6 changes: 3 additions & 3 deletions Nimble-Snapshots.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Nimble-Snapshots"
s.version = "4.4.2"
s.version = "5.0.0"
s.summary = "Nimble matchers for FBSnapshotTestCase"
s.description = <<-DESC
Nimble matchers for FBSnapshotTestCase. Highly derivative of [Expecta Matchers for FBSnapshotTestCase](https://github.com/dblock/ios-snapshot-test-case-expecta).
Expand All @@ -18,8 +18,8 @@ Pod::Spec.new do |s|
s.subspec "Core" do |ss|
ss.source_files = "HaveValidSnapshot.swift", "PrettySyntax.swift", "NimbleSnapshotsConfiguration.swift", "XCTestObservationCenter+CurrentTestCaseTracker.{h,m}"
ss.dependency "FBSnapshotTestCase", "~> 2.0"
ss.dependency "Nimble"
ss.dependency "Quick"
ss.dependency "Nimble", "~> 7.0"
ss.dependency "Quick", "~> 1.0"
end

s.subspec "DynamicType" do |ss|
Expand Down
5 changes: 1 addition & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ require 'tmpdir'

desc 'Run unit tests on iOS 9.3 and 10.3'
task :test do
# workaround for https://github.com/travis-ci/travis-ci/issues/7638
sh "xcrun simctl create 'iPhone 6' com.apple.CoreSimulator.SimDeviceType.iPhone-6 com.apple.CoreSimulator.SimRuntime.iOS-9-3"

sh "set -o pipefail && xcodebuild -workspace 'Bootstrap/Bootstrap.xcworkspace' -sdk 'iphonesimulator' -scheme 'Bootstrap' -destination 'name=iPhone 6,OS=9.3' -destination 'name=iPhone 6,OS=10.3' clean build test | xcpretty --color --simple"
sh "set -o pipefail && xcodebuild -workspace 'Bootstrap/Bootstrap.xcworkspace' -sdk 'iphonesimulator' -scheme 'Bootstrap' -destination 'name=iPhone 6,OS=10.3' clean build test | xcpretty --color --simple"
end

desc 'Lint the library for CocoaPods usage'
Expand Down

0 comments on commit 7be28be

Please sign in to comment.