plotrb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,93 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe 'Visualization', :broken => true do
4
+
5
+ context 'properties' do
6
+
7
+ before(:each) do
8
+ @vis = ::Plotrb::Visualization.new
9
+ end
10
+
11
+ it 'sets name' do
12
+ @vis.name = 'Foo'
13
+ @vis.name.should == 'Foo'
14
+ end
15
+
16
+ it 'raises error when name is nil' do
17
+ expect { @vis.name = nil }.to raise_error ::Plotrb::InvalidInputError
18
+ end
19
+
20
+ it 'sets width when given' do
21
+ @vis.width = 200
22
+ @vis.width.should == 200
23
+ end
24
+
25
+ it 'sets width to 500 by default' do
26
+ @vis.width.should == 500
27
+ end
28
+
29
+ it 'raises error when width is not a number' do
30
+ expect { @vis.width = [:foo] }.to raise_error ::Plotrb::InvalidInputError
31
+ end
32
+
33
+ it 'sets height when given' do
34
+ @vis.height = 200
35
+ @vis.height.should == 200
36
+ end
37
+
38
+ it 'sets height to 500 by default' do
39
+ @vis.height.should == 500
40
+ end
41
+
42
+ it 'raises error when height is not a number' do
43
+ expect { @vis.height = [:foo] }.to raise_error ::Plotrb::InvalidInputError
44
+ end
45
+
46
+ it 'sets viewport when given as an array' do
47
+ @vis.viewport = [400, 500]
48
+ @vis.viewport.should == [400, 500]
49
+ end
50
+
51
+ it 'sets viewport when given as a hash' do
52
+ @vis.viewport = {:width => 400, :height => 500}
53
+ @vis.viewport.should == [400, 500]
54
+ end
55
+
56
+ it 'sets viewport to default width and height when not given' do
57
+ vis = ::Plotrb::Visualization.new(:width => 300, :height => 400)
58
+ vis.viewport.should == [300, 400]
59
+ end
60
+
61
+ it 'raises error when viewport contains nil' do
62
+ expect { @vis.viewport = [100, :foo] }.
63
+ to raise_error ::Plotrb::InvalidInputError
64
+ end
65
+
66
+ it 'sets padding when given as an integer' do
67
+ @vis.padding = 2
68
+ @vis.padding.should == {:top => 2, :left => 2, :right => 2, :bottom => 2}
69
+ end
70
+
71
+ it 'sets padding when given as a hash' do
72
+ @vis.padding = {:bottom => 5, :top => 4, :right => 3, :left => 2 }
73
+ @vis.padding.should == {:top => 4, :left => 2, :right => 3, :bottom => 5}
74
+ end
75
+
76
+ it 'sets padding to 5 by default' do
77
+ @vis.padding = {:top => 5, :left => 5, :right => 5, :bottom => 5}
78
+ end
79
+
80
+ it 'raises error when any padding value is missing' do
81
+ expect { @vis.padding = {:top => 4} }.
82
+ to raise_error ::Plotrb::InvalidInputError
83
+ end
84
+
85
+ it 'raises error when any padding value is not a number' do
86
+ expect { @vis.padding = {
87
+ :top => 4, :left => :foo, :right => 'bar', :bottom => nil
88
+ } }.to raise_error ::Plotrb::InvalidInputError
89
+ end
90
+
91
+ end
92
+
93
+ end
@@ -0,0 +1,5 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe 'Plotrb' do
4
+
5
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'plotrb'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ config.filter_run_excluding :broken => true
12
+ end
metadata ADDED
@@ -0,0 +1,180 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: plotrb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Zuhao Wan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yajl-ruby
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activemodel
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Plotrb is a plotting tool in Ruby.
98
+ email: wanzuhao@gmail.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - .gitignore
104
+ - .rspec
105
+ - .travis.yml
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE.txt
109
+ - README.rdoc
110
+ - Rakefile
111
+ - examples/arc.rb
112
+ - examples/area.rb
113
+ - examples/bar.rb
114
+ - examples/barley.rb
115
+ - examples/choropleth.rb
116
+ - examples/lifelines.rb
117
+ - examples/scatter.rb
118
+ - lib/plotrb.rb
119
+ - lib/plotrb/axes.rb
120
+ - lib/plotrb/base.rb
121
+ - lib/plotrb/data.rb
122
+ - lib/plotrb/kernel.rb
123
+ - lib/plotrb/legends.rb
124
+ - lib/plotrb/marks.rb
125
+ - lib/plotrb/scales.rb
126
+ - lib/plotrb/simple.rb
127
+ - lib/plotrb/transforms.rb
128
+ - lib/plotrb/version.rb
129
+ - lib/plotrb/visualization.rb
130
+ - plotrb.gemspec
131
+ - spec/plotrb/axes_spec.rb
132
+ - spec/plotrb/base_spec.rb
133
+ - spec/plotrb/data_spec.rb
134
+ - spec/plotrb/kernel_spec.rb
135
+ - spec/plotrb/legends_spec.rb
136
+ - spec/plotrb/marks_spec.rb
137
+ - spec/plotrb/scales_spec.rb
138
+ - spec/plotrb/simple_spec.rb
139
+ - spec/plotrb/transforms_spec.rb
140
+ - spec/plotrb/visualization_spec.rb
141
+ - spec/plotrb_spec.rb
142
+ - spec/spec_helper.rb
143
+ homepage: https://github.com/sciruby/plotrb
144
+ licenses:
145
+ - BSD 2-clause
146
+ metadata: {}
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 2.0.3
164
+ signing_key:
165
+ specification_version: 4
166
+ summary: Plotrb is a plotting tool in Ruby, built on Vega and D3, and is part of the
167
+ SciRuby Project.
168
+ test_files:
169
+ - spec/plotrb/axes_spec.rb
170
+ - spec/plotrb/base_spec.rb
171
+ - spec/plotrb/data_spec.rb
172
+ - spec/plotrb/kernel_spec.rb
173
+ - spec/plotrb/legends_spec.rb
174
+ - spec/plotrb/marks_spec.rb
175
+ - spec/plotrb/scales_spec.rb
176
+ - spec/plotrb/simple_spec.rb
177
+ - spec/plotrb/transforms_spec.rb
178
+ - spec/plotrb/visualization_spec.rb
179
+ - spec/plotrb_spec.rb
180
+ - spec/spec_helper.rb