Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
likvid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Cederqvist
likvid
Commits
bb3fba6f
Commit
bb3fba6f
authored
18 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
./script/generate gruff SimulationGraph -c
parent
899ad079
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/simulation_graph_controller.rb
+32
-0
32 additions, 0 deletions
app/controllers/simulation_graph_controller.rb
test/functional/simulation_graph_controller_test.rb
+24
-0
24 additions, 0 deletions
test/functional/simulation_graph_controller_test.rb
with
56 additions
and
0 deletions
app/controllers/simulation_graph_controller.rb
0 → 100644
+
32
−
0
View file @
bb3fba6f
class
SimulationGraphController
<
ApplicationController
# To make caching easier, add a line like this to config/routes.rb:
# map.graph "graph/:action/:id/image.png", :controller => "graph"
#
# Then reference it with the named route:
# image_tag graph_url(:action => 'show', :id => 42)
def
show
g
=
Gruff
::
Line
.
new
# Uncomment to use your own theme or font
# See http://colourlovers.com or http://www.firewheeldesign.com/widgets/ for color ideas
# g.theme = {
# :colors => ['#663366', '#cccc99', '#cc6633', '#cc9966', '#99cc99'],
# :marker_color => 'white',
# :background_colors => ['black', '#333333']
# }
# g.font = File.expand_path('artwork/fonts/VeraBd.ttf', RAILS_ROOT)
g
.
title
=
"Gruff-o-Rama"
g
.
data
(
"Apples"
,
[
1
,
2
,
3
,
4
,
4
,
3
])
g
.
data
(
"Oranges"
,
[
4
,
8
,
7
,
9
,
8
,
9
])
g
.
data
(
"Watermelon"
,
[
2
,
3
,
1
,
5
,
6
,
8
])
g
.
data
(
"Peaches"
,
[
9
,
9
,
10
,
8
,
7
,
9
])
g
.
labels
=
{
0
=>
'2004'
,
2
=>
'2005'
,
4
=>
'2006'
}
send_data
(
g
.
to_blob
,
:disposition
=>
'inline'
,
:type
=>
'image/png'
,
:filename
=>
"gruff.png"
)
end
end
This diff is collapsed.
Click to expand it.
test/functional/simulation_graph_controller_test.rb
0 → 100644
+
24
−
0
View file @
bb3fba6f
require
File
.
dirname
(
__FILE__
)
+
'/../test_helper'
require
'simulation_graph_controller'
# Re-raise errors caught by the controller.
class
SimulationGraphController
;
def
rescue_action
(
e
)
raise
e
end
;
end
class
SimulationGraphControllerTest
<
Test
::
Unit
::
TestCase
#fixtures :data
def
setup
@controller
=
SimulationGraphController
.
new
@request
=
ActionController
::
TestRequest
.
new
@response
=
ActionController
::
TestResponse
.
new
end
# TODO Replace this with your actual tests
def
test_show
get
:show
assert_response
:success
assert_equal
'image/png'
,
@response
.
headers
[
'Content-Type'
]
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment