   it 'should not show card fields not visible to non-admins when user is a non-admin', ->
     @createApp(
       appConfig:
+        renderTo: 'testDiv'
         settings:
           cardFields: 'EmailAddress,OnpremLdapUsername'
       isAdmin: false
     ).then =>
-      @assertFieldsShownOnCard ['EmailAddress']
-
-  helpers
-    assertFieldsShownOnCard: (fieldNames) ->
-      cardEl = @cardboard().getColumns()[0].getCards()[0].getEl()
-
-      expect(cardEl.query('.field-content').length).toBe fieldNames.length
-
-      for fieldName in fieldNames
-        expect(cardEl.down('.field-content.' + fieldName)).not.toBeNull()
-
-    cardboard: ->
-      @app.down('.rallycardboard')
-
-    createApp: (options = {}) ->
-      @stubIsAdmin if options.isAdmin? then options.isAdmin else true
-      @stubProjectRecords options.projectRecords || @projectRecords
-
-      @app = Ext.create 'Rally.apps.teamboard.TeamBoardApp', Ext.apply(
-        context: Ext.create 'Rally.app.Context'
-        renderTo: 'testDiv'
-      , options.appConfig)
-
-      @waitForComponentReady @app
-
-    stubIsAdmin: (isAdmin) ->
-      @stub(Rally.environment.getContext().getPermissions(), 'isWorkspaceOrSubscriptionAdmin').returns isAdmin
-
-    stubProjectRecords: (projectRecords) ->
-      @stub Rally.apps.teamboard.TeamBoardProjectRecordsLoader, 'load', (teamOids, callback, scope) ->
-        callback.call scope, projectRecords+      @assertFieldsShownOnCard ['EmailAddress']
      expect(@cardboard().readOnly).toBe false

  it 'should show the team name in the column header', ->
    @createApp().then =>
      headerHtml = @cardboard().getColumns()[0].getHeaderTitle().getEl().down('.columnTpl').getHTML()
      Assert.contains headerHtml, @projectRecords[0].get('_refObjectName')

  it 'should show OfficeLocation and Phone on the cards by default', ->
    @createApp().then =>
      @assertFieldsShownOnCard ['OfficeLocation', 'Phone']

  it 'should show the chosen card fields on the cards', ->
    @createApp(
      appConfig:
        settings:
          cardFields: 'EmailAddress,OnpremLdapUsername'
    ).then =>

  it 'should show a message when user does not have access to any of the teams chosen', ->
    @createApp(
      projectRecords: []
      appConfig:
        renderTo: 'testDiv'
    ).then =>
      expect(@app.getEl().down('.no-data')).not.toBe null

