summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-22 10:24:07 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-22 10:24:07 +0200
commitbcba311485074e75ad62f338cc8159bf99522fab (patch)
tree56d011f2a48c87e9e727c016d31f14ee47da83e1 /js/tests
parent5f71477e1a8ac9704e5c580a5bb5d8d820a43a19 (diff)
add http:// to feed url if its not specified, fix #111 and fix #61
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/services/businesslayer/feedbusinesslayerSpec.coffee22
1 files changed, 15 insertions, 7 deletions
diff --git a/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee b/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
index d14d50b8d..2bb37c023 100644
--- a/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
+++ b/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
@@ -243,7 +243,7 @@ describe 'FeedBusinessLayer', ->
it 'should not create a feed if it already exists', =>
- item1 = {url: 'john'}
+ item1 = {url: 'http://john'}
@FeedModel.add(item1)
expect =>
@@ -266,24 +266,32 @@ describe 'FeedBusinessLayer', ->
expect(@FeedModel.size()).toBe(1)
- it 'should set a title and an url hash to the newly crated feed', =>
+ it 'should set a title and an url to the newly created feed', =>
url = 'www.google.de'
@FeedBusinessLayer.create(url)
- feed = @FeedModel.getByUrl(url)
+ feed = @FeedModel.getByUrl('http://' + url)
- expect(feed.title).toBe('www.google.de')
- expect(feed.url).toBe(url)
+ expect(feed.title).toBe('http://www.google.de')
+ expect(feed.url).toBe('http://' + url)
expect(feed.folderId).toBe(0)
expect(feed.unreadCount).toBe(0)
expect(@imagePath).toHaveBeenCalledWith('core', 'loading.gif')
+ it 'should not add http when it already is at the start of created feed', =>
+ url = 'https://www.google.de'
+ @FeedBusinessLayer.create(url)
+ feed = @FeedModel.getByUrl(url)
+
+ expect(feed.url).toBe(url)
+
+
it 'should make a create feed request', =>
@persistence.createFeed = jasmine.createSpy('add feed')
@FeedBusinessLayer.create(' johns ')
- expect(@persistence.createFeed).toHaveBeenCalledWith('johns', 0,
+ expect(@persistence.createFeed).toHaveBeenCalledWith('http://johns', 0,
jasmine.any(Function))
@@ -316,7 +324,7 @@ describe 'FeedBusinessLayer', ->
expect(onSuccess).not.toHaveBeenCalled()
expect(onFailure).toHaveBeenCalled()
- expect(@FeedModel.getByUrl('johns').error).toBe(
+ expect(@FeedModel.getByUrl('http://johns').error).toBe(
@response.msg)