Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Artsy Tests/ARAppSearchViewControllerSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ - (void)closeSearch:(id)sender;
});

context(@"with no results", ^{
itHasSnapshotsForDevicesWithName(@"displays zero state", ^{
itHasAsyncronousSnapshotsForDevicesWithName(@"displays zero state", ^{

sharedBefore();
sut.searchDataSource.searchResults = [NSOrderedSet orderedSetWithObjects:[SearchResult modelWithJSON:@{
Expand Down
2 changes: 1 addition & 1 deletion Artsy Tests/ARArtworkPreviewActionsViewTests.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "ARArtworkPreviewActionsView.h"
#import "ARHeartButton.h"
#import <Artsy-UIButtons/ARButtonSubclasses.h>
#import <Artsy_UIButtons/ARButtonSubclasses.h>

@interface ARArtworkPreviewActionsView (Testing)

Expand Down
125 changes: 62 additions & 63 deletions Artsy Tests/ARFairArtistViewControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,65 @@
#import "ARFairArtistViewController.h"
#import "ARFairArtistNetworkModel.h"

@interface ARFairArtistViewController (Tests)
@property (nonatomic, assign, readwrite) BOOL shouldAnimate;
@property (nonatomic, strong, readwrite) NSObject <FairArtistNeworkModel> *networkModel;
@end

SpecBegin(ARFairArtistViewController)

void (^itlooksCorrectWithArtist)(Artist* artist, NSArray *maps) = ^void(Artist *artist, NSArray *mapsJSON) {

Fair *fair = [Fair modelWithJSON:@{
@"id" : @"fair-id",
@"name" : @"The Armory Show",
@"organizer" : @{ @"profile_id" : @"fair-profile-id" },
}];

ARStubbedFairNetworkModel *fairNetworkModel = [[ARStubbedFairNetworkModel alloc] init];
fairNetworkModel.maps = [mapsJSON map:^Map*(NSDictionary *mapJSON) { return [Map modelWithJSON:mapJSON]; }];

fair.networkModel = fairNetworkModel;

[OHHTTPStubs stubJSONResponseAtPath:@"/api/v1/maps" withParams:@{ @"fair_id" : @"fair-id" } withResponse:mapsJSON];


ARStubbedFairArtistNetworkModel *fairArtistNetworkModel = [[ARStubbedFairArtistNetworkModel alloc] init];
fairArtistNetworkModel.artist = artist;
fairArtistNetworkModel.shows = @[];

ARFairArtistViewController *fairArtistVC = [[ARFairArtistViewController alloc] initWithArtistID:@"some-artist" fair:fair];
fairArtistVC.networkModel = fairArtistNetworkModel;
[fairArtistVC ar_presentWithFrame:CGRectMake(0, 0, 320, 480)];
expect(fairArtistVC.view).will.haveValidSnapshot();

};

sharedExamples(@"looks correct", ^(NSDictionary *data) {
__block NSArray *mapsJSON = data[@"mapsJSON"];

it(@"show subtitle with a birthdate and a nationality", ^{
Artist *artist = [Artist modelWithJSON:@{ @"id" : @"some-artist", @"name" : @"Some Artist", @"birthday" : @"1999", @"nationality" : @"Chinese"}];
itlooksCorrectWithArtist(artist, mapsJSON);
});

it(@"hides subtitle without a birthdate", ^{
Artist *artist = [Artist modelWithJSON:@{ @"id" : @"some-artist", @"name" : @"Some Artist", @"nationality" : @"Chinese"}];
itlooksCorrectWithArtist(artist, mapsJSON);
});

it(@"hides subtitle without a nationality", ^{
Artist *artist = [Artist modelWithJSON:@{ @"id" : @"some-artist", @"name" : @"Some Artist", @"birthday" : @"1999"}];
itlooksCorrectWithArtist(artist, mapsJSON);
});

});

describe(@"with maps", ^{
itBehavesLike(@"looks correct", @{@"mapsJSON": @[@{ @"id" : @"map-id" }] });
});

describe(@"without maps", ^{
itBehavesLike(@"looks correct", @{@"mapsJSON": @[] });
});

SpecEnd
// @interface ARFairArtistViewController (Tests)
// @property (nonatomic, assign, readwrite) BOOL shouldAnimate;
// @property (nonatomic, strong, readwrite) NSObject <FairArtistNeworkModel> *networkModel;
// @end
//
// SpecBegin(ARFairArtistViewController)
//
// void (^itlooksCorrectWithArtist)(Artist* artist, NSArray *maps) = ^void(Artist *artist, NSArray *mapsJSON) {
//
// Fair *fair = [Fair modelWithJSON:@{
// @"id" : @"fair-id",
// @"name" : @"The Armory Show",
// @"organizer" : @{ @"profile_id" : @"fair-profile-id" },
// }];
//
// ARStubbedFairNetworkModel *fairNetworkModel = [[ARStubbedFairNetworkModel alloc] init];
// fairNetworkModel.maps = [mapsJSON map:^Map*(NSDictionary *mapJSON) { return [Map modelWithJSON:mapJSON]; }];
//
// fair.networkModel = fairNetworkModel;
//
// [OHHTTPStubs stubJSONResponseAtPath:@"/api/v1/maps" withParams:@{ @"fair_id" : @"fair-id" } withResponse:mapsJSON];
//
// ARStubbedFairArtistNetworkModel *fairArtistNetworkModel = [[ARStubbedFairArtistNetworkModel alloc] init];
// fairArtistNetworkModel.artist = artist;
// fairArtistNetworkModel.shows = @[];
//
// ARFairArtistViewController *fairArtistVC = [[ARFairArtistViewController alloc] initWithArtistID:@"some-artist" fair:fair];
// fairArtistVC.networkModel = fairArtistNetworkModel;
// [fairArtistVC ar_presentWithFrame:CGRectMake(0, 0, 320, 480)];
// expect(fairArtistVC.view).will.haveValidSnapshot();
//
// };
//
// sharedExamples(@"looks correct", ^(NSDictionary *data) {
// __block NSArray *mapsJSON = data[@"mapsJSON"];
//
// it(@"show subtitle with a birthdate and a nationality", ^{
// Artist *artist = [Artist modelWithJSON:@{ @"id" : @"some-artist", @"name" : @"Some Artist", @"birthday" : @"1999", @"nationality" : @"Chinese"}];
// itlooksCorrectWithArtist(artist, mapsJSON);
// });
//
// it(@"hides subtitle without a birthdate", ^{
// Artist *artist = [Artist modelWithJSON:@{ @"id" : @"some-artist", @"name" : @"Some Artist", @"nationality" : @"Chinese"}];
// itlooksCorrectWithArtist(artist, mapsJSON);
// });
//
// it(@"hides subtitle without a nationality", ^{
// Artist *artist = [Artist modelWithJSON:@{ @"id" : @"some-artist", @"name" : @"Some Artist", @"birthday" : @"1999"}];
// itlooksCorrectWithArtist(artist, mapsJSON);
// });
//
// });
//
// describe(@"with maps", ^{
// itBehavesLike(@"looks correct", @{@"mapsJSON": @[@{ @"id" : @"map-id" }] });
// });
//
// describe(@"without maps", ^{
// itBehavesLike(@"looks correct", @{@"mapsJSON": @[] });
// });
//
// SpecEnd
2 changes: 1 addition & 1 deletion Artsy Tests/ARProfileViewControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#import <ARAnalytics/ARAnalytics.h>
#import "ARAnalyticsConstants.h"
#import "UIViewController+SimpleChildren.h"
#import "UIView+FLKAutoLayout.h"
@import FLKAutoLayout;
#import "ARFairViewController.h"
#import "ARInternalMobileWebViewController.h"

Expand Down
1 change: 0 additions & 1 deletion Artsy Tests/ARShowViewControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ - (void)addMapPreview;

sharedExamples(@"looks correct", ^(NSDictionary *data) {
NSDictionary *json = data[@"json"];
NSLog(@"%@", json);

itHasSnapshotsForDevices(^{
PartnerShow *show = [PartnerShow modelWithJSON:json];
Expand Down
30 changes: 13 additions & 17 deletions Artsy Tests/Artsy Tests-Prefix.pch
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
//
// Artsy Tests-Prefix.pch
// Artsy
//
// Created by Orta Therox on 01/01/2013.
// Copyright (c) 2013 Artsy. All rights reserved.
//

#ifdef __OBJC__
// Directly linked pods
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#define EXP_SHORTHAND
#import <Specta/Specta.h>
#import "SpectaDSL+Sleep.h"
#import <Expecta/Expecta.h>
#import <Expecta+Snapshots/EXPMatchers+FBSnapshotTest.h>
#import <Expecta_Snapshots/EXPMatchers+FBSnapshotTest.h>
#import <OHHTTPStubs/OHHTTPStubs.h>
#import <ISO8601DateFormatter/ISO8601DateFormatter.h>
#import <UICKeyChainStore/UICKeyChainStore.h>
#import <OCMock/OCMock.h>
#import <UIAlertView+Blocks/UIAlertView+Blocks.h>

// Pods that come in from the other target
#import <AFNetworking/AFNetworking.h>
#import <ISO8601DateFormatter/ISO8601DateFormatter.h>
#import <UIAlertView_Blocks/UIAlertView+Blocks.h>
#import <UICKeyChainStore/UICKeyChainStore.h>
#import <Mantle/Mantle.h>
#import <Mantle/MTLJSONAdapter.h>
#import <ObjectiveSugar/ObjectiveSugar.h>
#import <ORStackView/ORStackScrollView.h>
#import <ORStackView/ORTagBasedAutoStackView.h>
#import <ReactiveCocoa/ReactiveCocoa.h>

// Headers
#import "MTLModel+JSON.h"
#import "MTLModel+Dictionary.h"
#import "Constants.h"
Expand All @@ -31,9 +31,5 @@
#import "ARTestHelper.h"
#import "ARAutoLayoutDebugging.h"
#import "StyledSubclasses.h"
#import <ObjectiveSugar/ObjectiveSugar.h>
#import <ORStackView/ORStackScrollView.h>
#import <ORStackView/ORTagBasedAutoStackView.h>
#import <ReactiveCocoa/ReactiveCocoa.h>
#import "UIViewController+PresentWithFrame.h"
#endif
2 changes: 1 addition & 1 deletion Artsy Tests/OCMArg+ClassChecker.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "OCMArg.h"
@import OCMock;

@interface OCMArg (ClassChecker)

Expand Down
2 changes: 1 addition & 1 deletion Artsy WatchKit App/App/ARWatchLoadingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ - (void)awakeWithContext:(WatchMessage *)context
[self.class openParentApplication:self.message.dictionaryRepresentation reply:^(NSDictionary *replyInfo, NSError *error) {

if (replyInfo == nil) {
NSLog(@"Likely a problem with the phone app, check the log.");
ARErrorLog(@"Likely a problem with the phone app, check the log.");
}

// Expects a WatchMessage +messageWithArtworks, +messageWithArtworks or +messageWithError returned
Expand Down
Loading