Permalink
Browse files

Staging task should return the app's owner when #user is called

Test plan:
- New unit test

Change-Id: Ide403ebf8595718665029deb0024182849405689
  • Loading branch information...
1 parent f78e2a4 commit 0102004dbc5043f958ca08fe699e02bfffee38dd mpage committed Nov 18, 2011
Showing with 14 additions and 2 deletions.
  1. +4 −1 cloud_controller/app/models/staging_task.rb
  2. +10 −1 cloud_controller/spec/models/staging_task_spec.rb
@@ -43,6 +43,10 @@ def initialize(app, opts={})
}
end
+ def user
+ @app.owner
+ end
+
def run(timeout=AppConfig[:staging][:max_staging_runtime])
stager_client = VCAP::Stager::Ipc::FiberedNatsClient.new(@nats)
begin
@@ -59,7 +63,6 @@ def run(timeout=AppConfig[:staging][:max_staging_runtime])
result
end
-
def cleanup
FileUtils.rm_f(@upload_path)
end
@@ -46,9 +46,18 @@
end
end
- def create_stub_app(id)
+ describe '#user' do
+ it 'should be the owner of the app being staged' do
+ app = create_stub_app(1, 'test')
+ task = StagingTask.new(app)
+ task.user.should == app.owner
+ end
+ end
+
+ def create_stub_app(id, owner=nil)
app = stub("app_#{id}")
app.stubs(:id).returns(id)
+ app.stubs(:owner).returns(owner)
app
end
end

0 comments on commit 0102004

Please sign in to comment.