Skip to content

Releases: cedarbdd/cedar

Version 0.9.7

29 May 07:33
Compare
Choose a tag to compare

Backwards Incompatibility

Deprecations

These are minor changes -- just renames. The deprecated imports and classes still exist for backwards compatibility, but are marked as deprecated.

  • The SpecHelper class has been renamed to CDRSpecHelper, an alias has been made, but you should rename to the new prefix styled class name.
  • <Cedar.h> and <Cedar-iOS.h> are now the recommended imports to use instead of <SpecHelper.h> in your PCH file

Major Changes

stub_method Changes

stub_method is now more type-leinient than before. This allows stubbing of methods that return CLLocationCoordinate2D, for example, to work correctly.

stub_method now supports and_do_block(), which directly accepts arguments the stubbed method would take. This provides a nicer interface instead of using and_do(), which got more complicated to use under ARC. Here's an example usage for and_do_block():

// defined on the class being faked
- (int)incrementNumber:(int)num {}

fake stub_method(@selector(incrementNumber:)).and_do_block(^int(int num) {
    return num + 1;
});

stub_method is also now can better discern when arguments are specified with wildcards specified via Arguments::any([Class class]) and Arguments::anything().

And no more type-casting to and_return() for nil, you can now do it directly:

fake stub_method(@selector(value)).and_return(nil);

contain Matcher Changes

First, the contain matcher now supports views:

view should contain(childView);

With the new nested() method, you can check for arbitrary nesting:

view should contain(grandChildView).nested();

This works for arrays and sets too.

A new assistant sub matcher, an_instance_of(), can be used to check if an item belongs to a given class:

view should contain(an_instance_of([MyView class]));

It can be used in conjunction with the other new features.

Dictionaries also have specializations for verifying keys and values:

dictionary should contain(@"aKey").as_a_key();
dictionary should contain(@"aValue").as_a_value();

Expectations around nil

Various fixes have been made around how matchers and stubs deal with nil. An example of existing behavior in Cedar:

id value = nil;
id otherValue = nil;
value should equal(otherValue); // fails

This expectation fails in order avoid the common pitfall of objective-c's nil absorbing method calls to avoid incorrectly passing tests. If you explicitly want nil, you must use the be_nil matcher.

Using stub_method().with() no longer delegates to equal matcher behavior, because of the nil behavior explained above. This means implicit nils in with() work.

Various other nil behaviors have been fixed:

  • using a stubbed method with(<NSNumber>) parameter no longer crashes when given nil.
  • equal no longer crashes when comparing NSNumbers, but one of the values is nil.
  • stringifiers correctly handle for nil values of other types (e.g. - NSNumber).
  • be_nil now works against blocks.

Other Changes

File Templates

  • File templates use new icons
  • File templates now use Xcode-pills for subject-under-test
  • The default stringifier no longer crashes when attempting to stringify unsupported c-structs.
  • Fixed warnings in project file for users that add cedar as a subproject or newly creates projects via template

Fixed Crashes

  • Fixed crashes when running in Mountain Lion
  • Fixed crashes for Xcode Plugin with Xcode 5.1

Rakefiles

  • xcrun is used in rakefiles instead of hard-coded values when possible
  • improved error messaging for rake upgrade
  • cedar will only clean its own templates and not delete its directory
  • kill the simulator when after running tests to clear environment variables
  • fixed rake install failure when Xcode plugin directory does not exist.

Misc

  • Cedar now supports/compiles with 64-bit support
  • Xcode Plugin specifies support for Xcode 5.1
  • Refactored bootstrapping of test runners (and now have a consistent set of default runners for test bundles)
  • podspec file now explicitly links to libc++
  • describe and context blocks are released eagerly instead of after the entire spec suite finishes.
  • Fixed memory leaks (spies included)

Version 0.9.6

08 Apr 04:28
Compare
Choose a tag to compare

Installer fixes

  • Installer now reports failure correctly when building Cedar or running tests fails, as v0.9.5 was for Xcode 5.1

General fixes

  • Fixed to build and run tests on Xcode 5.1 which was preventing proper installation
  • Running cedar's rake tasks no longer clobbers your environment

Doubles (Spies & Fakes)

  • Spies now forward -isEqual: and -hash to the spied upon object.
  • Added KVC support

Matchers

  • Adds a matcher for NSRange

Xcode integration

  • Further adjustments to test output
  • Test output shows old-school dots at end
  • Adds Xcode 5 plugin (alpha!) - install with rake install_plugin
  • Fix crash if Xcode calls otest with "-SenTest Self" arguments

Project/Target Templates

  • Rakefiles perform xcodebuild clean when cleaning build dir
  • Fixed paths for frameworks copied into OS X templates

Version 0.9.5

20 Jan 20:31
Compare
Choose a tag to compare

Notice: Apr 4, 2014

We've been made aware of an issue with the installer and test suite which may incorrectly report a successful installation, when in fact it fails. We're working on releasing a patch version. Until then, installing the development version of Cedar is recommended. See here for details.

General fixes

  • Fixed some memory leaks
  • Project organization tidied up
  • Resolved several warnings, particularly for CocoaPods users
  • Fixed symbolication of exception backtraces on iOS 7 simulator (#159)
  • Added new example reporting methods which provide greater flexibility for developing reporters than the traditional KVO approach (See CDRReportDispatcher for details)

Matchers

  • Added a be_falsy matcher to complement be_truthy (#158)
  • Added exist matcher for testing that files/directories exist (#152). It accepts NSString or NSURL objects

Doubles (Spies & Fakes)

  • Nice protocol fakes can now be told to reject optional methods (#167), like so:
    protocol_fake reject_method(@selector(someProtocolMethod))
  • Protocol fakes for multiple protocols can now be created (#157), e.g:
    fake_for(@protocol(UITableViewDataSource), @protocol(UITableViewDelegate))
  • Spies should now play nicely with KVO collection methods
  • Improved test coverage for KVO scenarios

Xcode integration

  • Test bundle output now reports test start and end time
  • Adds support for recognizing Cedar specs as tests and running focused tests from within Xcode. This still requires a plugin we're currently testing internally; keep watching this space!

Project/Target Templates

  • Updated project and target template icons, thanks to Patrick Alfred (#160)
  • Added script to conveniently upgrade Cedar framework added by templates (#163):
    rake upgrade path/to/your/project/spec_target/Frameworks/Cedar-iOS.framework
  • Installing Cedar templates now verifies static framework is built correctly.

Version 0.9.4

11 Dec 18:43
Compare
Choose a tag to compare

Runtime changes

  • iOS Specs run headless by default (as if CEDAR_HEADLESS_SPECS is set); Set CEDAR_GUI_SPECS if you want the old UI
  • Updated spec bundle output format to match XCTest for Xcode 5

Matchers

  • Workaround for ARC compiler bugs for BeNil/BeSameInstanceAs - now your specs can be compiled with ARC!
  • C-strings can now be compared (#105)
  • Clearer output from RaiseException matcher
  • Add RespondTo matcher to assert that an object respondsToSelector: (#132)
  • Add ConformTo matcher to assert that an object conformsToProtocol: (#134)

Doubles (Spies & Fakes)

  • You can now stub methods with specific c-string arguments (#105)
  • stub_method now raises more meaningful error if you try to stub an unresolvable method
  • You can now stub a method multiple times with different primitive arguments (#101)

Fake specific changes

  • Nice Fakes no longer throw exceptions when sent KVO messages (#110)
  • Strict fakes throw meaningful exceptions when sent unstubbed KVO messages (#122)
  • Class fakes answer -class/isKindOfClass:/conformsToProtocol: based on the faked class
  • Protocol fakes answer -conformsToProtocol: based on the faked protocol

Spy specific changes

  • Eagerly retain decorded message arguments to avoid issues with methods eagerly releasing them (#137, #139)
  • You can now stop_spying_on(spy) (#141)
  • Spies should now support KVO correctly (#125, #140)
  • Spies now support classes that forward messages (#98)
  • Spies raise more meaningful errors when they are sent a message they don't recognize
  • Spies answer -isKindOfClass: based on the spied upon object's class
  • Spies answer -class with the spied upon object's class

Project Templates

  • Generated Rakefile should now work correctly under Xcode 5
  • Generated Rakefile for spec bundles should now work
  • Generated Rakefile should work when project name contains spaces or other weird characters (#131)

General fixes

  • Project upgraded Xcode 5 / iOS 7 SDK
  • Fix crash when printing the name of a shared example group (#99)
  • Expose public headers necessary to support users with custom spec reporters (#102)
  • Cedar now flushes gcov data when test run ends (#126, #127, #128, #133)

Version 0.9.3

02 Aug 21:18
Compare
Choose a tag to compare

Installation Changes

  • Fixed install script problems with git checkout and submodule initialization. If you previously tried the new install method without success, please do try again.

Doubles

  • Spies now correctly record messages that they send to themselves.

Bug Fixes

  • Messages recorded by test doubles on other threads no longer crash on completion of Spec. (Thanks to Lenny T for helping to diagnose this issue).

General Changes

  • xdescribe(…), xcontext(…), describe(@"…", PENDING), context(@"…", PENDING) are now reported as pending.

Version 0.9.2

25 Jul 21:00
Compare
Choose a tag to compare

Installation Changes

  • Add new install script
  • Fixed installation from paths containing spaces
  • Fixed installation to paths containing symlinks

New Features

Bug Fixes

  • Messages recorded by test doubles no longer over-retain the receiver and its arguments
  • Exceptions thrown in afterEach no longer crash the entire suite

Target Templates

Doubles

  • Methods can be stubbed multiple times
  • Non-nice fakes no longer return YES for respondsToSelector: for optional protocol methods unless a stub is provided
  • Stub arguments can now be specified with variable arguments: .with(a, b) vs .with(a).and_with(b)

Matchers

  • Cedar builds for iOS now include matchers for UIKit and CoreGraphics structs
  • Numeric comparison matchers now work with NSDecimal and NSDecimalNumber

AppCode Support

General Changes