Skip to content
Browse files

Add a CLI test for removing an application.

  • Loading branch information...
1 parent 98eb09e commit 492a1498cfab3f2e07981fbc3133a9882be7c44b @Manfred Manfred committed Mar 9, 2011
Showing with 14 additions and 18 deletions.
  1. +13 −17 test/passenger_pane/cli_test.nu
  2. +1 −1 test/passenger_pane/fake_ppane/ppane
View
30 test/passenger_pane/cli_test.nu
@@ -41,37 +41,33 @@
(set @cli ((CLI alloc) init))
(@cli setPathToCLI:pathToCLI)
(@cli fakeAuthorize)
- ))
-
- (it "adds a new application" (do ()
+
(set attributes (NSMutableDictionary dictionary))
(attributes setValue:"test.local" forKey:"host")
(attributes setValue:"assets.test.local" forKey:"aliases")
(attributes setValue:"/path/to/test" forKey:"path")
(attributes setValue:"production" forKey:"environment")
(attributes setValue:"/path/to/test.conf" forKey:"config_filename")
- (set application ((Application alloc) initWithAttributes:attributes))
-
- (@cli add:application)
-
+ (set @application ((Application alloc) initWithAttributes:attributes))
+ ))
+
+ (it "adds a new application" (do ()
+ (@cli add:@application)
(set arguments (NSString stringWithContentsOfFile:pathToCLIArguments encoding:NSUTF8StringEncoding error:nil))
(~ arguments should equal:"[\"add\", \"/path/to/test\", \"-path\", \"/path/to/test\", \"-environment\", \"production\", \"-host\", \"test.local\", \"-config_filename\", \"/path/to/test.conf\", \"-aliases\", \"assets.test.local\"]")
))
(it "updates an application" (do ()
- (set attributes (NSMutableDictionary dictionary))
- (attributes setValue:"test.local" forKey:"host")
- (attributes setValue:"assets.test.local" forKey:"aliases")
- (attributes setValue:"/path/to/test" forKey:"path")
- (attributes setValue:"production" forKey:"environment")
- (attributes setValue:"/path/to/test.conf" forKey:"config_filename")
- (set application ((Application alloc) initWithAttributes:attributes))
-
- (@cli update:application)
-
+ (@cli update:@application)
(set arguments (NSString stringWithContentsOfFile:pathToCLIArguments encoding:NSUTF8StringEncoding error:nil))
(~ arguments should equal:"[\"update\", \"test.local\", \"-path\", \"/path/to/test\", \"-environment\", \"production\", \"-host\", \"test.local\", \"-config_filename\", \"/path/to/test.conf\", \"-aliases\", \"assets.test.local\"]")
))
+
+ (it "deletes an application" (do ()
+ (@cli delete:@application)
+ (set arguments (NSString stringWithContentsOfFile:pathToCLIArguments encoding:NSUTF8StringEncoding error:nil))
+ (~ arguments should equal:"[\"delete\", \"test.local\"]")
+ ))
))
((Bacon sharedInstance) run)
View
2 test/passenger_pane/fake_ppane/ppane
@@ -5,7 +5,7 @@ require File.expand_path('../../../../lib/passenger_pane/trust', __FILE__)
command = ARGV[0]
if command == 'list'
puts '[{"framework":"rails","hosts":["manager.boom.local","account.boom.local"],"path":"\/Users\/manfred\/Code\/boommanager","config_filename":"\/private\/etc\/apache2\/passenger_pane_vhosts\/boommanager.local.vhost.conf","host":"manager.boom.local","aliases":"account.boom.local","environment":"development","vhost_address":"*:80","user_defined_data":"<Directory \"\/Users\/manfred\/Code\/boommanager\/public\">\n Order allow,deny\n Allow from all\n <\/Directory>"},{"framework":"rails","hosts":["scoring.boom.local"],"path":"\/Users\/manfred\/Code\/boomscoring","config_filename":"\/private\/etc\/apache2\/passenger_pane_vhosts\/boomscoring.local.vhost.conf","host":"scoring.boom.local","aliases":"","environment":"development","vhost_address":"*:80","user_defined_data":"<Directory \"\/Users\/manfred\/Code\/boomscoring\/public\">\n Order allow,deny\n Allow from all\n <\/Directory>"},{"framework":"rails","hosts":["diagnose.local"],"path":"\/Users\/manfred\/Code\/diagnose","config_filename":"\/private\/etc\/apache2\/passenger_pane_vhosts\/diagnose.local.vhost.conf","host":"diagnose.local","aliases":"","environment":"development","vhost_address":"*:80","user_defined_data":"<Directory \"\/Users\/manfred\/Code\/diagnose\/public\">\n Order allow,deny\n Allow from all\n <\/Directory>"}]'
-elsif %w(add update restart).include?(command)
+elsif %w(add update delete restart).include?(command)
require 'fileutils'
tmpdir = File.expand_path('../../../../tmp', __FILE__)
filename = File.join(tmpdir, '.test/args.txt')

0 comments on commit 492a149

Please sign in to comment.
Something went wrong with that request. Please try again.