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.
@@ -38,7 +38,21 @@ describe('Collection JSON Browser', function() {
38
38
  expect(element("form button[type=submit]")).toBe()
39
39
  });
40
40
 
41
- it('lists collection items when the form is submitted successfully', function(){
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')
@@ -1 +1 @@
1
- 90369
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
- it('lists collection items when the form is submitted successfully', function(){
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, 'path')
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
- expect(location.path).toHaveBeenCalledWith('/api/posts')
77
+ $httpBackend.flush();
78
+ expect(location.url).toHaveBeenCalledWith('/api/posts')
76
79
  })
77
80
  })
78
81
 
79
82
  describe('#submit', function(){
80
- it('post the form when fromRel is not edit-form', function(){
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.5
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-24 00:00:00.000000000 Z
12
+ date: 2013-07-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails