rubyvis 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +6 -6
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +27 -21
  5. data/History.txt +10 -0
  6. data/lib/rubyvis.rb +1 -4
  7. data/lib/rubyvis/mark/panel.rb +1 -1
  8. data/lib/rubyvis/scene/svg_line.rb +0 -1
  9. data/lib/rubyvis/scene/svg_panel.rb +3 -0
  10. data/lib/rubyvis/scene/svg_rule.rb +0 -1
  11. data/lib/rubyvis/sceneelement.rb +1 -0
  12. data/lib/rubyvis/version.rb +6 -0
  13. data/rubyvis.gemspec +1 -2
  14. data/spec/anchor_spec.rb +11 -11
  15. data/spec/area_spec.rb +10 -10
  16. data/spec/bar_spec.rb +13 -13
  17. data/spec/color_spec.rb +24 -24
  18. data/spec/dom_spec.rb +77 -77
  19. data/spec/dot_spec.rb +3 -3
  20. data/spec/flatten_spec.rb +2 -2
  21. data/spec/histogram_spec.rb +5 -5
  22. data/spec/image_spec.rb +2 -2
  23. data/spec/internal_spec.rb +58 -58
  24. data/spec/javascript_behaviour_spec.rb +14 -14
  25. data/spec/label_spec.rb +9 -9
  26. data/spec/layout_arc_spec.rb +5 -5
  27. data/spec/layout_cluster_spec.rb +4 -4
  28. data/spec/layout_grid_spec.rb +5 -5
  29. data/spec/layout_horizon_spec.rb +5 -5
  30. data/spec/layout_indent_spec.rb +3 -3
  31. data/spec/layout_matrix_spec.rb +6 -6
  32. data/spec/layout_pack_spec.rb +2 -2
  33. data/spec/layout_partition_spec.rb +4 -4
  34. data/spec/layout_stack_spec.rb +11 -11
  35. data/spec/layout_tree_spec.rb +4 -4
  36. data/spec/layout_treemap_spec.rb +2 -2
  37. data/spec/line_spec.rb +14 -14
  38. data/spec/mark_spec.rb +7 -7
  39. data/spec/nest_spec.rb +3 -3
  40. data/spec/panel_spec.rb +10 -10
  41. data/spec/readme_spec.rb +6 -6
  42. data/spec/ruby_api_spec.rb +4 -4
  43. data/spec/rule_spec.rb +3 -3
  44. data/spec/scale_linear_datetime_spec.rb +23 -23
  45. data/spec/scale_linear_spec.rb +37 -37
  46. data/spec/scale_log_spec.rb +28 -28
  47. data/spec/scale_ordinal_spec.rb +21 -21
  48. data/spec/scale_spec.rb +2 -2
  49. data/spec/spec_helper.rb +6 -5
  50. data/spec/vector_spec.rb +8 -8
  51. data/spec/wedge_spec.rb +4 -4
  52. data/web/build_site.rb +1 -1
  53. metadata +4 -4
@@ -2,24 +2,24 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe "Javascript compatibility" do
3
3
  it "extends Proc with js_apply and js_call" do
4
4
  f=lambda {|a,b| a+b}
5
- f.should respond_to(:js_apply)
6
- f.should respond_to(:js_call)
5
+ expect(f).to respond_to(:js_apply)
6
+ expect(f).to respond_to(:js_call)
7
7
  end
8
8
  it "lambdas should respond correctly to js_call with same numbers of arguments and parameters" do
9
9
  o=OpenStruct.new :x=>15
10
10
  f=lambda {|m1,m2| "#{m1}-#{m2}-#{self.x}"}
11
- f.js_call(o,"a","b").should=="a-b-15"
11
+ expect(f.js_call(o,"a","b")).to eq("a-b-15")
12
12
  end
13
13
  it "lambdas should respond correctly to js_call without arguments" do
14
14
  o=OpenStruct.new :x=>15
15
15
  f=lambda { self.x.to_s}
16
- f.js_call(o).should=="15"
16
+ expect(f.js_call(o)).to eq("15")
17
17
  end
18
18
  it "lambdas should respond correctly to js_call with different number or arguments" do
19
19
  o=OpenStruct.new :x=>15
20
20
  f=lambda {|a,b,c| [a,b,c]}
21
- f.js_call(o,1).should==[1,nil,nil]
22
- f.js_call(o,1,2,3,4).should==[1,2,3]
21
+ expect(f.js_call(o,1)).to eq([1,nil,nil])
22
+ expect(f.js_call(o,1,2,3,4)).to eq([1,2,3])
23
23
  end
24
24
  context "js_call using lambda with variable arguments" do
25
25
  before do
@@ -27,37 +27,37 @@ describe "Javascript compatibility" do
27
27
  @f=lambda {|a,b,*c| {:a=>a, :b=>b, :c=>c}}
28
28
  end
29
29
  it "should work without 0 parameters" do
30
- @f.js_call(@o).should=={:a=>nil, :b=>nil, :c=>[]}
30
+ expect(@f.js_call(@o)).to eq({:a=>nil, :b=>nil, :c=>[]})
31
31
  end
32
32
  it "should work with required parameter and 0 optional" do
33
- @f.js_call(@o,1,2).should=={:a=>1, :b=>2, :c=>[]}
33
+ expect(@f.js_call(@o,1,2)).to eq({:a=>1, :b=>2, :c=>[]})
34
34
  end
35
35
  it "should work with required and optional parameters" do
36
- @f.js_call(@o,1,2,3,4).should=={:a=>1, :b=>2, :c=>[3,4]}
36
+ expect(@f.js_call(@o,1,2,3,4)).to eq({:a=>1, :b=>2, :c=>[3,4]})
37
37
  end
38
38
  end
39
39
  it "lambdas should respond correctly to js_apply" do
40
40
  o=OpenStruct.new :x=>15
41
41
  f=lambda {|m1,m2| "#{m1}-#{m2}-#{self.x}"}
42
- f.js_apply(o, ["a","b"]).should=="a-b-15"
42
+ expect(f.js_apply(o, ["a","b"])).to eq("a-b-15")
43
43
  end
44
44
  it "lambdas should respond correctly to js_apply with empty arguments" do
45
45
  o=OpenStruct.new :x=>15
46
46
  f=lambda { "#{self.x}"}
47
- f.js_apply(o, []).should=="15"
48
- f.js_apply(o, [1]).should=="15"
47
+ expect(f.js_apply(o, [])).to eq("15")
48
+ expect(f.js_apply(o, [1])).to eq("15")
49
49
 
50
50
  end
51
51
 
52
52
  it "lambdas should respond correctly to js_call with fewer parameters" do
53
53
  o=OpenStruct.new :x=>15
54
54
  f=lambda {|a,b,c| [a,b,c]}
55
- f.js_apply(o,[1]).should==[1,nil,nil]
55
+ expect(f.js_apply(o,[1])).to eq([1,nil,nil])
56
56
  end
57
57
  it "lambdas should respond correctly to js_call with more parameters" do
58
58
  o=OpenStruct.new :x=>15
59
59
  f=lambda {|a,b,c| [a,b,c]}
60
- f.js_apply(o,[1,2,3,4]).should==[1,2,3]
60
+ expect(f.js_apply(o,[1,2,3,4])).to eq([1,2,3])
61
61
  end
62
62
 
63
63
 
@@ -3,16 +3,16 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
3
3
  it "should have correct properties" do
4
4
  props=[:antialias, :bottom, :cursor, :data, :events, :font, :font_family, :font_style, :font_variant, :font_weight, :font_size, :id, :left, :reverse, :right, :text, :text_align, :text_angle, :text_baseline, :text_decoration, :text_margin, :text_shadow, :text_style, :title, :top, :visible].inject({}) {|ac, v| ac[v]=true; ac}
5
5
 
6
- Rubyvis::Label.properties.should==props
6
+ expect(Rubyvis::Label.properties).to eq(props)
7
7
  end
8
8
  it "should return correct defaults" do
9
9
  props=Rubyvis::Bar.defaults._properties
10
- props.size.should==2
11
- props[0].name.should==:line_width
12
- props[0].value.should==1.5
13
- props[1].name.should==:fill_style
14
- props[1].value.should be_instance_of Proc
15
- Rubyvis::Bar.defaults.proto.should be_instance_of Rubyvis::Mark
10
+ expect(props.size).to eq(2)
11
+ expect(props[0].name).to eq(:line_width)
12
+ expect(props[0].value).to eq(1.5)
13
+ expect(props[1].name).to eq(:fill_style)
14
+ expect(props[1].value).to be_instance_of Proc
15
+ expect(Rubyvis::Bar.defaults.proto).to be_instance_of Rubyvis::Mark
16
16
 
17
17
  end
18
18
  context "on a Panel" do
@@ -30,7 +30,7 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
30
30
  s=@vis.to_svg
31
31
  doc=Nokogiri::XML(s)
32
32
  #p doc.at_xpath("//xmlns:text")
33
- doc.at_xpath("//xmlns:text").attributes['style'].value.should=='font-size:20px'
33
+ expect(doc.at_xpath("//xmlns:text").attributes['style'].value).to eq('font-size:20px')
34
34
  end
35
35
 
36
36
  it "should bould basic stuff properly " do
@@ -44,7 +44,7 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
44
44
 
45
45
  attribs=doc.xpath("//xmlns:text").map {|v|
46
46
  [v.attributes['y'].value, v.attributes['transform'].value, v.text] }
47
- attribs.should==[["-3","translate(0,100)","1"],["-3","translate(25,100)","2"]]
47
+ expect(attribs).to eq([["-3","translate(0,100)","1"],["-3","translate(25,100)","2"]])
48
48
  end
49
49
 
50
50
  end
@@ -2,11 +2,11 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Layout::Arc do
3
3
  include Rubyvis::LayoutSpec
4
4
  it "should have correct properties" do
5
- props=[:antialias, :bottom, :canvas, :cursor, :data, :directed, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :orient, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
+ props=[:antialias, :bottom, :canvas, :cursor, :data, :directed, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :orient, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
6
  Rubyvis::Layout::Arc.properties.should==props
7
7
  end
8
8
  it "should be called using Rubyvis.Layout.Arc" do
9
- Rubyvis.Layout.Arc.should eql Rubyvis::Layout::Arc
9
+ expect(Rubyvis.Layout.Arc).to eql Rubyvis::Layout::Arc
10
10
  end
11
11
  describe "rendered" do
12
12
  before do
@@ -49,18 +49,18 @@ describe Rubyvis::Layout::Arc do
49
49
 
50
50
  it "should render correct number of clipaths" do
51
51
 
52
- @rv_svg.xpath("//xmlns:path").size.should eq @pv_svg.xpath("//path").size
52
+ expect(@rv_svg.xpath("//xmlns:path").size).to eq @pv_svg.xpath("//path").size
53
53
  end
54
54
  it "should render equal paths (links)" do
55
55
  pv_paths=@pv_svg.xpath("//path")
56
56
  @rv_svg.xpath("//xmlns:path").each_with_index {|rv_path,i|
57
- rv_path.should have_path_data_close_to pv_paths[i]['d']
57
+ expect(rv_path).to have_path_data_close_to pv_paths[i]['d']
58
58
  }
59
59
  end
60
60
  it "should render equal dots (nodes)" do
61
61
  pv_circles=@pv_svg.xpath("//circle")
62
62
  @rv_svg.xpath("//xmlns:circle").each_with_index {|rv_circle,i|
63
- rv_circle.should have_same_position pv_circles[i]
63
+ expect(rv_circle).to have_same_position pv_circles[i]
64
64
  }
65
65
 
66
66
  end
@@ -2,11 +2,11 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Layout::Cluster do
3
3
  include Rubyvis::LayoutSpec
4
4
  it "should have correct properties" do
5
- props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style,:group, :height, :id, :inner_radius, :left, :line_width, :links, :nodes, :orient, :outer_radius, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
+ props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style,:group, :height, :id, :inner_radius, :left, :line_width, :links, :nodes, :orient, :outer_radius, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
6
  Rubyvis::Layout::Cluster.properties.should==props
7
7
  end
8
8
  it "should be called using Rubyvis.Layout.Cluster" do
9
- Rubyvis.Layout.Cluster.should eql Rubyvis::Layout::Cluster
9
+ expect(Rubyvis.Layout.Cluster).to eql Rubyvis::Layout::Cluster
10
10
  end
11
11
  describe "html tests" do
12
12
 
@@ -41,13 +41,13 @@ describe Rubyvis::Layout::Cluster do
41
41
  @vis.render
42
42
  @pv_out=fixture_svg_read("layout_cluster.svg")
43
43
  File.open("test.svg","w") {|fp| fp.write(@vis.to_svg)}
44
- @vis.to_svg.should have_same_svg_elements(@pv_out)
44
+ expect(@vis.to_svg).to have_same_svg_elements(@pv_out)
45
45
  end
46
46
  it "should render correctly 'cluster_left_group_2.html' custom test" do
47
47
  @cluster.orient("left").group(2)
48
48
  @vis.render
49
49
  @pv_out=fixture_svg_read("layout_cluster_left_group_2.svg")
50
- @vis.to_svg.should have_same_svg_elements(@pv_out)
50
+ expect(@vis.to_svg).to have_same_svg_elements(@pv_out)
51
51
  end
52
52
  end
53
53
  end
@@ -2,11 +2,11 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Layout::Grid do
3
3
  include Rubyvis::LayoutSpec
4
4
  it "should have correct properties" do
5
- props=[:antialias, :bottom, :canvas, :cols, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :overflow, :reverse, :right, :rows, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
+ props=[:antialias, :bottom, :canvas, :cols, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :overflow, :reverse, :right, :rows, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
6
  Rubyvis::Layout::Grid.properties.should==props
7
7
  end
8
8
  it "Rubyvis.Layout.Grid be the same as Rubyvis::Layout::Grid" do
9
- Rubyvis.Layout.Grid.should eql Rubyvis::Layout::Grid
9
+ expect(Rubyvis.Layout.Grid).to eql Rubyvis::Layout::Grid
10
10
  end
11
11
  it "should render equal to protovis 'layout_grid.html' test" do
12
12
 
@@ -30,11 +30,11 @@ describe Rubyvis::Layout::Grid do
30
30
  textStyle("rgba(255, 255, 255, .4)").
31
31
  font("24px sans");
32
32
 
33
- vis.render();
33
+ vis.render
34
34
 
35
35
 
36
36
  pv_out=fixture_svg_read("layout_grid.svg")
37
- vis.to_svg.should have_same_svg_elements(pv_out)
37
+ expect(vis.to_svg).to have_same_svg_elements(pv_out)
38
38
  end
39
39
 
40
- end
40
+ end
@@ -3,11 +3,11 @@ describe Rubyvis::Layout::Horizon do
3
3
  include Rubyvis::LayoutSpec
4
4
 
5
5
  it "should have correct properties" do
6
- props=[:antialias, :background_style, :bands, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :mode, :negative_style, :overflow, :positive_style, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
+ props=[:antialias, :background_style, :bands, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :mode, :negative_style, :overflow, :positive_style, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
7
7
  Rubyvis::Layout::Horizon.properties.should==props
8
8
  end
9
9
  it "should be called using Rubyvis.Layout.Horizon" do
10
- Rubyvis.Layout.Horizon.should eql Rubyvis::Layout::Horizon
10
+ expect(Rubyvis.Layout.Horizon).to eql Rubyvis::Layout::Horizon
11
11
  end
12
12
  describe "rendered" do
13
13
  before do
@@ -46,13 +46,13 @@ describe Rubyvis::Layout::Horizon do
46
46
 
47
47
  it "should render correct number of clipaths" do
48
48
 
49
- @rv_svg.xpath("//xmlns:clipPath[@id]").size.should eq @pv_svg.xpath("//clippath[@id]").size
49
+ expect(@rv_svg.xpath("//xmlns:clipPath[@id]").size).to eq @pv_svg.xpath("//clippath[@id]").size
50
50
  end
51
51
  it "should render equal paths" do
52
52
  pv_paths=@pv_svg.xpath("//path")
53
53
  @rv_svg.xpath("//xmlns:path").each_with_index {|rv_path,i|
54
- rv_path.should have_path_data_close_to pv_paths[i]['d']
55
- rv_path['fill'].should eq pv_paths[i]['fill']
54
+ expect(rv_path).to have_path_data_close_to pv_paths[i]['d']
55
+ expect(rv_path['fill']).to eq pv_paths[i]['fill']
56
56
  }
57
57
  end
58
58
  end
@@ -2,11 +2,11 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Layout::Indent do
3
3
  include Rubyvis::LayoutSpec
4
4
  it "should have correct properties" do
5
- props=[:antialias, :bottom, :breadth, :canvas, :cursor, :data, :depth, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
+ props=[:antialias, :bottom, :breadth, :canvas, :cursor, :data, :depth, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
6
  Rubyvis::Layout::Indent.properties.should==props
7
7
  end
8
8
  it "should be called using Rubyvis.Layout.Indent" do
9
- Rubyvis.Layout.Indent.should eql Rubyvis::Layout::Indent
9
+ expect(Rubyvis.Layout.Indent).to eql Rubyvis::Layout::Indent
10
10
  end
11
11
  describe "rendered" do
12
12
  before do
@@ -45,7 +45,7 @@ describe Rubyvis::Layout::Indent do
45
45
  it "should render equal nodes (circles)" do
46
46
  pv_rects=@pv_svg.xpath("//circle")
47
47
  @rv_svg.xpath("//xmlns:circle").each_with_index {|rv_rect,i|
48
- rv_rect.should have_same_position pv_rects[i]
48
+ expect(rv_rect).to have_same_position pv_rects[i]
49
49
  }
50
50
 
51
51
  end
@@ -3,7 +3,7 @@ describe Rubyvis::Layout::Matrix do
3
3
  include Rubyvis::LayoutSpec
4
4
 
5
5
  it "should have correct properties" do
6
- props=[:antialias, :bottom, :canvas, :cursor, :data, :directed, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
+ props=[:antialias, :bottom, :canvas, :cursor, :data, :directed, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
7
7
  Rubyvis::Layout::Matrix.properties.should==props
8
8
  end
9
9
  describe "rendered" do
@@ -19,9 +19,9 @@ describe Rubyvis::Layout::Matrix do
19
19
  left(50)
20
20
 
21
21
  mat=@vis.add(Rubyvis::Layout.Matrix).
22
- directed(true).
23
- nodes(net_nodes).links(net_links).
24
- sort(lambda {|a,b| a.group<=>b.group})
22
+ directed(true).
23
+ nodes(net_nodes).links(net_links).
24
+ sort(lambda {|a,b| a.group<=>b.group})
25
25
 
26
26
  mat.link.add(pv.Bar).
27
27
  fill_style(lambda {|l| l.link_value!=0 ?
@@ -38,12 +38,12 @@ sort(lambda {|a,b| a.group<=>b.group})
38
38
  end
39
39
 
40
40
  it "should render correct number of rects(links)" do
41
- @rv_svg.xpath("//xmlns:rect").size.should eq @pv_svg.xpath("//rect").size
41
+ expect(@rv_svg.xpath("//xmlns:rect").size).to eq @pv_svg.xpath("//rect").size
42
42
  end
43
43
  it "should render equal intersections (links)" do
44
44
  pv_rects=@pv_svg.xpath("//rect")
45
45
  @rv_svg.xpath("//xmlns:rect").each_with_index {|rv_rect,i|
46
- rv_rect.should have_same_position pv_rects[i]
46
+ expect(rv_rect).to have_same_position pv_rects[i]
47
47
  }
48
48
 
49
49
  end
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Layout::Pack do
3
3
  include Rubyvis::LayoutSpec
4
4
  it "should have correct properties" do
5
- props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :order, :overflow, :reverse, :right, :spacing, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
+ props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :order, :overflow, :reverse, :right, :spacing, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
6
  Rubyvis::Layout::Pack.properties.should==props
7
7
  end
8
8
  describe "rendered" do
@@ -41,7 +41,7 @@ describe Rubyvis::Layout::Pack do
41
41
  it "should render equal nodes (circles)" do
42
42
  pv_rects=@pv_svg.xpath("//circle")
43
43
  @rv_svg.xpath("//xmlns:circle").each_with_index {|rv_rect,i|
44
- rv_rect.should have_same_position pv_rects[i]
44
+ expect(rv_rect).to have_same_position pv_rects[i]
45
45
  }
46
46
 
47
47
  end
@@ -2,11 +2,11 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Layout::Partition do
3
3
  include Rubyvis::LayoutSpec
4
4
  it "subclass Fill should have correct properties" do
5
- props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :inner_radius, :left, :line_width, :links, :nodes, :order, :orient, :outer_radius, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
- Rubyvis::Layout::Partition::Fill.properties.should==props
5
+ props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :inner_radius, :left, :line_width, :links, :nodes, :order, :orient, :outer_radius, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :view_box, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
+ expect(Rubyvis::Layout::Partition::Fill.properties).to eq(props)
7
7
  end
8
8
  it "should be called using Rubyvis.Layout.Partition" do
9
- Rubyvis.Layout.Partition.should eql Rubyvis::Layout::Partition
9
+ expect(Rubyvis.Layout.Partition).to eql Rubyvis::Layout::Partition
10
10
  end
11
11
  it "should render correctly 'partition_fill' custom test" do
12
12
  color=pv.Colors.category19
@@ -39,7 +39,7 @@ left(10)
39
39
 
40
40
  @vis.render
41
41
  @pv_out=fixture_svg_read("layout_partition_fill.svg")
42
- @vis.to_svg.should have_same_svg_elements(@pv_out)
42
+ expect(@vis.to_svg).to have_same_svg_elements(@pv_out)
43
43
  end
44
44
 
45
45
  end
@@ -2,11 +2,11 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Layout::Stack do
3
3
  include Rubyvis::LayoutSpec
4
4
  it "should have correct properties" do
5
- props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :layers, :left, :line_width, :offset, :order, :orient, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
+ props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :layers, :left, :line_width, :offset, :order, :orient, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
6
  Rubyvis::Layout::Stack.properties.should==props
7
7
  end
8
8
  it "Rubyvis.Dot be the same as Rubyvis::Dot" do
9
- Rubyvis.Layout.Stack.should eql Rubyvis::Layout::Stack
9
+ expect(Rubyvis.Layout.Stack).to eql Rubyvis::Layout::Stack
10
10
  end
11
11
  describe "html examples" do
12
12
  before do
@@ -40,7 +40,7 @@ describe Rubyvis::Layout::Stack do
40
40
  offset("expand")
41
41
  @vis.render()
42
42
  pv_out=fixture_svg_read("stack_expand.svg")
43
- @vis.to_svg.should have_same_svg_elements(pv_out)
43
+ expect(@vis.to_svg).to have_same_svg_elements(pv_out)
44
44
  end
45
45
  it "should render 'stack-silohouette.html' example correctly" do
46
46
  y=@y
@@ -50,7 +50,7 @@ describe Rubyvis::Layout::Stack do
50
50
 
51
51
  @vis.render()
52
52
  pv_out=fixture_svg_read("stack_silohouette.svg")
53
- @vis.to_svg.should have_same_svg_elements(pv_out)
53
+ expect(@vis.to_svg).to have_same_svg_elements(pv_out)
54
54
  end
55
55
  it "should render 'stack-wiggle.html' example correctly" do
56
56
  y=@y
@@ -60,7 +60,7 @@ describe Rubyvis::Layout::Stack do
60
60
 
61
61
  @vis.render()
62
62
  pv_out=fixture_svg_read("stack_wiggle.svg")
63
- @vis.to_svg.should have_same_svg_elements(pv_out)
63
+ expect(@vis.to_svg).to have_same_svg_elements(pv_out)
64
64
  end
65
65
 
66
66
  end
@@ -90,13 +90,13 @@ describe Rubyvis::Layout::Stack do
90
90
  # <svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="200" height="200"><g><g><g><path d="M0,180L66.66666666666666,140L133.33333333333331,160L133.33333333333331,200L66.66666666666666,200L0,200Z" fill="rgb(31,119,180)"/></g><g><path d="M0,140L66.66666666666666,120L133.33333333333331,100L133.33333333333331,160L66.66666666666666,140L0,180Z" fill="rgb(174,199,232)"/></g></g></g></svg>
91
91
  end
92
92
  it "should return correct number of areas" do
93
- @paths.size.should eq 2
93
+ expect(@paths.size).to eq 2
94
94
  end
95
95
  it "should return correct path 1" do
96
- @paths[0].should have_path_data_close_to "M0 180L66.66666666666666 140L133.33333333333331 160L133.33333333333331 200L66.66666666666666 200L0 200Z"
96
+ expect(@paths[0]).to have_path_data_close_to "M0 180L66.66666666666666 140L133.33333333333331 160L133.33333333333331 200L66.66666666666666 200L0 200Z"
97
97
  end
98
98
  it "should return correct path 2" do
99
- @paths[1].should have_path_data_close_to "M0 140L66.66666666666666 120L133.33333333333331 100L133.33333333333331 160L66.66666666666666 140L0 180Z"
99
+ expect(@paths[1]).to have_path_data_close_to "M0 140L66.66666666666666 120L133.33333333333331 100L133.33333333333331 160L66.66666666666666 140L0 180Z"
100
100
  end
101
101
  end
102
102
  describe "using layers() and values()" do
@@ -114,13 +114,13 @@ describe Rubyvis::Layout::Stack do
114
114
  # <svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="200" height="200"><g><g><g><path d="M0,180L66.66666666666666,140L133.33333333333331,160L133.33333333333331,200L66.66666666666666,200L0,200Z" fill="rgb(31,119,180)"/></g><g><path d="M0,140L66.66666666666666,120L133.33333333333331,100L133.33333333333331,160L66.66666666666666,140L0,180Z" fill="rgb(174,199,232)"/></g></g></g></svg>
115
115
  end
116
116
  it "should return correct number of areas" do
117
- @paths.size.should eq 2
117
+ expect(@paths.size).to eq 2
118
118
  end
119
119
  it "should return correct path 1" do
120
- @paths[0].should have_path_data_close_to "M0 180L66.66666666666666 140L133.33333333333331 160L133.33333333333331 200L66.66666666666666 200L0 200Z"
120
+ expect(@paths[0]).to have_path_data_close_to "M0 180L66.66666666666666 140L133.33333333333331 160L133.33333333333331 200L66.66666666666666 200L0 200Z"
121
121
  end
122
122
  it "should return correct path 2" do
123
- @paths[1].should have_path_data_close_to "M0 140L66.66666666666666 120L133.33333333333331 100L133.33333333333331 160L66.66666666666666 140L0 180Z"
123
+ expect(@paths[1]).to have_path_data_close_to "M0 140L66.66666666666666 120L133.33333333333331 100L133.33333333333331 160L66.66666666666666 140L0 180Z"
124
124
  end
125
125
 
126
126
  end
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Layout::Treemap do
3
3
  include Rubyvis::LayoutSpec
4
4
  it "should have correct properties" do
5
- props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :links, :mode, :nodes, :order, :overflow, :padding_bottom, :padding_left, :padding_right, :padding_top, :reverse, :right, :round, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
+ props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :links, :mode, :nodes, :order, :overflow, :padding_bottom, :padding_left, :padding_right, :padding_top, :reverse, :right, :round, :stroke_style, :title, :top, :transform, :visible, :view_box, :width].inject({}) {|ac, v| ac[v]=true; ac}
6
6
  Rubyvis::Layout::Treemap.properties.should==props
7
7
  end
8
8
  describe "rendered" do
@@ -36,21 +36,21 @@ describe Rubyvis::Layout::Treemap do
36
36
  @tree.orient("top")
37
37
  @vis.render
38
38
  pv_out=fixture_svg_read("layout_tree_orient_top.svg")
39
- @vis.to_svg.should have_same_svg_elements(pv_out)
39
+ expect(@vis.to_svg).to have_same_svg_elements(pv_out)
40
40
  end
41
41
 
42
42
  it "should render correctly orient('left')" do
43
43
  @tree.orient("left")
44
44
  @vis.render
45
45
  pv_out=fixture_svg_read("layout_tree_orient_left.svg")
46
- @vis.to_svg.should have_same_svg_elements(pv_out)
46
+ expect(@vis.to_svg).to have_same_svg_elements(pv_out)
47
47
  end
48
48
 
49
49
  it "should render equal to pv with orient('radial') and breadth(20)" do
50
50
  @tree.nodes(hier_nodes_big).orient("radial").breadth(20)
51
51
  @vis.render
52
52
  pv_out=fixture_svg_read("layout_tree_orient_radial_breadth_20.svg")
53
- @vis.to_svg.should have_same_svg_elements(pv_out)
53
+ expect(@vis.to_svg).to have_same_svg_elements(pv_out)
54
54
  end
55
55
  end
56
56
  end