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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0920b8934ac03cbc5cdcdd9e018b270c755c9a99
4
- data.tar.gz: d581b5a9847a03c8dd5d05c6db260448164ad6e0
2
+ SHA256:
3
+ metadata.gz: 1bc738ddd37028cbaddb2ee55bd9ff57b05a5786a0b858f386cf11bbe2794bc5
4
+ data.tar.gz: 4c5badd172bfd35d57409eef36b2538f8a4a7782e0468ea0fc3173bda8c5d1e7
5
5
  SHA512:
6
- metadata.gz: 6cd729bb91aa0d934def2639956cb577d7656d57435adaacef8c5e37ee1a91347a0462da8d253ce0a0429a7ee46fe90ec6029b32d5aa819001303e83122f97d5
7
- data.tar.gz: cc3455449762a6cba3acabb67130bac1ede70814241867be0792ae4daf2264777c3f2d7f5e09d9ef9d04f16419be2b7d6fe0ae8215b85404af1fe4c9626aaa78
6
+ metadata.gz: c79254660bab8923c66feac95ea8aa8edc4ccbf5d42d9092e4575f80341df1c0b632edf8d12da5a4fef1bfe53eba060a531d889e1742ba279b5e6799b3fe27e3
7
+ data.tar.gz: 7555b9d7944701a60ff82dd3ad8f29b4713203fc02db3430d712490f2a59c9d3d180f8f97a62efe8d649f8fc13073739278f51ca61410907e1d6ae55dd44fb4f
@@ -2,12 +2,12 @@ language:
2
2
  ruby
3
3
 
4
4
  rvm:
5
- - '1.9.2'
6
- - '1.9.3'
7
- - '2.0.0'
8
- - '2.1.1'
9
- - jruby-19mode # JRuby in 1.9 mode
5
+ - '2.1.9'
6
+ - '2.2.10'
7
+ - '2.5.0'
8
+ - '2.6.0'
9
+ - 'jruby-head'
10
10
  # - rbx-2.1.1
11
11
 
12
12
  script:
13
- bundle exec rake spec
13
+ bundle exec rspec
data/Gemfile CHANGED
@@ -5,4 +5,4 @@ gem 'coderay'
5
5
  gem 'haml'
6
6
  gem 'rspec'
7
7
  gem 'rspec-mocks'
8
- gem 'RedCloth'
8
+ #gem 'RedCloth'
@@ -1,37 +1,43 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- RedCloth (4.2.9)
5
- coderay (1.1.0)
6
- diff-lcs (1.2.5)
7
- haml (4.0.5)
4
+ coderay (1.1.2)
5
+ diff-lcs (1.3)
6
+ haml (5.0.4)
7
+ temple (>= 0.8.0)
8
8
  tilt
9
- mini_portile (0.6.0)
10
- nokogiri (1.6.3.1)
11
- mini_portile (= 0.6.0)
12
- rake (10.3.2)
13
- rspec (3.0.0)
14
- rspec-core (~> 3.0.0)
15
- rspec-expectations (~> 3.0.0)
16
- rspec-mocks (~> 3.0.0)
17
- rspec-core (3.0.3)
18
- rspec-support (~> 3.0.0)
19
- rspec-expectations (3.0.3)
9
+ mini_portile2 (2.4.0)
10
+ nokogiri (1.9.1)
11
+ mini_portile2 (~> 2.4.0)
12
+ nokogiri (1.9.1-java)
13
+ rake (12.3.2)
14
+ rspec (3.8.0)
15
+ rspec-core (~> 3.8.0)
16
+ rspec-expectations (~> 3.8.0)
17
+ rspec-mocks (~> 3.8.0)
18
+ rspec-core (3.8.0)
19
+ rspec-support (~> 3.8.0)
20
+ rspec-expectations (3.8.2)
20
21
  diff-lcs (>= 1.2.0, < 2.0)
21
- rspec-support (~> 3.0.0)
22
- rspec-mocks (3.0.3)
23
- rspec-support (~> 3.0.0)
24
- rspec-support (3.0.3)
25
- tilt (2.0.1)
22
+ rspec-support (~> 3.8.0)
23
+ rspec-mocks (3.8.0)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.8.0)
26
+ rspec-support (3.8.0)
27
+ temple (0.8.0)
28
+ tilt (2.0.9)
26
29
 
27
30
  PLATFORMS
31
+ java
28
32
  ruby
29
33
 
30
34
  DEPENDENCIES
31
- RedCloth
32
35
  coderay
33
36
  haml
34
37
  nokogiri
35
38
  rake
36
39
  rspec
37
40
  rspec-mocks
41
+
42
+ BUNDLED WITH
43
+ 1.17.2
@@ -1,10 +1,19 @@
1
+ === 0.7.0 / 2019-01-02
2
+
3
+ * Version for API and Protovis version in lib/rubyvis/version.rb
4
+ * Travis.CI: Updated to jruby-head, ruby 2.5 and 2.6
5
+ * Added view_box property
6
+ * Update rspec tests to new style, fix all warnings
7
+
1
8
  === 0.6.1 / 2014-08-07
9
+
2
10
  * Change license to BSD 2-Clause
3
11
  * Merge pull request #19 from pivotal-cloudplanner/master
4
12
  * Added travis and bundler support
5
13
  * Resolved bug #15
6
14
 
7
15
  === 0.6.0 / 2013-07-10
16
+
8
17
  + Added support for dashed lines (ex.: stroke_dasharray('9,5,3'))
9
18
  - Raises an exception on log scale when domain includes 0 or negative values
10
19
 
@@ -28,6 +37,7 @@
28
37
 
29
38
 
30
39
  === 0.4.1 / 2011-01-26
40
+
31
41
  * All tests run on ruby 1.8.7. Not all pass, because on ruby<1.9 hash order are not preserved
32
42
  * Removed warnings for Ruby 1.9+
33
43
  * Changed SvgScene.implicit and Color.names with constants
@@ -4,6 +4,7 @@ require 'rexml/document'
4
4
  require 'rexml/formatters/default'
5
5
 
6
6
  require 'pp'
7
+ require 'rubyvis/version'
7
8
  require 'rubyvis/internals'
8
9
  require 'rubyvis/vector'
9
10
 
@@ -33,10 +34,6 @@ require 'rubyvis/mark/shorcut_methods'
33
34
  #
34
35
  module Rubyvis
35
36
  @@nokogiri=nil
36
- # Rubyvis version
37
- VERSION = '0.6.1'
38
- # Protovis API on which current Rubyvis is based
39
- PROTOVIS_API_VERSION='3.3'
40
37
  # You actually can do it! http://snipplr.com/view/2137/uses-for-infinity-in-ruby/
41
38
  Infinity=1.0 / 0
42
39
  #
@@ -9,7 +9,7 @@ module Rubyvis
9
9
  end
10
10
 
11
11
  @properties=Bar.properties.dup
12
- attr_accessor_dsl :transform, :overflow, :canvas
12
+ attr_accessor_dsl :transform, :overflow, :canvas, :view_box
13
13
  attr_accessor :children, :root
14
14
  def initialize
15
15
  @children=[]
@@ -43,7 +43,6 @@ module Rubyvis
43
43
  "fill-opacity"=> (fill.opacity==0.0) ? nil : fill.opacity,
44
44
  "stroke"=> stroke.color,
45
45
  "stroke-opacity"=> (stroke.opacity==0.0) ? nil : stroke.opacity,
46
- "stroke-dasharray"=> s.stroke_dasharray, # strokeDasharray from Jamie Love (protovis mod)
47
46
  "stroke-width"=> (stroke.opacity>0) ? s.line_width / self.scale : nil,
48
47
  "stroke-linejoin"=> s.line_join
49
48
  });
@@ -44,6 +44,9 @@ module Rubyvis
44
44
  'width'=>s.width+s.left+s.right,
45
45
  'height'=>s.height+s.top+s.bottom
46
46
  })
47
+ if not s.view_box.nil?
48
+ g.set_attribute('viewBox', s.view_box)
49
+ end
47
50
  #g.attributes['width']=s.width+s.left+s.right
48
51
  #g.attributes['height']=s.height+s.top+s.bottom
49
52
  end
@@ -17,7 +17,6 @@ module Rubyvis
17
17
  'y2'=>s.top+s.height,
18
18
  "stroke"=> stroke.color,
19
19
  "stroke-opacity"=> stroke.opacity,
20
- "stroke-dasharray"=> s.stroke_dasharray,
21
20
  "stroke-width"=> s.line_width / self.scale
22
21
  })
23
22
 
@@ -101,6 +101,7 @@ module Rubyvis
101
101
  attr_accessor :type
102
102
  attr_accessor :url
103
103
  attr_accessor :width
104
+ attr_accessor :view_box
104
105
 
105
106
  def []=(v,i)
106
107
  if v.is_a? Numeric
@@ -0,0 +1,6 @@
1
+ module Rubyvis
2
+ # Rubyvis version
3
+ VERSION="0.7.0"
4
+ # Protovis API on which current Rubyvis is based
5
+ PROTOVIS_API_VERSION='3.3'
6
+ end
@@ -1,6 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.unshift(File.expand_path(File.dirname(__FILE__)+"/lib"))
3
- require File.expand_path("../lib/rubyvis", __FILE__)
2
+ require_relative "lib/rubyvis/version.rb"
4
3
 
5
4
  Gem::Specification.new do |s|
6
5
  s.name = "rubyvis"
@@ -4,12 +4,12 @@ describe Rubyvis::Anchor do
4
4
 
5
5
  it "should have correct properties" do
6
6
  props=[:antialias, :bottom, :cursor, :data, :events, :id, :left, :name, :reverse, :right, :title, :top, :visible].inject({}) {|ac, v| ac[v]=true; ac}
7
- Rubyvis::Anchor.properties.should==props
7
+ expect(Rubyvis::Anchor.properties).to eq(props)
8
8
  end
9
9
  it "should be initialized with an object which respond to parent" do
10
10
  my_mock=double('mark')
11
- my_mock.stub(:parent)
12
- my_mock.should_receive(:parent).with(no_args())
11
+ allow(my_mock).to receive(:parent)
12
+ expect(my_mock).to receive(:parent).with(no_args())
13
13
  Rubyvis.Anchor(my_mock)
14
14
 
15
15
  end
@@ -42,15 +42,15 @@ describe Rubyvis::Anchor do
42
42
  end
43
43
  if(true)
44
44
  it "first loop correct" do
45
- @data_p1.should==@expected_p1
45
+ expect(@data_p1).to eq(@expected_p1)
46
46
  end
47
47
  it "second loop correct" do
48
- @data_p2.should==@expected_p2
48
+ expect(@data_p2).to eq(@expected_p2)
49
49
  end
50
50
  end
51
51
 
52
52
  it "label loop correct" do
53
- @data_l.should==@expected_l
53
+ expect(@data_l).to eq(@expected_l)
54
54
  end
55
55
  end
56
56
 
@@ -85,7 +85,7 @@ describe Rubyvis::Anchor do
85
85
  expected=[]
86
86
  a1.each {|a| a2.each {|b| expected.push([b,b,a,nil])}}
87
87
  vis.render
88
- adatas.should==expected
88
+ expect(adatas).to eq(expected)
89
89
 
90
90
  end
91
91
 
@@ -104,7 +104,7 @@ describe Rubyvis::Anchor do
104
104
  @vis.render
105
105
  expected=[]
106
106
  @values.each {|a| @values.each {|b| expected.push([b,b,a,nil])}}
107
- datas.should==expected
107
+ expect(datas).to eq(expected)
108
108
  end
109
109
  end
110
110
  it "should render equal to protovis 'anchor.html' example" do
@@ -122,7 +122,7 @@ describe Rubyvis::Anchor do
122
122
  text("bottom")
123
123
  @vis.render
124
124
  @pv_out=fixture_svg_read("anchor.svg")
125
- @vis.to_svg.should have_same_svg_elements(@pv_out)
125
+ expect(@vis.to_svg).to have_same_svg_elements(@pv_out)
126
126
  end
127
127
  context "Panel-bar assigment" do
128
128
  before do
@@ -140,7 +140,7 @@ describe Rubyvis::Anchor do
140
140
  expected=[[1,nil],[2,nil],[3,nil]]
141
141
  @label.text(lambda {|*args| datas.push args})
142
142
  @vis.render
143
- datas.should==expected
143
+ expect(datas).to eq(expected)
144
144
  end
145
145
 
146
146
  it "should have correct data for two levels of data" do
@@ -150,7 +150,7 @@ describe Rubyvis::Anchor do
150
150
  %w{a b c}.each {|a| [1,2,3].each {|b| expected.push([b,a])}}
151
151
  @label.text(lambda {|*args| datas.push args})
152
152
  @vis.render
153
- datas.should==expected
153
+ expect(datas).to eq(expected)
154
154
  end
155
155
  end
156
156
  end
@@ -4,10 +4,10 @@ describe Rubyvis::Area do
4
4
  include Rubyvis::GeneralSpec
5
5
  it "should have correct properties" do
6
6
  props=[:antialias, :bottom, :cursor, :data, :events, :fill_style, :height, :id, :interpolate, :left, :line_width, :reverse, :right, :segmented, :stroke_dasharray, :stroke_style, :tension, :title, :top, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
7
- Rubyvis::Area.properties.should==props
7
+ expect(Rubyvis::Area.properties).to eq(props)
8
8
  end
9
9
  it "Rubyvis.Area be the same as Rubyvis::Area" do
10
- Rubyvis.Area.should eql Rubyvis::Area
10
+ expect(Rubyvis.Area).to eql Rubyvis::Area
11
11
  end
12
12
  it "should render equal to protovis 'area-segmented.html' test" do
13
13
  data=Rubyvis.range(0, 6, 0.1).map {|x| Math.sin(x)}
@@ -28,7 +28,7 @@ height(lambda {|d| (d + 1) / 2.0 * 200 + 50}).
28
28
  fill_style(lambda {|d| "hsl(#{(d + 1) * 180.0},50,50)"})
29
29
  vis.render()
30
30
  pv_out=fixture_svg_read("area_segmented.svg")
31
- vis.to_svg.should have_same_svg_elements(pv_out)
31
+ expect(vis.to_svg).to have_same_svg_elements(pv_out)
32
32
  end
33
33
 
34
34
  it "should render correctly 'area_interpolation.html' example" do
@@ -83,7 +83,7 @@ top(5)
83
83
  end
84
84
  vis.render()
85
85
  pv_out=fixture_svg_read("area_interpolation.svg")
86
- vis.to_svg.should have_same_svg_elements(pv_out)
86
+ expect(vis.to_svg).to have_same_svg_elements(pv_out)
87
87
  end
88
88
 
89
89
 
@@ -107,38 +107,38 @@ top(5)
107
107
 
108
108
  doc=Nokogiri::XML(@vis.to_svg)
109
109
  # <svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="200" height="200"><g><path d="M0,180L20,200L20,200L0,200ZM20,200L40,160L40,200L20,200Z" fill="rgb(31,119,180)"/></g></svg>
110
- doc.at_xpath("//xmlns:path").should have_path_data_close_to "M0,180L20,200L20,200L0,200ZM20,200L40,160L40,200L20,200Z"
110
+ expect(doc.at_xpath("//xmlns:path")).to have_path_data_close_to "M0,180L20,200L20,200L0,200ZM20,200L40,160L40,200L20,200Z"
111
111
  end
112
112
 
113
113
 
114
114
  it "should return correct default (linear) path" do
115
115
  @vis.render
116
116
  doc=Nokogiri::XML(@vis.to_svg)
117
- doc.at_xpath("//xmlns:path").should have_path_data_close_to "M0 180L20 160L40 180L60 120L80 180L100 100L100 200L80 200L60 200L40 200L20 200L0 200Z"
117
+ expect(doc.at_xpath("//xmlns:path")).to have_path_data_close_to "M0 180L20 160L40 180L60 120L80 180L100 100L100 200L80 200L60 200L40 200L20 200L0 200Z"
118
118
  end
119
119
  it "should return correct path for interpolate=step-before" do
120
120
  @area.interpolate('step-before')
121
121
  @vis.render
122
122
  doc=Nokogiri::XML(@vis.to_svg)
123
- doc.at_xpath("//xmlns:path").should have_path_data_close_to "M0 180V160L20 160V180L40 180V120L60 120V180L80 180V100L100 100L100 200H80L80 200H60L60 200H40L40 200H20L20 200H0L0 200Z"
123
+ expect(doc.at_xpath("//xmlns:path")).to have_path_data_close_to "M0 180V160L20 160V180L40 180V120L60 120V180L80 180V100L100 100L100 200H80L80 200H60L60 200H40L40 200H20L20 200H0L0 200Z"
124
124
  end
125
125
  it "should return correct path for interpolate=step-after" do
126
126
  @area.interpolate('step-after')
127
127
  @vis.render
128
128
  doc=Nokogiri::XML(@vis.to_svg)
129
- doc.at_xpath("//xmlns:path").should have_path_data_close_to "M0 180H20L20 160H40L40 180H60L60 120H80L80 180H100L100 100L100 200V200L80 200V200L60 200V200L40 200V200L20 200V200L0 200Z"
129
+ expect(doc.at_xpath("//xmlns:path")).to have_path_data_close_to "M0 180H20L20 160H40L40 180H60L60 120H80L80 180H100L100 100L100 200V200L80 200V200L60 200V200L40 200V200L20 200V200L0 200Z"
130
130
  end
131
131
  it "should return correct path for interpolate=basis" do
132
132
  @area.interpolate('basis')
133
133
  @vis.render
134
134
  doc=Nokogiri::XML(@vis.to_svg)
135
- doc.at_xpath("//xmlns:path").should have_path_data_close_to "M0 180C0 180 0 180 3.333333333333333 176.66666666666666C6.666666666666666 173.33333333333331 13.333333333333332 166.66666666666666 20 166.66666666666666C26.666666666666664 166.66666666666666 33.33333333333333 173.33333333333331 40 166.66666666666666C46.666666666666664 160 53.33333333333333 140 60 140C66.66666666666666 140 73.33333333333333 160 80 156.66666666666666C86.66666666666666 153.33333333333331 93.33333333333331 126.66666666666666 96.66666666666666 113.33333333333331C99.99999999999999 99.99999999999999 99.99999999999999 99.99999999999999 99.99999999999997 99.99999999999997L100 200C99.99999999999999 199.99999999999997 99.99999999999999 199.99999999999997 96.66666666666664 199.99999999999994C93.33333333333331 199.99999999999997 86.66666666666666 199.99999999999997 80 199.99999999999994C73.33333333333333 199.99999999999997 66.66666666666666 199.99999999999997 59.99999999999999 199.99999999999994C53.33333333333333 199.99999999999997 46.666666666666664 199.99999999999997 40 199.99999999999994C33.33333333333333 199.99999999999997 26.666666666666664 199.99999999999997 20 199.99999999999994C13.333333333333332 199.99999999999997 6.666666666666666 199.99999999999997 3.333333333333333 199.99999999999994C0 199.99999999999997 0 199.99999999999997 0 199.99999999999994Z"
135
+ expect(doc.at_xpath("//xmlns:path")).to have_path_data_close_to "M0 180C0 180 0 180 3.333333333333333 176.66666666666666C6.666666666666666 173.33333333333331 13.333333333333332 166.66666666666666 20 166.66666666666666C26.666666666666664 166.66666666666666 33.33333333333333 173.33333333333331 40 166.66666666666666C46.666666666666664 160 53.33333333333333 140 60 140C66.66666666666666 140 73.33333333333333 160 80 156.66666666666666C86.66666666666666 153.33333333333331 93.33333333333331 126.66666666666666 96.66666666666666 113.33333333333331C99.99999999999999 99.99999999999999 99.99999999999999 99.99999999999999 99.99999999999997 99.99999999999997L100 200C99.99999999999999 199.99999999999997 99.99999999999999 199.99999999999997 96.66666666666664 199.99999999999994C93.33333333333331 199.99999999999997 86.66666666666666 199.99999999999997 80 199.99999999999994C73.33333333333333 199.99999999999997 66.66666666666666 199.99999999999997 59.99999999999999 199.99999999999994C53.33333333333333 199.99999999999997 46.666666666666664 199.99999999999997 40 199.99999999999994C33.33333333333333 199.99999999999997 26.666666666666664 199.99999999999997 20 199.99999999999994C13.333333333333332 199.99999999999997 6.666666666666666 199.99999999999997 3.333333333333333 199.99999999999994C0 199.99999999999997 0 199.99999999999997 0 199.99999999999994Z"
136
136
  end
137
137
  it "should return correct path for interpolate=cardinal" do
138
138
  @area.interpolate('cardinal')
139
139
  @vis.render
140
140
  doc=Nokogiri::XML(@vis.to_svg)
141
- doc.at_xpath("//xmlns:path").should have_path_data_close_to "M0 180Q16 160 20 160C26 160 34 186 40 180S54 120 60 120S74 183 80 180Q84 178 100 100L100 200Q84 200 80 200C74 200 66 200 60 200S46 200 40 200S26 200 20 200Q16 200 0 200Z"
141
+ expect(doc.at_xpath("//xmlns:path")).to have_path_data_close_to "M0 180Q16 160 20 160C26 160 34 186 40 180S54 120 60 120S74 183 80 180Q84 178 100 100L100 200Q84 200 80 200C74 200 66 200 60 200S46 200 40 200S26 200 20 200Q16 200 0 200Z"
142
142
  end
143
143
  end
144
144
  end
@@ -2,19 +2,19 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe Rubyvis::Bar do
3
3
  it "should have correct properties" do
4
4
  props=[:antialias, :bottom, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :reverse, :right, :stroke_style, :title, :top, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
- Rubyvis::Bar.properties.should==props
5
+ expect(Rubyvis::Bar.properties).to eq(props)
6
6
  end
7
7
  it "Rubyvis.Bar be the same as Rubyvis::Bar" do
8
- Rubyvis.Bar.should eql Rubyvis::Bar
8
+ expect(Rubyvis.Bar).to eql Rubyvis::Bar
9
9
  end
10
10
  it "should return correct defaults" do
11
11
  props=Rubyvis::Bar.defaults._properties
12
- props.size.should==2
13
- props[0].name.should==:line_width
14
- props[0].value.should==1.5
15
- props[1].name.should==:fill_style
16
- props[1].value.should be_instance_of Proc
17
- Rubyvis::Bar.defaults.proto.should be_instance_of Rubyvis::Mark
12
+ expect(props.size).to eq(2)
13
+ expect(props[0].name).to eq(:line_width)
14
+ expect(props[0].value).to eq(1.5)
15
+ expect(props[1].name).to eq(:fill_style)
16
+ expect(props[1].value).to be_instance_of Proc
17
+ expect(Rubyvis::Bar.defaults.proto).to be_instance_of Rubyvis::Mark
18
18
 
19
19
  end
20
20
  context "on a Panel" do
@@ -32,7 +32,7 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
32
32
  attribs=doc.xpath("//xmlns:rect").map {|v|
33
33
  [v.attributes['y'].value, v.attributes['height'].value, v.attributes['fill'].value]
34
34
  }
35
- attribs.should==[["120","80","rgb(31,119,180)"],["40","160","rgb(31,119,180)"]]
35
+ expect(attribs).to eq([["120","80","rgb(31,119,180)"],["40","160","rgb(31,119,180)"]])
36
36
  end
37
37
 
38
38
  it "should bould properly with string fill_style" do
@@ -40,14 +40,14 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
40
40
  @vis.render
41
41
  s=@vis.to_svg
42
42
  doc=Nokogiri::XML(s)
43
- doc.at_xpath("//xmlns:rect").attributes['fill'].value.should=='rgb(255,0,0)'
43
+ expect(doc.at_xpath("//xmlns:rect").attributes['fill'].value).to eq('rgb(255,0,0)')
44
44
  end
45
45
  it "should bould properly with pv.color" do
46
46
  @bar.fill_style(pv.color('red'))
47
47
  @vis.render
48
48
  s=@vis.to_svg
49
49
  doc=Nokogiri::XML(s)
50
- doc.at_xpath("//xmlns:rect").attributes['fill'].value.should=='rgb(255,0,0)'
50
+ expect(doc.at_xpath("//xmlns:rect").attributes['fill'].value).to eq('rgb(255,0,0)')
51
51
  end
52
52
  it "should bould properly with pv.colors" do
53
53
  @bar.fill_style(pv.colors('black','red'))
@@ -55,7 +55,7 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
55
55
  s=@vis.to_svg
56
56
  doc=Nokogiri::XML(s)
57
57
  attr=doc.xpath("//xmlns:rect").map {|x| x.attributes['fill'].value}
58
- attr.should==['rgb(0,0,0)', 'rgb(255,0,0)']
58
+ expect(attr).to eq(['rgb(0,0,0)', 'rgb(255,0,0)'])
59
59
  end
60
60
 
61
61
  it "should bould propertly with double data" do
@@ -68,7 +68,7 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
68
68
  x=v.attributes['x'] ? v.attributes['x'].value : nil
69
69
  [x, v.attributes['y'].value, v.attributes['height'].value]
70
70
  }
71
- attribs.should==[[nil,"90","10"], ["25","80","20"], [nil,"70","30"], ["25","40","60"]]
71
+ expect(attribs).to eq([[nil,"90","10"], ["25","80","20"], [nil,"70","30"], ["25","40","60"]])
72
72
  end
73
73
 
74
74
  end
@@ -2,9 +2,9 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
  describe "Rubyvis color methods" do
3
3
  it "should return correct Rubyvis.ramp" do
4
4
  a=Rubyvis.ramp("white","red")
5
- a[0].should eq Rubyvis.color("rgb(255,255,255)")
6
- a[0.5].should eq Rubyvis.color("rgb(255,128,128)")
7
- a[1].should eq Rubyvis.color("rgb(255,0,0)")
5
+ expect(a[0]).to eq Rubyvis.color("rgb(255,255,255)")
6
+ expect(a[0.5]).to eq Rubyvis.color("rgb(255,128,128)")
7
+ expect(a[1]).to eq Rubyvis.color("rgb(255,0,0)")
8
8
  end
9
9
 
10
10
  # <li>#f00 // #rgb
@@ -17,39 +17,39 @@ describe "Rubyvis color methods" do
17
17
  describe "Rubyvis.color" do
18
18
 
19
19
  it "should return correct Rubyvis.color with three hex" do
20
- Rubyvis.color("#f97").should eq Rubyvis::Color::Rgb.new("ff".to_i(16), "99".to_i(16),"77".to_i(16),1 )
20
+ expect(Rubyvis.color("#f97")).to eq Rubyvis::Color::Rgb.new("ff".to_i(16), "99".to_i(16),"77".to_i(16),1 )
21
21
  end
22
22
  it "should return correct Rubyvis.color with 6 hex" do
23
- Rubyvis.color("#f19171").should eq Rubyvis::Color::Rgb.new("f1".to_i(16), "91".to_i(16),"71".to_i(16),1 )
23
+ expect(Rubyvis.color("#f19171")).to eq Rubyvis::Color::Rgb.new("f1".to_i(16), "91".to_i(16),"71".to_i(16),1 )
24
24
  end
25
25
  it "should return correct Rubyvis.color rbg() with integers" do
26
26
  r,g,b=rand(255),rand(255),rand(255)
27
- Rubyvis.color("rgb(#{r},#{g},#{b})").should eq Rubyvis::Color::Rgb.new(r, g, b,1 )
27
+ expect(Rubyvis.color("rgb(#{r},#{g},#{b})")).to eq Rubyvis::Color::Rgb.new(r, g, b,1 )
28
28
  end
29
29
  it "should return correct Rubyvis.color rbga() with integers" do
30
30
  r,g,b,a=rand(255),rand(255),rand(255), rand()
31
- Rubyvis.color("rgba(#{r},#{g},#{b},#{a})").should eq Rubyvis::Color::Rgb.new(r, g, b,"#{a}".to_f )
31
+ expect(Rubyvis.color("rgba(#{r},#{g},#{b},#{a})")).to eq Rubyvis::Color::Rgb.new(r, g, b,"#{a}".to_f )
32
32
  end
33
33
  it "should return correct Rubyvis.color rbg() with percents" do
34
34
  r,g,b=rand(100),rand(100),rand(100)
35
- Rubyvis.color("rgb(#{r}%,#{g}%,#{b}%)").should eq Rubyvis::Color::Rgb.new((r*2.55).round, (g*2.55).round, (b*2.55).round,1 )
35
+ expect(Rubyvis.color("rgb(#{r}%,#{g}%,#{b}%)")).to eq Rubyvis::Color::Rgb.new((r*2.55).round, (g*2.55).round, (b*2.55).round,1 )
36
36
  end
37
37
  it "should return correct Rubyvis.color hsl" do
38
- Rubyvis.color("hsl(100,50,50)").should eq Rubyvis::Color::Rgb.new(106,191,64,1)
38
+ expect(Rubyvis.color("hsl(100,50,50)")).to eq Rubyvis::Color::Rgb.new(106,191,64,1)
39
39
 
40
40
  h,s,l=rand(360),rand(100),rand(100)
41
41
 
42
- Rubyvis.color("hsl(#{h},#{s},#{l})").should eq Rubyvis::Color::Hsl.new(h,s/100.0,l/100.0,1).rgb
42
+ expect(Rubyvis.color("hsl(#{h},#{s},#{l})")).to eq Rubyvis::Color::Hsl.new(h,s/100.0,l/100.0,1).rgb
43
43
  end
44
44
  it "should return correct Rubyvis.color hsla" do
45
45
  h,s,l,a=rand(360),rand(100),rand(100), rand()
46
- Rubyvis.color("hsla(#{h},#{s},#{l},#{a})").should eq Rubyvis::Color::Hsl.new(h,s/100.0,l/100.0, "#{a}".to_f).rgb
46
+ expect(Rubyvis.color("hsla(#{h},#{s},#{l},#{a})")).to eq Rubyvis::Color::Hsl.new(h,s/100.0,l/100.0, "#{a}".to_f).rgb
47
47
  end
48
48
  end
49
49
  describe Rubyvis::Color::Hsl do
50
50
  it "convert some extreme value" do
51
- Rubyvis.color("hsl(96,50,50)").should eq Rubyvis.color("rgb(115,191,64)")
52
- Rubyvis.color("hsl(112.5,50.0,50.0)").should eq Rubyvis.color("rgb(80,191,64)")
51
+ expect(Rubyvis.color("hsl(96,50,50)")).to eq Rubyvis.color("rgb(115,191,64)")
52
+ expect(Rubyvis.color("hsl(112.5,50.0,50.0)")).to eq Rubyvis.color("rgb(80,191,64)")
53
53
 
54
54
  end
55
55
  end
@@ -59,32 +59,32 @@ describe "Rubyvis color methods" do
59
59
  @rgb=Rubyvis::Color::Rgb.new(@r,@g,@b,@a)
60
60
  end
61
61
  it "return correct ==" do
62
- Rubyvis::Color::Rgb.new(0, 0,0,1 ).should eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
62
+ expect(Rubyvis::Color::Rgb.new(0, 0,0,1 )).to eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
63
63
 
64
- Rubyvis::Color::Rgb.new(10, 0,0,1 ).should_not eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
64
+ expect(Rubyvis::Color::Rgb.new(10, 0,0,1 )).not_to eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
65
65
 
66
- Rubyvis::Color::Rgb.new(0, 10,0,1 ).should_not eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
66
+ expect(Rubyvis::Color::Rgb.new(0, 10,0,1 )).not_to eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
67
67
 
68
- Rubyvis::Color::Rgb.new(0, 0,10,1 ).should_not eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
69
- Rubyvis::Color::Rgb.new(0, 0,0,0 ).should_not eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
68
+ expect(Rubyvis::Color::Rgb.new(0, 0,10,1 )).not_to eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
69
+ expect(Rubyvis::Color::Rgb.new(0, 0,0,0 )).not_to eq Rubyvis::Color::Rgb.new(0, 0,0,1 )
70
70
  end
71
71
  it "return correct red()" do
72
- @rgb.red(255).should eq Rubyvis::Color::Rgb.new(255,@g,@b,@a)
72
+ expect(@rgb.red(255)).to eq Rubyvis::Color::Rgb.new(255,@g,@b,@a)
73
73
  end
74
74
  it "return correct green()" do
75
- @rgb.green(255).should eq Rubyvis::Color::Rgb.new(@r,255,@b,@a)
75
+ expect(@rgb.green(255)).to eq Rubyvis::Color::Rgb.new(@r,255,@b,@a)
76
76
  end
77
77
  it "return correct blue()" do
78
- @rgb.blue(255).should eq Rubyvis::Color::Rgb.new(@r,@g,255,@a)
78
+ expect(@rgb.blue(255)).to eq Rubyvis::Color::Rgb.new(@r,@g,255,@a)
79
79
  end
80
80
  it "return correct alpha()" do
81
- @rgb.alpha(0.5).should eq Rubyvis::Color::Rgb.new(@r,@g,@b,0.5)
81
+ expect(@rgb.alpha(0.5)).to eq Rubyvis::Color::Rgb.new(@r,@g,@b,0.5)
82
82
  end
83
83
  it "return correct darker()" do
84
- Rubyvis.color("red").darker().should eq Rubyvis::Color::Rgb.new(178,0,0,1)
84
+ expect(Rubyvis.color("red").darker()).to eq Rubyvis::Color::Rgb.new(178,0,0,1)
85
85
  end
86
86
  it "return correct brighter()" do
87
- Rubyvis.color("rgb(100,110,120)").brighter().should eq Rubyvis::Color::Rgb.new(142,157,171,1)
87
+ expect(Rubyvis.color("rgb(100,110,120)").brighter()).to eq Rubyvis::Color::Rgb.new(142,157,171,1)
88
88
  end
89
89
 
90
90
  end