Sha256: c7d6da9d91a233fe512aa3f0790a8502699765f61e6e496f104e3d0ec44cff90

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

describe "collections stats controller", ->
  beforeEach module("mb")

  $scope = null
  $httpBackend = null

  beforeEach inject ($injector, $rootScope, $controller) ->
    $routeParams = $injector.get("$routeParams")
    $routeParams.dbName = "test_database"
    $routeParams.collectionName = "test_collection"

    $httpBackend = $injector.get("$httpBackend")
    $httpBackend.whenGET("/api/databases/test_database/collections/test_collection/stats")
      .respond(foo: "bar")

    $scope = $rootScope.$new()
    $controller "collections.stats",
      $scope: $scope

    $httpBackend.flush()

  afterEach ->
    $httpBackend.verifyNoOutstandingExpectation()
    $httpBackend.verifyNoOutstandingRequest()

  it "assings database name", ->
    expect($scope.dbName).toEqual("test_database")

  it "assings collection name", ->
    expect($scope.collectionName).toEqual("test_collection")

  it "fetches the collection stats", ->
    expect($scope.stats).toBeDefined()
    expect(angular.equals({ foo: "bar" }, $scope.stats)).toBeTruthy()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_browser-0.2.5 spec/javascripts/app/controllers/collections/stats_controller_spec.js.coffee