diff options
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/fixtures/raw.rb | 24 | ||||
-rw-r--r-- | spec/javascripts/notebook/cells/code_spec.js | 6 | ||||
-rw-r--r-- | spec/javascripts/notebook/cells/markdown_spec.js | 8 | ||||
-rw-r--r-- | spec/javascripts/notebook/cells/output/index_spec.js | 6 | ||||
-rw-r--r-- | spec/javascripts/notebook/index_spec.js | 9 |
5 files changed, 47 insertions, 6 deletions
diff --git a/spec/javascripts/fixtures/raw.rb b/spec/javascripts/fixtures/raw.rb new file mode 100644 index 00000000000..1ce622fc836 --- /dev/null +++ b/spec/javascripts/fixtures/raw.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe 'Raw files', '(JavaScript fixtures)', type: :controller do + include JavaScriptFixturesHelpers + + let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} + let(:project) { create(:project, namespace: namespace, path: 'raw-project') } + + before(:all) do + clean_frontend_fixtures('blob/notebook/') + end + + it 'blob/notebook/basic.json' do |example| + blob = project.repository.blob_at('6d85bb69', 'files/ipython/basic.ipynb') + + store_frontend_fixture(blob.data, example.description) + end + + it 'blob/notebook/worksheets.json' do |example| + blob = project.repository.blob_at('6d85bb69', 'files/ipython/worksheets.ipynb') + + store_frontend_fixture(blob.data, example.description) + end +end diff --git a/spec/javascripts/notebook/cells/code_spec.js b/spec/javascripts/notebook/cells/code_spec.js index e1df98b70ba..0c432d73f67 100644 --- a/spec/javascripts/notebook/cells/code_spec.js +++ b/spec/javascripts/notebook/cells/code_spec.js @@ -1,11 +1,15 @@ import Vue from 'vue'; import CodeComponent from '~/notebook/cells/code.vue'; -import json from '../../fixtures/notebook/file.json'; const Component = Vue.extend(CodeComponent); describe('Code component', () => { let vm; + let json; + + beforeEach(() => { + json = getJSONFixture('blob/notebook/basic.json'); + }); describe('without output', () => { beforeEach((done) => { diff --git a/spec/javascripts/notebook/cells/markdown_spec.js b/spec/javascripts/notebook/cells/markdown_spec.js index 5c11272e7e0..38c976f38d8 100644 --- a/spec/javascripts/notebook/cells/markdown_spec.js +++ b/spec/javascripts/notebook/cells/markdown_spec.js @@ -1,14 +1,18 @@ import Vue from 'vue'; import MarkdownComponent from '~/notebook/cells/markdown.vue'; -import json from '../../fixtures/notebook/file.json'; -const cell = json.cells[1]; const Component = Vue.extend(MarkdownComponent); describe('Markdown component', () => { let vm; + let cell; + let json; beforeEach((done) => { + json = getJSONFixture('blob/notebook/basic.json'); + + cell = json.cells[1]; + vm = new Component({ propsData: { cell, diff --git a/spec/javascripts/notebook/cells/output/index_spec.js b/spec/javascripts/notebook/cells/output/index_spec.js index 7fe8d227f05..dbf79f85c7c 100644 --- a/spec/javascripts/notebook/cells/output/index_spec.js +++ b/spec/javascripts/notebook/cells/output/index_spec.js @@ -1,11 +1,11 @@ import Vue from 'vue'; import CodeComponent from '~/notebook/cells/output/index.vue'; -import json from '../../../fixtures/notebook/file.json'; const Component = Vue.extend(CodeComponent); describe('Output component', () => { let vm; + let json; const createComponent = (output) => { vm = new Component({ @@ -17,6 +17,10 @@ describe('Output component', () => { vm.$mount(); }; + beforeEach(() => { + json = getJSONFixture('blob/notebook/basic.json'); + }); + describe('text output', () => { beforeEach((done) => { createComponent(json.cells[2].outputs[0]); diff --git a/spec/javascripts/notebook/index_spec.js b/spec/javascripts/notebook/index_spec.js index 87f18b98342..bd63ab35426 100644 --- a/spec/javascripts/notebook/index_spec.js +++ b/spec/javascripts/notebook/index_spec.js @@ -1,12 +1,17 @@ import Vue from 'vue'; import Notebook from '~/notebook/index.vue'; -import json from '../fixtures/notebook/file.json'; -import jsonWithWorksheet from '../fixtures/notebook/worksheets.json'; const Component = Vue.extend(Notebook); describe('Notebook component', () => { let vm; + let json; + let jsonWithWorksheet; + + beforeEach(() => { + json = getJSONFixture('blob/notebook/basic.json'); + jsonWithWorksheet = getJSONFixture('blob/notebook/worksheets.json'); + }); describe('without JSON', () => { beforeEach((done) => { |