spec/lib/ib/generator_spec.rb in ib-0.4.0 vs spec/lib/ib/generator_spec.rb in ib-0.4.1

- old
+ new

@@ -13,11 +13,11 @@ #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> #import <UIKit/UIKit.h> -@interface AppDelegate +@interface AppDelegate: UIResponder <UIApplicationDelegate> @property IBOutlet UIWindow * window; @property IBOutlet UINavigationController * navigationController; @end @@ -48,10 +48,13 @@ @end @interface AnotherView: EmptyView @end +@interface SimpleClass: NSObject +@end + OBJC end it "generates stubs header with osx platform" do files = IB::Parser.new.find_all("spec/fixtures/common") @@ -63,11 +66,11 @@ #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> #import <Cocoa/Cocoa.h> -@interface AppDelegate +@interface AppDelegate: UIResponder <UIApplicationDelegate> @property IBOutlet UIWindow * window; @property IBOutlet UINavigationController * navigationController; @end @@ -98,10 +101,13 @@ @end @interface AnotherView: EmptyView @end +@interface SimpleClass: NSObject +@end + OBJC end it "generates stubs implement" do files = IB::Parser.new.find_all("spec/fixtures/common") @@ -124,8 +130,59 @@ @end @implementation AnotherView @end +@implementation SimpleClass +@end + OBJC end + + it "generates stubs header with ios platform of dependency_test fixtures" do + files = IB::Parser.new.find_all("spec/fixtures/dependency_test") + stubs = IB::Generator.new(:ios).render_stub_file('generator/templates/Stubs.h.erb', files) + + stubs.should == <<-OBJC +// Generated by IB v#{IB::VERSION} gem. Do not edit it manually +// Run `rake ib:open` to refresh + +#import <Foundation/Foundation.h> +#import <CoreData/CoreData.h> +#import <UIKit/UIKit.h> + +@interface BaseView: NSObject +@end + +@interface AddButton: BaseView +@end + +@interface AppDelegate: UIResponder <UIApplicationDelegate> +@end + +@interface SuperClass: UIViewController +@end + +@interface SubView1: UIView + +@property IBOutlet AddButton * button; + +-(IBAction) action_test:(id) sender; + +@end + +@interface SubClass2: SuperClass + +@property IBOutlet SubView1 * banner; + +@end + +@interface SubClass1: SubClass2 +@end + +@interface UIMyWebView: UIWebView +@end + +OBJC + end + end