RKTestFixture Class Reference
Inherits from | NSObject |
Declared in | RKTestFixture.h |
Overview
Provides a static method API for conveniently accessing fixture data contained within a designated NSBundle
. Useful when writing unit tests that leverage fixture data for testing parsing and object mapping operations.
Tasks
-
+ fixtureBundle
Returns the NSBundle object designated as the source location for unit testing fixture data.
-
+ setFixtureBundle:
Designates the specified NSBundle object as the source location for unit testing fixture data.
-
+ pathForFixture:
Returns the full path to the specified fixture file on within the fixture bundle.
-
+ stringWithContentsOfFixture:
Creates and returns a string object by reading data from the fixture identified by the specified file name using UTF-8 encoding.
-
+ dataWithContentsOfFixture:
Creates and returns a data object by reading every byte from the fixture identified by the specified file name.
-
+ MIMETypeForFixture:
Returns the MIME Type for the fixture identified by the specified name.
-
+ parsedObjectWithContentsOfFixture:
Creates and returns an object representation of the data from the fixture identified by the specified file name by reading the data as a string and parsing it using a parser appropriate for the MIME Type of the file.
Class Methods
MIMETypeForFixture:
Returns the MIME Type for the fixture identified by the specified name.
+ (NSString *)MIMETypeForFixture:(NSString *)fixtureName
Parameters
- fixtureName
The name of the fixture file.
Return Value
The MIME Type for the resource file or nil if the file could not be located.
Declared In
RKTestFixture.h
dataWithContentsOfFixture:
Creates and returns a data object by reading every byte from the fixture identified by the specified file name.
+ (NSData *)dataWithContentsOfFixture:(NSString *)fixtureName
Parameters
- fixtureName
The name of the resource file.
Return Value
A data object by reading every byte from the fixture file.
Declared In
RKTestFixture.h
fixtureBundle
Returns the NSBundle object designated as the source location for unit testing fixture data.
+ (NSBundle *)fixtureBundle
Return Value
The NSBundle object designated as the source location for unit testing fixture data
or nil if none has been configured.
Declared In
RKTestFixture.h
parsedObjectWithContentsOfFixture:
Creates and returns an object representation of the data from the fixture identified by the specified file name by reading the data as a string and parsing it using a parser appropriate for the MIME Type of the file.
+ (id)parsedObjectWithContentsOfFixture:(NSString *)fixtureName
Parameters
- fixtureName
The name of the resource file.
Return Value
A new image object for the specified file, or nil if the method could not initialize the image from the specified file.
Declared In
RKTestFixture.h
pathForFixture:
Returns the full path to the specified fixture file on within the fixture bundle.
+ (NSString *)pathForFixture:(NSString *)fixtureName
Parameters
- fixtureName
The name of the fixture file.
Return Value
The full path to the specified fixture file or nil if it cannot be located.
Declared In
RKTestFixture.h
setFixtureBundle:
Designates the specified NSBundle object as the source location for unit testing fixture data.
+ (void)setFixtureBundle:(NSBundle *)bundle
Parameters
- bundle
The new fixture NSBundle object.
Declared In
RKTestFixture.h
stringWithContentsOfFixture:
Creates and returns a string object by reading data from the fixture identified by the specified file name using UTF-8 encoding.
+ (NSString *)stringWithContentsOfFixture:(NSString *)fixtureName
Parameters
- fixtureName
The name of the fixture file.
Return Value
A string created by reading data from the specified fixture file using the NSUTF8StringEncoding.
Declared In
RKTestFixture.h