collection-json-browser 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js +13 -15
- data/app/views/collection_json_browser/home/index.html +7 -1
- data/lib/collection-json-browser/version.rb +1 -1
- data/test/dummy/app/controllers/api/application_controller.rb +0 -74
- data/test/dummy/app/controllers/api/posts_controller.rb +75 -1
- data/test/dummy/log/development.log +10946 -0
- data/test/dummy/public/scenarios.js +15 -1
- data/test/dummy/tmp/cache/assets/CC8/CC0/sprockets%2F77ac1342b1ae62c0123f399257a703aa +0 -0
- data/test/dummy/tmp/cache/assets/D01/390/sprockets%2F152365a6c64bdbf13d80c22762c0f48b +0 -0
- data/test/dummy/tmp/cache/assets/D36/D00/sprockets%2F3a43e8f11605c939cbb04aec364ba775 +0 -0
- data/test/dummy/tmp/cache/assets/D58/C00/sprockets%2F7bd61bb28f7ce577f679872a7cc4a477 +0 -0
- data/test/dummy/tmp/cache/assets/D74/650/sprockets%2F5c448233c8ef782e60adda4b8f572b6b +0 -0
- data/test/dummy/tmp/pids/server.pid +1 -1
- data/test/javascripts/test/e2e/scenarios.js +15 -1
- data/test/javascripts/test/unit/controllersSpec.js +18 -5
- metadata +2 -2
|
@@ -38,7 +38,21 @@ describe('Collection JSON Browser', function() {
|
|
|
38
38
|
expect(element("form button[type=submit]")).toBe()
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
describe('lists items', function() {
|
|
42
|
+
it('lists alls', function() {
|
|
43
|
+
expect(repeater('ol .item').count()).toBe(2);
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('lists items with their respective GET links', function() {
|
|
47
|
+
expect(element('ol .item dl dd.get a').text()).toEqual('/api/posts/1/api/posts/2')
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('lists items with their respective DELETE links', function() {
|
|
51
|
+
expect(element('ol .item dl dd.delete a').text()).toEqual('delete /api/posts/1delete /api/posts/2')
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('list the created item under collection items when the form is submitted successfully', function(){
|
|
42
56
|
//TODO: figure out how to test this
|
|
43
57
|
input('field.value').enter('Ruby and Angular')
|
|
44
58
|
input('field.value').enter('Happily ever after')
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
7336
|
|
@@ -38,7 +38,21 @@ describe('Collection JSON Browser', function() {
|
|
|
38
38
|
expect(element("form button[type=submit]")).toBe()
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
describe('lists items', function() {
|
|
42
|
+
it('lists alls', function() {
|
|
43
|
+
expect(repeater('ol .item').count()).toBe(2);
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('lists items with their respective GET links', function() {
|
|
47
|
+
expect(element('ol .item dl dd.get a').text()).toEqual('/api/posts/1/api/posts/2')
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('lists items with their respective DELETE links', function() {
|
|
51
|
+
expect(element('ol .item dl dd.delete a').text()).toEqual('delete /api/posts/1delete /api/posts/2')
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('list the created item under collection items when the form is submitted successfully', function(){
|
|
42
56
|
//TODO: figure out how to test this
|
|
43
57
|
input('field.value').enter('Ruby and Angular')
|
|
44
58
|
input('field.value').enter('Happily ever after')
|
|
@@ -31,8 +31,10 @@ describe('ApiController', function(){
|
|
|
31
31
|
$httpBackend = _$httpBackend_;
|
|
32
32
|
var root = "http://localhost:3000"
|
|
33
33
|
$httpBackend.when('GET', '/api').respond(responseData);
|
|
34
|
+
$httpBackend.when('GET', '/api/posts').respond(responseData);
|
|
34
35
|
$httpBackend.when('POST', '/api').respond(responseData);
|
|
35
36
|
$httpBackend.when('PUT', '/api').respond(responseData);
|
|
37
|
+
$httpBackend.when('DELETE', '/api/posts/1').respond(responseData);
|
|
36
38
|
|
|
37
39
|
scope = $rootScope.$new();
|
|
38
40
|
location = $location;
|
|
@@ -62,7 +64,7 @@ describe('ApiController', function(){
|
|
|
62
64
|
|
|
63
65
|
describe('#goTo', function(){
|
|
64
66
|
beforeEach(function(){
|
|
65
|
-
spyOn(location, '
|
|
67
|
+
spyOn(location, 'url')
|
|
66
68
|
})
|
|
67
69
|
|
|
68
70
|
it('stores fromRel', function(){
|
|
@@ -72,14 +74,17 @@ describe('ApiController', function(){
|
|
|
72
74
|
|
|
73
75
|
it('sets location path', function(){
|
|
74
76
|
scope.goTo('/api/posts', 'some-rel')
|
|
75
|
-
|
|
77
|
+
$httpBackend.flush();
|
|
78
|
+
expect(location.url).toHaveBeenCalledWith('/api/posts')
|
|
76
79
|
})
|
|
77
80
|
})
|
|
78
81
|
|
|
79
82
|
describe('#submit', function(){
|
|
80
|
-
|
|
83
|
+
beforeEach(function(){
|
|
81
84
|
scope.collection = responseData.collection
|
|
85
|
+
})
|
|
82
86
|
|
|
87
|
+
it('post the form when fromRel is not edit-form', function(){
|
|
83
88
|
$httpBackend.expectPOST('/api')
|
|
84
89
|
|
|
85
90
|
scope.fromRel = 'some-stuff'
|
|
@@ -89,8 +94,6 @@ describe('ApiController', function(){
|
|
|
89
94
|
})
|
|
90
95
|
|
|
91
96
|
it('put the form when fromRel is edit-form', function(){
|
|
92
|
-
scope.collection = responseData.collection
|
|
93
|
-
|
|
94
97
|
$httpBackend.expectPUT('/api')
|
|
95
98
|
|
|
96
99
|
scope.fromRel = 'edit-form'
|
|
@@ -99,4 +102,14 @@ describe('ApiController', function(){
|
|
|
99
102
|
$httpBackend.flush()
|
|
100
103
|
})
|
|
101
104
|
})
|
|
105
|
+
|
|
106
|
+
describe('#destroy', function(){
|
|
107
|
+
it('deletes the resource', function(){
|
|
108
|
+
$httpBackend.expectDELETE('/api/posts/1')
|
|
109
|
+
|
|
110
|
+
scope.destroy('/api/posts/1')
|
|
111
|
+
|
|
112
|
+
$httpBackend.flush()
|
|
113
|
+
})
|
|
114
|
+
})
|
|
102
115
|
});
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: collection-json-browser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-07-
|
|
12
|
+
date: 2013-07-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|