mongo_browser 0.2.0.rc2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/.rspec +1 -1
- data/.travis.yml +6 -1
- data/CHANGELOG.md +15 -0
- data/{grunt.js → Gruntfile.js} +10 -8
- data/Procfile +1 -0
- data/README.md +44 -2
- data/Rakefile +1 -12
- data/app/assets/images/ajax-loader.gif +0 -0
- data/app/assets/javascripts/app/controllers/{breadcrumbs.js.coffee → breadcrumbs_controller.js.coffee} +4 -7
- data/app/assets/javascripts/app/controllers/collections/index_controller.js.coffee +38 -0
- data/app/assets/javascripts/app/controllers/collections/stats_controller.js.coffee +17 -0
- data/app/assets/javascripts/app/controllers/{databases.js.coffee → databases/index_controller.js.coffee} +11 -15
- data/app/assets/javascripts/app/controllers/databases/stats_controller.js.coffee +15 -0
- data/app/assets/javascripts/app/controllers/documents/index_controller.js.coffee +54 -0
- data/app/assets/javascripts/app/controllers/documents/show_controller.js.coffee +38 -0
- data/app/assets/javascripts/app/controllers/main_controller.js.coffee +15 -0
- data/app/assets/javascripts/app/controllers/servers/show_controller.js.coffee +17 -0
- data/app/assets/javascripts/app/directives.js.coffee +23 -0
- data/app/assets/javascripts/app/filters.js.coffee +14 -1
- data/app/assets/javascripts/app/modules/alerts.js.coffee +58 -0
- data/app/assets/javascripts/app/modules/pager.js.coffee +2 -2
- data/app/assets/javascripts/app/modules/spinner.js.coffee +29 -0
- data/app/assets/javascripts/app/modules/table_filter.js.coffee +4 -4
- data/app/assets/javascripts/app/resources.js.coffee +14 -8
- data/app/assets/javascripts/app/services.js.coffee +11 -33
- data/app/assets/javascripts/application.js.coffee +62 -34
- data/app/assets/javascripts/application.test.js.coffee +5 -0
- data/app/assets/javascripts/compiled_templates.js.coffee +1 -0
- data/app/assets/javascripts/vendor.js.coffee +0 -1
- data/app/assets/stylesheets/application.css.scss +36 -18
- data/{public/index.html → app/views/index.erb} +8 -8
- data/bin/mongo_browser +2 -13
- data/config.ru +3 -1
- data/lib/mongo_browser.rb +1 -0
- data/lib/mongo_browser/api.rb +11 -0
- data/lib/mongo_browser/api/collections.rb +34 -0
- data/lib/mongo_browser/api/databases.rb +32 -0
- data/lib/mongo_browser/api/documents.rb +37 -0
- data/lib/mongo_browser/api/mongo.rb +41 -0
- data/lib/mongo_browser/application.rb +8 -174
- data/lib/mongo_browser/application/development.rb +32 -0
- data/lib/mongo_browser/cli.rb +48 -0
- data/lib/mongo_browser/entities.rb +43 -0
- data/lib/mongo_browser/models/collection.rb +7 -12
- data/lib/mongo_browser/models/document.rb +5 -1
- data/lib/mongo_browser/models/pager.rb +22 -9
- data/lib/mongo_browser/version.rb +1 -1
- data/mongo_browser.gemspec +22 -15
- data/package.json +30 -0
- data/public/ng/templates/alerts.html +6 -0
- data/public/ng/templates/collections/index.html +39 -0
- data/public/ng/templates/collections/stats.html +18 -0
- data/public/ng/templates/databases/index.html +35 -0
- data/public/ng/templates/databases/stats.html +18 -0
- data/public/ng/templates/documents/index.html +40 -0
- data/public/ng/templates/documents/show.html +17 -0
- data/{app/assets → public/ng}/templates/pager.html +0 -0
- data/{app/assets/templates/server_info.html → public/ng/templates/server/show.html} +1 -1
- data/{app/assets → public/ng}/templates/table_filter.html +0 -0
- data/script/ci_all +5 -1
- data/script/ci_e2e +5 -2
- data/script/ci_javascripts +1 -1
- data/script/ci_rspec +1 -1
- data/spec/javascripts/app/controllers/{breadcrumbs_spec.js.coffee → breadcrumbs_controller_spec.js.coffee} +1 -1
- data/spec/javascripts/app/controllers/collections/index_controller_spec.js.coffee +95 -0
- data/spec/javascripts/app/controllers/collections/stats_controller_spec.js.coffee +34 -0
- data/spec/javascripts/app/controllers/databases/index_controller_spec.js.coffee +93 -0
- data/spec/javascripts/app/controllers/databases/stats_controller_spec.js.coffee +30 -0
- data/spec/javascripts/app/controllers/documents/index_controller_spec.js.coffee +108 -0
- data/spec/javascripts/app/controllers/documents/show_controller_spec.js.coffee +94 -0
- data/spec/javascripts/app/controllers/{main_spec.js.coffee → main_controller_spec.js.coffee} +2 -2
- data/spec/javascripts/app/controllers/{server_info_spec.js.coffee → server/show_controller_spec.js.coffee} +5 -6
- data/spec/javascripts/app/directives_spec.js.coffee +108 -24
- data/spec/javascripts/app/filters_spec.js.coffee +31 -5
- data/spec/javascripts/app/modules/alerts_spec.js.coffee +138 -0
- data/spec/javascripts/app/modules/dialogs_spec.js.coffee +1 -2
- data/spec/javascripts/app/modules/pager_spec.js.coffee +0 -1
- data/spec/javascripts/app/modules/spinner_spec.js.coffee +65 -0
- data/spec/javascripts/app/modules/table_filter_spec.js.coffee +9 -9
- data/spec/javascripts/app/resources_spec.js.coffee +99 -0
- data/spec/javascripts/app/services_spec.js.coffee +31 -71
- data/spec/javascripts/config/{testacular-e2e.conf.js → karma-e2e.conf.js} +1 -1
- data/spec/javascripts/config/{testacular.conf.js → karma.conf.js} +2 -3
- data/spec/javascripts/e2e/collection_stats_scenario.js.coffee +12 -0
- data/spec/javascripts/e2e/collections_scenario.js.coffee +59 -20
- data/spec/javascripts/e2e/database_stats_scenario.js.coffee +11 -0
- data/spec/javascripts/e2e/databases_scenario.js.coffee +37 -36
- data/spec/javascripts/e2e/document_show_scenario.js.coffee +31 -0
- data/spec/javascripts/e2e/documents_pagination_scenario.js.coffee +33 -0
- data/spec/javascripts/e2e/documents_scenario.js.coffee +43 -4
- data/spec/javascripts/e2e/server_info_scenario.js.coffee +8 -2
- data/spec/javascripts/helpers/mocks.js.coffee +2 -0
- data/spec/javascripts/helpers_e2e/dsl.js.coffee +20 -0
- data/spec/javascripts/lib/angular-mocks.js +64 -16
- data/spec/javascripts/lib/angular-scenario.js +724 -561
- data/spec/javascripts/runner.html +5 -5
- data/spec/lib/api/collections_spec.rb +62 -0
- data/spec/lib/api/databases_spec.rb +58 -0
- data/spec/lib/api/documents_spec.rb +135 -0
- data/spec/lib/api/mongo_spec.rb +27 -0
- data/spec/lib/cli_spec.rb +19 -0
- data/spec/lib/entities_spec.rb +39 -0
- data/spec/lib/models/collection_spec.rb +16 -10
- data/spec/lib/models/database_spec.rb +4 -4
- data/spec/lib/models/document_spec.rb +5 -5
- data/spec/lib/models/pager_spec.rb +20 -11
- data/spec/spec_helper.rb +7 -15
- data/spec/support/api_example_group.rb +45 -0
- data/spec/support/fixtures.rb +10 -6
- data/spec/support/matchers/expose.rb +18 -0
- data/vendor/assets/javascripts/angular/angular-bootstrap.js +1 -1
- data/vendor/assets/javascripts/angular/angular-resource.js +78 -56
- data/vendor/assets/javascripts/angular/angular-sanitize.js +3 -1
- data/vendor/assets/javascripts/angular/angular.js +720 -404
- metadata +323 -183
- data/app/assets/javascripts/app.js.coffee +0 -8
- data/app/assets/javascripts/app/controllers.js.coffee +0 -2
- data/app/assets/javascripts/app/controllers/alerts.js.coffee +0 -12
- data/app/assets/javascripts/app/controllers/collections.js.coffee +0 -40
- data/app/assets/javascripts/app/controllers/documents.js.coffee +0 -49
- data/app/assets/javascripts/app/controllers/main.js.coffee +0 -10
- data/app/assets/javascripts/app/controllers/server_info.js.coffee +0 -14
- data/app/assets/javascripts/templates.js.coffee +0 -1
- data/app/assets/javascripts/templates/.gitkeep +0 -0
- data/app/assets/templates/collections.html +0 -53
- data/app/assets/templates/databases.html +0 -32
- data/app/assets/templates/documents.html +0 -45
- data/config-e2e.ru +0 -20
- data/spec/features/collections_list_spec.rb +0 -64
- data/spec/features/documents_list_spec.rb +0 -139
- data/spec/features/server_info_spec.rb +0 -23
- data/spec/javascripts/app/controllers/alerts_spec.js.coffee +0 -36
- data/spec/javascripts/app/controllers/collections_spec.js.coffee +0 -78
- data/spec/javascripts/app/controllers/databases_spec.js.coffee +0 -55
- data/spec/javascripts/app/controllers/documents_spec.js.coffee +0 -62
- data/spec/javascripts/helpers_e2e/app_element.js.coffee +0 -6
- data/spec/support/feature_example_group.rb +0 -53
- data/spec/support/matchers/have_flash_message.rb +0 -16
- data/spec/support/mongod.rb +0 -91
- data/spec/support/mongodb.conf +0 -47
@@ -22,8 +22,7 @@ describe "mb.dialogs", ->
|
|
22
22
|
confirmationDialog(message: "This is a test message")
|
23
23
|
|
24
24
|
# Then
|
25
|
-
expect(dialogsHandler.confirm).toHaveBeenCalledWith
|
26
|
-
"This is a test message",
|
25
|
+
expect(dialogsHandler.confirm).toHaveBeenCalledWith "This is a test message",
|
27
26
|
jasmine.any(Function)
|
28
27
|
|
29
28
|
describe "when the dialog was confirmed", ->
|
@@ -14,7 +14,6 @@ describe "mb.pager", ->
|
|
14
14
|
expect(p.outerWindow).toEqual(0)
|
15
15
|
|
16
16
|
describe "windowedPageNumbers", ->
|
17
|
-
|
18
17
|
it "calculates windowed visible links", inject (pager) ->
|
19
18
|
prepare = pager(page: 6, totalPages: 11, innerWindow: 1, outerWindow: 1)
|
20
19
|
expect(prepare.windowedPageNumbers()).toEqual [1, 2, null, 5, 6, 7, null, 10, 11]
|
@@ -0,0 +1,65 @@
|
|
1
|
+
describe "mb.spinner", ->
|
2
|
+
beforeEach module("mb.spinner")
|
3
|
+
|
4
|
+
describe "httpRequestTracker", ->
|
5
|
+
$http = null
|
6
|
+
httpRequestTracker = null
|
7
|
+
|
8
|
+
beforeEach inject ($injector) ->
|
9
|
+
httpRequestTracker = $injector.get("httpRequestTracker")
|
10
|
+
$http = $injector.get("$http")
|
11
|
+
|
12
|
+
describe "when no requests is progress", ->
|
13
|
+
it "does not report pending requests", ->
|
14
|
+
expect(httpRequestTracker.hasPendingRequests()).toBeFalsy()
|
15
|
+
|
16
|
+
describe "when requests are in progress", ->
|
17
|
+
beforeEach -> $http.pendingRequests.push({})
|
18
|
+
|
19
|
+
it "reports pending requests", ->
|
20
|
+
expect(httpRequestTracker.hasPendingRequests()).toBeTruthy()
|
21
|
+
|
22
|
+
describe "controller", ->
|
23
|
+
httpRequestTracker = null
|
24
|
+
controller = null
|
25
|
+
$scope = null
|
26
|
+
|
27
|
+
beforeEach inject ($injector, $rootScope, $controller) ->
|
28
|
+
httpRequestTracker = $injector.get("httpRequestTracker")
|
29
|
+
$scope = $rootScope.$new()
|
30
|
+
controller = $controller "spinner",
|
31
|
+
$scope: $scope
|
32
|
+
|
33
|
+
describe "#showSpinner", ->
|
34
|
+
describe "when there is a pending request", ->
|
35
|
+
beforeEach ->
|
36
|
+
spyOn(httpRequestTracker, "hasPendingRequests").andReturn(true)
|
37
|
+
|
38
|
+
it "returns true", ->
|
39
|
+
expect($scope.showSpinner()).toBeTruthy()
|
40
|
+
|
41
|
+
describe "otherwise", ->
|
42
|
+
beforeEach ->
|
43
|
+
spyOn(httpRequestTracker, "hasPendingRequests").andReturn(false)
|
44
|
+
|
45
|
+
it "returns false", ->
|
46
|
+
expect($scope.showSpinner()).toBeFalsy()
|
47
|
+
|
48
|
+
describe "directive", ->
|
49
|
+
element = null
|
50
|
+
|
51
|
+
beforeEach inject ($compile, $rootScope) ->
|
52
|
+
$scope = $rootScope
|
53
|
+
$scope.showSpinner = -> false
|
54
|
+
|
55
|
+
element = angular.element """
|
56
|
+
<spinner></spinner>
|
57
|
+
"""
|
58
|
+
$compile(element)($scope)
|
59
|
+
$scope.$digest()
|
60
|
+
|
61
|
+
it "renders the spinner", ->
|
62
|
+
img = element.find("img")
|
63
|
+
|
64
|
+
expect(img.length).toBe(1)
|
65
|
+
expect(img.attr("src")).toEqual("/assets/ajax-loader.gif")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
describe "mb.tableFilter", ->
|
2
2
|
beforeEach module("mb.tableFilter")
|
3
3
|
|
4
|
-
describe "
|
4
|
+
describe "controller", ->
|
5
5
|
$scope = null
|
6
6
|
|
7
7
|
beforeEach inject ($controller, $rootScope) ->
|
@@ -25,21 +25,21 @@ describe "mb.tableFilter", ->
|
|
25
25
|
|
26
26
|
expect($scope.value).toEqual("")
|
27
27
|
|
28
|
-
describe "
|
28
|
+
describe "directive", ->
|
29
29
|
$scope = null
|
30
30
|
element = null
|
31
31
|
|
32
|
-
beforeEach module("
|
32
|
+
beforeEach module("public/ng/templates/table_filter.html")
|
33
33
|
|
34
34
|
beforeEach inject ($rootScope, $compile) ->
|
35
35
|
$scope = $rootScope
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
element = angular.element """
|
38
|
+
<div>
|
39
|
+
<table-filter value="filterValue" placeholder="Enter database name"></table-filter>
|
40
|
+
</div>
|
41
|
+
"""
|
42
|
+
$compile(element)($scope)
|
43
43
|
$scope.$digest()
|
44
44
|
|
45
45
|
it "sets the valid placeholder", ->
|
@@ -0,0 +1,99 @@
|
|
1
|
+
describe "reources", ->
|
2
|
+
beforeEach module("mb.resources")
|
3
|
+
|
4
|
+
$httpBackend = null
|
5
|
+
beforeEach inject ($injector) ->
|
6
|
+
$httpBackend = $injector.get("$httpBackend")
|
7
|
+
|
8
|
+
afterEach ->
|
9
|
+
$httpBackend.verifyNoOutstandingExpectation()
|
10
|
+
$httpBackend.verifyNoOutstandingRequest()
|
11
|
+
|
12
|
+
describe "Database", ->
|
13
|
+
Database = null
|
14
|
+
beforeEach inject ($injector) ->
|
15
|
+
Database = $injector.get("Database")
|
16
|
+
|
17
|
+
it "is defined", ->
|
18
|
+
expect(Database).toBeDefined()
|
19
|
+
|
20
|
+
describe "#query", ->
|
21
|
+
it "queries for all databases", ->
|
22
|
+
$httpBackend.whenGET("/api/databases").respond([])
|
23
|
+
Database.query()
|
24
|
+
$httpBackend.flush()
|
25
|
+
|
26
|
+
describe "#$stats", ->
|
27
|
+
it "queries for database stats", ->
|
28
|
+
$httpBackend.whenGET("/api/databases/test_database/stats").respond({})
|
29
|
+
|
30
|
+
database = new Database(name: "test_database")
|
31
|
+
database.$stats()
|
32
|
+
|
33
|
+
$httpBackend.flush()
|
34
|
+
|
35
|
+
describe "Collection", ->
|
36
|
+
Collection = null
|
37
|
+
beforeEach inject ($injector) ->
|
38
|
+
Collection = $injector.get("Collection")
|
39
|
+
$httpBackend.whenGET("/api/databases/test_database/collections")
|
40
|
+
.respond([])
|
41
|
+
|
42
|
+
it "is defined", ->
|
43
|
+
expect(Collection).toBeDefined()
|
44
|
+
|
45
|
+
describe "#query", ->
|
46
|
+
it "queries for all collections", ->
|
47
|
+
Collection.query(dbName: "test_database")
|
48
|
+
$httpBackend.flush()
|
49
|
+
|
50
|
+
describe "#$stats", ->
|
51
|
+
it "queries for collection stats", ->
|
52
|
+
fakeResponse = foo: "bar"
|
53
|
+
$httpBackend.whenGET("/api/databases/test_database/collections/test_collection/stats")
|
54
|
+
.respond(fakeResponse)
|
55
|
+
|
56
|
+
collection = new Collection(dbName: "test_database", name: "test_collection")
|
57
|
+
collection.$stats (data) ->
|
58
|
+
expect(angular.equals(data, fakeResponse)).toBeTruthy()
|
59
|
+
|
60
|
+
$httpBackend.flush()
|
61
|
+
|
62
|
+
describe "Document", ->
|
63
|
+
Document = null
|
64
|
+
beforeEach inject ($injector) ->
|
65
|
+
Document = $injector.get("Document")
|
66
|
+
$httpBackend.whenGET("/api/databases/test_database/collections/test_collection/documents")
|
67
|
+
.respond([])
|
68
|
+
|
69
|
+
it "is defined", ->
|
70
|
+
expect(Document).toBeDefined()
|
71
|
+
|
72
|
+
describe "#query", ->
|
73
|
+
it "queries for all documents", ->
|
74
|
+
Document.query(dbName: "test_database", collectionName: "test_collection")
|
75
|
+
$httpBackend.flush()
|
76
|
+
|
77
|
+
describe "#$query", ->
|
78
|
+
it "queries for all documents", ->
|
79
|
+
document = new Document(dbName: "test_database", collectionName: "test_collection")
|
80
|
+
document.$query()
|
81
|
+
$httpBackend.flush()
|
82
|
+
|
83
|
+
describe "$get", ->
|
84
|
+
it "gets a document", ->
|
85
|
+
$httpBackend.whenGET("/api/databases/test_database/collections/test_collection/documents/document-id").respond([])
|
86
|
+
|
87
|
+
document = new Document(dbName: "test_database", collectionName: "test_collection", id: "document-id")
|
88
|
+
document.$get()
|
89
|
+
|
90
|
+
$httpBackend.flush()
|
91
|
+
|
92
|
+
describe "$delete", ->
|
93
|
+
it "deletes a document", ->
|
94
|
+
$httpBackend.whenDELETE("/api/databases/test_database/collections/test_collection/documents/document-id").respond([])
|
95
|
+
|
96
|
+
document = new Document(dbName: "test_database", collectionName: "test_collection", id: "document-id")
|
97
|
+
document.$delete()
|
98
|
+
|
99
|
+
$httpBackend.flush()
|
@@ -1,83 +1,43 @@
|
|
1
1
|
describe "services", ->
|
2
|
+
beforeEach module("mb.alerts")
|
2
3
|
beforeEach module("mb.services")
|
4
|
+
beforeEach module("mocks")
|
3
5
|
|
4
|
-
describe "
|
5
|
-
|
6
|
-
|
6
|
+
describe "httpErrorsInterceptor", ->
|
7
|
+
$http = null
|
8
|
+
promise = null
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
_(4).times -> alerts.nextId()
|
12
|
-
expect(alerts.nextId()).toEqual(6)
|
10
|
+
interceptor = null
|
11
|
+
alerts = null
|
12
|
+
$q = null
|
13
13
|
|
14
|
-
|
15
|
-
beforeEach inject (alerts) ->
|
16
|
-
spyOn(alerts, "delayedDispose")
|
14
|
+
errorHandler = null
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
beforeEach inject ($injector) ->
|
17
|
+
$http = $injector.get("$http")
|
18
|
+
interceptor = $injector.get("httpErrorsInterceptor")
|
19
|
+
alerts = $injector.get("alerts")
|
20
|
+
$q = $injector.get("$q")
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
promise = then: jasmine.createSpy("then").andReturn({})
|
23
|
+
interceptor(promise)
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
testMessage = "This is a test message!"
|
29
|
-
otherTestMessage = "This is a second test message!"
|
25
|
+
spyOn(alerts, "push")
|
26
|
+
spyOn($q, "reject")
|
27
|
+
errorHandler = promise.then.mostRecentCall.args[1]
|
30
28
|
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
it "alerts an error on failed http request", ->
|
30
|
+
httpResponse = status: 500
|
31
|
+
errorHandler(httpResponse)
|
34
32
|
|
35
|
-
|
36
|
-
|
33
|
+
expect(alerts.push).toHaveBeenCalledWith("error", "Unexpected HTTP error")
|
34
|
+
expect($q.reject).toHaveBeenCalledWith(httpResponse)
|
37
35
|
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
describe "when http response includes an error message", ->
|
37
|
+
it "alerts this error", ->
|
38
|
+
httpResponse = status: 500, data:
|
39
|
+
error: "The custom message"
|
40
|
+
errorHandler(httpResponse)
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
# Given
|
45
|
-
testMessage = "This is a test message!"
|
46
|
-
|
47
|
-
# When
|
48
|
-
alerts.error(testMessage)
|
49
|
-
expect(alerts.delayedDispose).toHaveBeenCalledWith(1)
|
50
|
-
|
51
|
-
# Then
|
52
|
-
expect(alerts.messages).toContain(id: 1, type: "error", text: testMessage)
|
53
|
-
|
54
|
-
describe "#dispose", ->
|
55
|
-
it "removes a message with the given id", inject (alerts) ->
|
56
|
-
# Given
|
57
|
-
alerts.info("First message")
|
58
|
-
alerts.info("Second message")
|
59
|
-
alerts.info("Third message")
|
60
|
-
alerts.error("Error message")
|
61
|
-
|
62
|
-
# When
|
63
|
-
alerts.dispose(2)
|
64
|
-
|
65
|
-
# Then
|
66
|
-
expect(alerts.messages).toContain(id: 1, type: "info", text: "First message")
|
67
|
-
expect(alerts.messages).not.toContain(id: 2, type: "info", text: "Second message")
|
68
|
-
expect(alerts.messages).toContain(id: 3, type: "info", text: "Third message")
|
69
|
-
expect(alerts.messages).toContain(id: 4, type: "error", text: "Error message")
|
70
|
-
|
71
|
-
describe "#delayedDispose", ->
|
72
|
-
it "removes a message after the given time", inject (alerts, $timeout) ->
|
73
|
-
# Given
|
74
|
-
alerts.info("First message")
|
75
|
-
|
76
|
-
# When
|
77
|
-
alerts.delayedDispose(1)
|
78
|
-
expect(alerts.messages).toContain(id: 1, type: "info", text: "First message")
|
79
|
-
|
80
|
-
$timeout.flush()
|
81
|
-
|
82
|
-
# Then
|
83
|
-
expect(alerts.messages).toEqual([])
|
42
|
+
expect(alerts.push).toHaveBeenCalledWith("error", "The custom message")
|
43
|
+
expect($q.reject).toHaveBeenCalledWith(httpResponse)
|
@@ -13,9 +13,8 @@ files = [
|
|
13
13
|
"vendor/assets/javascripts/*.js",
|
14
14
|
|
15
15
|
// The app
|
16
|
-
"app/assets/javascripts/app/controllers.js.coffee",
|
17
|
-
"app/assets/javascripts/app/**/*.js.coffee",
|
18
16
|
"app/assets/javascripts/application.js.coffee",
|
17
|
+
"app/assets/javascripts/app/**/*.js.coffee",
|
19
18
|
|
20
19
|
// Specs
|
21
20
|
"spec/javascripts/lib/angular-mocks.js",
|
@@ -25,7 +24,7 @@ files = [
|
|
25
24
|
"spec/javascripts/**/*_spec.js.coffee",
|
26
25
|
|
27
26
|
// Templates
|
28
|
-
"app/assets/javascripts/
|
27
|
+
"app/assets/javascripts/compiled_templates/*.html.js"
|
29
28
|
];
|
30
29
|
|
31
30
|
preprocessors = {
|
@@ -0,0 +1,12 @@
|
|
1
|
+
describe "collection stats page", ->
|
2
|
+
|
3
|
+
beforeEach ->
|
4
|
+
browser().navigateTo("/e2e/load_fixtures")
|
5
|
+
browser().navigateTo("/")
|
6
|
+
|
7
|
+
element("table.databases tbody tr a:contains('first_database')").click()
|
8
|
+
element("table.collections tbody tr a:contains('first_collection')").click()
|
9
|
+
element("a.btn:contains('Collection stats')").click()
|
10
|
+
|
11
|
+
it "displays database stats", ->
|
12
|
+
expect(repeater("table tbody tr").count()).toBeGreaterThan(0)
|
@@ -1,49 +1,88 @@
|
|
1
1
|
describe "collections list page", ->
|
2
|
+
collectionsList = null
|
3
|
+
|
2
4
|
beforeEach ->
|
3
5
|
browser().navigateTo("/e2e/load_fixtures")
|
4
6
|
browser().navigateTo("/")
|
5
7
|
|
6
8
|
element("table.databases tbody tr a:contains('first_database')").click()
|
9
|
+
collectionsList = repeater("table.collections tbody tr")
|
7
10
|
|
8
11
|
it "navigates to the valid url", ->
|
9
12
|
expect(browser().location().url()).toBe("/databases/first_database/collections")
|
10
13
|
|
14
|
+
it "shows the breadcrumbs", ->
|
15
|
+
link = element(".container a.brand")
|
16
|
+
expect(link.text()).toEqual("Mongo Browser")
|
17
|
+
expect(link.attr("href")).toEqual("/")
|
18
|
+
|
19
|
+
dbLink = element(".container .breadcrumbs li:nth-child(1) a")
|
20
|
+
expect(dbLink.text()).toEqual("first_database")
|
21
|
+
expect(dbLink.attr("href")).toEqual("/databases/first_database/collections")
|
22
|
+
|
11
23
|
it "displays a valid section title", ->
|
12
24
|
title = element("h2").text()
|
13
25
|
expect(title).toEqual("first_database collections")
|
14
26
|
|
15
27
|
it "displays available collections ordered by name", ->
|
16
|
-
expect(
|
17
|
-
|
28
|
+
expect(collectionsList.column("collection.name"))
|
29
|
+
.toEqual(["first_collection", "second_collection", "system.indexes", "third_collection"])
|
18
30
|
|
19
31
|
it "filters the collections list", ->
|
20
32
|
input("value").enter("")
|
21
|
-
expect(
|
22
|
-
expect(
|
23
|
-
|
33
|
+
expect(collectionsList.count()).toBe(4)
|
34
|
+
expect(collectionsList.column("collection.name"))
|
35
|
+
.toEqual(["first_collection", "second_collection", "system.indexes", "third_collection"])
|
24
36
|
|
25
37
|
input("value").enter("first")
|
26
|
-
expect(
|
27
|
-
expect(
|
28
|
-
|
38
|
+
expect(collectionsList.count()).toBe(1)
|
39
|
+
expect(collectionsList.column("collection.name"))
|
40
|
+
.toEqual(["first_collection"])
|
29
41
|
|
30
42
|
input("value").enter("second")
|
31
|
-
expect(
|
32
|
-
expect(
|
33
|
-
|
43
|
+
expect(collectionsList.count()).toBe(1)
|
44
|
+
expect(collectionsList.column("collection.name"))
|
45
|
+
.toEqual(["second_collection"])
|
34
46
|
|
35
47
|
input("value").enter("collection")
|
36
|
-
expect(
|
37
|
-
expect(
|
38
|
-
|
48
|
+
expect(collectionsList.count()).toBe(3)
|
49
|
+
expect(collectionsList.column("collection.name"))
|
50
|
+
.toEqual(["first_collection", "second_collection", "third_collection"])
|
39
51
|
|
40
52
|
input("value").enter("not existing")
|
41
|
-
expect(
|
42
|
-
expect(element(".
|
53
|
+
expect(collectionsList.count()).toBe(0)
|
54
|
+
expect(element(".alert:visible").text()).toMatch(/Nothing has been found./)
|
43
55
|
|
44
56
|
element("button:contains('Clear')").click()
|
45
|
-
expect(
|
57
|
+
expect(collectionsList.count()).toBe(4)
|
58
|
+
|
59
|
+
describe "delete a collection", ->
|
60
|
+
deleteCollection = (name) ->
|
61
|
+
element("table.collections tbody tr:contains('#{name}') td:last-child a:contains('Delete')")
|
62
|
+
.click()
|
63
|
+
|
64
|
+
beforeEach ->
|
65
|
+
deleteCollection("third_collection")
|
66
|
+
expect(element("div.modal .modal-body").text())
|
67
|
+
.toContain("Deleting third_collection. Are you sure?")
|
68
|
+
|
69
|
+
describe "when the dialog was disposed", ->
|
70
|
+
beforeEach -> disposeDialog()
|
71
|
+
|
72
|
+
it "does nothig", ->
|
73
|
+
expect(collectionsList.count()).toBe(4)
|
74
|
+
expect(collectionsList.column("collection.name"))
|
75
|
+
.toEqual(["first_collection", "second_collection", "system.indexes", "third_collection"])
|
76
|
+
|
77
|
+
describe "when the dialog was confirmed", ->
|
78
|
+
beforeEach -> confirmDialog()
|
79
|
+
|
80
|
+
it "shows the alert", ->
|
81
|
+
expect(repeater("aside#alerts .alert").count()).toBe(1)
|
82
|
+
expect(repeater("aside#alerts .alert").column("message.text"))
|
83
|
+
.toContain("Collection third_collection has been deleted.")
|
46
84
|
|
47
|
-
|
48
|
-
|
49
|
-
|
85
|
+
it "deletes a database", ->
|
86
|
+
expect(collectionsList.count()).toBe(3)
|
87
|
+
expect(collectionsList.column("collection.name"))
|
88
|
+
.toEqual(["first_collection", "second_collection", "system.indexes"])
|