Skip to content

Commit

Permalink
minor change in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shekharrajak committed Jun 4, 2017
1 parent 9c24858 commit 7900453
Showing 1 changed file with 39 additions and 41 deletions.
80 changes: 39 additions & 41 deletions spec/iruby_notebook_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
require File.dirname(__FILE__) + '/spec_helper'
require 'iruby'
require 'iruby'

describe LazyHighCharts do

# Tell the name of new JS extension library to highcharts.js
context ".add_extension" do
it "should add extension name to lists" do
LazyHighCharts.add_extension("Hoge")
expect(LazyHighCharts.extension_lists.index("Hoge").nil?).to eq(false)
end
end
# # Tell the name of new JS extension library to highcharts.js
# context ".add_extension" do
# it "should add extension name to lists" do
# LazyHighCharts.add_extension("Hoge")
# expect(LazyHighCharts.extension_lists.index("Hoge").nil?).to eq(false)
# end
# end

# Add extension libraries loaded before LazyHighCharts.js
context ".add_dependency" do
Expand All @@ -37,43 +35,43 @@ module LazyHighCharts
end


describe '.load_notebook' do
shared_examples 'inline script' do
it 'loads javascript sources as inline script' do
expect(IRuby).to receive(:display) do |rep|
expect(rep).to be_kind_of(IRuby::Display::Representation)
expect(rep.options[:mime]).to eq('application/javascript')
# describe '.load_notebook' do
# shared_examples 'inline script' do
# it 'loads javascript sources as inline script' do
# expect(IRuby).to receive(:display) do |rep|
# expect(rep).to be_kind_of(IRuby::Display::Representation)
# expect(rep.options[:mime]).to eq('application/javascript')

# highcharts.js
expect(rep.object).to match(/this\.highcharts=/)
end
expect(load_notebook).to eq(nil)
end
end
# # highcharts.js
# expect(rep.object).to match(/this\.highcharts=/)
# end
# expect(load_notebook).to eq(nil)
# end
# end

context 'without parameters' do
subject(:load_notebook) { LazyHighCharts.load_notebook }
# context 'without parameters' do
# subject(:load_notebook) { LazyHighCharts.load_notebook }

include_examples 'inline script'
end
# include_examples 'inline script'
# end

context 'given `assets` parameter is `:inline`' do
subject(:load_notebook) { LazyHighCharts.load_notebook(:inline) }
# context 'given `assets` parameter is `:inline`' do
# subject(:load_notebook) { LazyHighCharts.load_notebook(:inline) }

include_examples 'inline script'
end
# include_examples 'inline script'
# end

context 'given `assets` parameter is `:cdn`' do
subject(:load_notebook) { LazyHighCharts.load_notebook(:cdn) }
# context 'given `assets` parameter is `:cdn`' do
# subject(:load_notebook) { LazyHighCharts.load_notebook(:cdn) }

it 'loads javascript sources from cdn' do
expect(IRuby).to receive(:display) do |rep|
expect(rep).to be_kind_of(IRuby::Display::Representation)
expect(rep.options[:mime]).to eq('application/javascript')
expect(rep.object).to include('http://code.highcharts.com/highcharts.js')
end
expect(load_notebook).to eq(nil)
end
end
end
# it 'loads javascript sources from cdn' do
# expect(IRuby).to receive(:display) do |rep|
# expect(rep).to be_kind_of(IRuby::Display::Representation)
# expect(rep.options[:mime]).to eq('application/javascript')
# expect(rep.object).to include('http://code.highcharts.com/highcharts.js')
# end
# expect(load_notebook).to eq(nil)
# end
# end
# end
end

0 comments on commit 7900453

Please sign in to comment.