summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authormo k <mo@mokhan.ca>2012-09-18 16:44:54 -0600
committermo k <mo@mokhan.ca>2012-09-18 16:44:54 -0600
commit76db9fbf337b8b774e069021c682b3e2e6439eec (patch)
tree65619cdc26003bdca8c6d2ff3e96b43f3e0a7b28 /spec/javascripts
parentdd37d9e50866c936559659b02544553c53c66f1f (diff)
when a url is entered look up info on it.
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/presenters/new_tutorial_presenter_spec.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/javascripts/presenters/new_tutorial_presenter_spec.js b/spec/javascripts/presenters/new_tutorial_presenter_spec.js
index 52ed7300..a74c4ec1 100644
--- a/spec/javascripts/presenters/new_tutorial_presenter_spec.js
+++ b/spec/javascripts/presenters/new_tutorial_presenter_spec.js
@@ -5,11 +5,17 @@ describe ("NewTutorialPresenter", function() {
tag_list: $('<ul id="tag-list">'),
tag_input: $('<input type="text" />'),
hidden_tag_list: $('<input type="hidden" />'),
+ url_input: $('<input type="text" />')
};
- sut = new NewTutorialPresenter(view);
+ service = {
+ retrieve_info_on:null
+ };
+ sut = new NewTutorialPresenter(view, service);
});
var sut;
var view;
+ var service;
+
describe ("when the add tag button is clicked", function() {
it ("should add the new tag to the list of tags", function() {
expect(view.tag_list.html()).toEqual('<a href="tags/"><span class="label">ruby</span></a>');
@@ -35,4 +41,17 @@ describe ("NewTutorialPresenter", function() {
view.add_tag_button.trigger('click');
});
});
+ describe ("when a url is entered", function() {
+ it ("should connect to embedly to retrieve information about the url", function() {
+ expect(service.retrieve_info_on).toHaveBeenCalledWith(url, sut.display_url_info);
+ });
+ beforeEach (function() {
+ spyOn(service, 'retrieve_info_on');
+ sut.present();
+ url = 'http://mokhan.ca/';
+ view.url_input.val(url);
+ view.url_input.trigger('change');
+ });
+ var url;
+ });
});