summaryrefslogtreecommitdiffstats
path: root/lib/models
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-05-27 09:27:11 +0200
committerSamy Pessé <samypesse@gmail.com>2016-05-27 09:27:11 +0200
commit6def174b845d6dd392c2f1ef41e94b025b774bf8 (patch)
treec2c2825fbf2e504202367c4843fa8c63e5cc4d4e /lib/models
parent346a18b4446060eeb53a0a697fa82f1d13ba6cd2 (diff)
parent465e8d6c0adfe69f696fafa7486541aac55298fe (diff)
downloadgitbook-6def174b845d6dd392c2f1ef41e94b025b774bf8.zip
gitbook-6def174b845d6dd392c2f1ef41e94b025b774bf8.tar.gz
gitbook-6def174b845d6dd392c2f1ef41e94b025b774bf8.tar.bz2
Merge pull request #1334 from ryanswanson/master
Fixed two issues for handling git URLs for plugins
Diffstat (limited to 'lib/models')
-rw-r--r--lib/models/__tests__/pluginDependency.js48
-rw-r--r--lib/models/pluginDependency.js4
2 files changed, 35 insertions, 17 deletions
diff --git a/lib/models/__tests__/pluginDependency.js b/lib/models/__tests__/pluginDependency.js
index 0b105e9..cb04cf2 100644
--- a/lib/models/__tests__/pluginDependency.js
+++ b/lib/models/__tests__/pluginDependency.js
@@ -42,21 +42,39 @@ describe('PluginDependency', function() {
expect(plugin.getVersion()).toBe('git+ssh://samy@github.com/GitbookIO/plugin-ga.git');
});
});
- });
- describe('listToArray', function() {
- var list = PluginDependency.listToArray(Immutable.List([
- PluginDependency.createFromString('hello@1.0.0'),
- PluginDependency.createFromString('noversion'),
- PluginDependency.createFromString('-disabled')
- ]));
-
- expect(list).toEqual([
- 'hello@1.0.0',
- 'noversion',
- '-disabled'
- ]);
- });
-});
+ describe('listToArray', function() {
+ it('must create an array from a list of plugin dependencies', function() {
+ var list = PluginDependency.listToArray(Immutable.List([
+ PluginDependency.createFromString('hello@1.0.0'),
+ PluginDependency.createFromString('noversion'),
+ PluginDependency.createFromString('-disabled')
+ ]));
+
+ expect(list).toEqual([
+ 'hello@1.0.0',
+ 'noversion',
+ '-disabled'
+ ]);
+ });
+ });
+ describe('listFromArray', function() {
+ it('must create an array from a list of plugin dependencies', function() {
+ var arr = Immutable.fromJS([
+ 'hello@1.0.0',
+ {
+ 'name': 'plugin-ga',
+ 'version': 'git+ssh://samy@github.com/GitbookIO/plugin-ga.git'
+ }
+ ]);
+ var list = PluginDependency.listFromArray(arr);
+ expect(list.first().getName()).toBe('hello');
+ expect(list.first().getVersion()).toBe('1.0.0');
+ expect(list.last().getName()).toBe('plugin-ga');
+ expect(list.last().getVersion()).toBe('git+ssh://samy@github.com/GitbookIO/plugin-ga.git');
+ });
+ });
+ });
+});
diff --git a/lib/models/pluginDependency.js b/lib/models/pluginDependency.js
index 3502468..99f6f91 100644
--- a/lib/models/pluginDependency.js
+++ b/lib/models/pluginDependency.js
@@ -95,8 +95,8 @@ PluginDependency.listFromArray = function(arr) {
return PluginDependency.createFromString(entry);
} else {
return PluginDependency({
- name: entry.name,
- version: entry.version
+ name: entry.get('name'),
+ version: entry.get('version')
});
}
})