test/unit/angularjs/rails/httpSettingsSpec.js in angularjs-rails-resource-1.0.0 vs test/unit/angularjs/rails/httpSettingsSpec.js in angularjs-rails-resource-1.0.1
- old
+ new
@@ -77,9 +77,29 @@
});
$httpBackend.flush();
}));
+
+ it('query should keep originalData in response if we setted the resource option : fullResponse', inject(function($httpBackend) {
+ var promise, result, Test;
+
+ var originalResponse = {tests: [{id: 1, name:"test_1"}, {id:2, name: "test_2"}], page: 1}
+
+ $httpBackend.expectGET('/test', headerComparison({'Accept': 'application/json'})).respond(200, originalResponse);
+
+ Test = factory(angular.extend(angular.copy(config), { fullResponse: true}));
+ expect(promise = Test.query()).toBeDefined();
+
+ promise.then(function (response) {
+ result = response;
+ expect(response.originalData).toEqual(originalResponse);
+ });
+
+ $httpBackend.flush();
+ }));
+
+
it('get should pass default $http options', inject(function($httpBackend) {
var promise, result, Test;
$httpBackend.expectGET('/test/123', headerComparison({'Accept': 'application/json'})).respond(200, {test: {abc: 'xyz'}});
\ No newline at end of file