fix 2 bugs on develop (#565)

* fix js bug

* if mappable is nil it causes an error
This commit is contained in:
Devin Howard 2016-07-02 16:32:02 +08:00 committed by GitHub
parent 872ae90832
commit 27942546b8
3 changed files with 8 additions and 9 deletions

View file

@ -320,5 +320,3 @@ Metamaps.Import = {
Metamaps.Synapse.renderSynapse(mapping, synapse, node1, node2, true)
}
}
module.exports = Metamaps.Import

View file

@ -1,11 +1,12 @@
var chai = require('chai')
var expect = chai.expect
/* global describe, it */
const chai = require('chai')
const expect = chai.expect
Metamaps = {}
Metamaps.Import = require('../src/Metamaps.Import')
const Metamaps = {}
require('../src/Metamaps.Import')
describe('Metamaps.Import.js', function() {
it('has a topic whitelist', function() {
describe('Metamaps.Import.js', function () {
it('has a topic whitelist', function () {
expect(Metamaps.Import.topicWhitelist).to.deep.equal(
['id', 'name', 'metacode', 'x', 'y', 'description', 'link', 'permission']
)

View file

@ -16,7 +16,7 @@ class MappingPolicy < ApplicationPolicy
end
def show?
map_policy.show? && mappable_policy.show?
map_policy.show? && mappable_policy.try(:show?)
end
def create?