report_cat 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +147 -0
- data/Rakefile +24 -0
- data/app/assets/javascripts/report_cat/application.js +13 -0
- data/app/assets/stylesheets/report_cat/application.css +13 -0
- data/app/controllers/report_cat/reports_controller.rb +43 -0
- data/app/helpers/report_cat/reports_helper.rb +132 -0
- data/app/models/report_cat/date_range.rb +94 -0
- data/app/views/report_cat/reports/_google_charts.html.erb +61 -0
- data/app/views/report_cat/reports/index.html.erb +2 -0
- data/app/views/report_cat/reports/show.html.erb +15 -0
- data/config/locales/en.yml +26 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20130918075200_create_date_ranges.rb +13 -0
- data/lib/report_cat/config.rb +30 -0
- data/lib/report_cat/core/chart.rb +50 -0
- data/lib/report_cat/core/column.rb +70 -0
- data/lib/report_cat/core/param.rb +35 -0
- data/lib/report_cat/core/report.rb +127 -0
- data/lib/report_cat/engine.rb +11 -0
- data/lib/report_cat/matchers/have_chart.rb +58 -0
- data/lib/report_cat/matchers/have_column.rb +45 -0
- data/lib/report_cat/matchers/have_param.rb +52 -0
- data/lib/report_cat/reports/cohort_report.rb +113 -0
- data/lib/report_cat/reports/date_range_report.rb +66 -0
- data/lib/report_cat/version.rb +3 -0
- data/lib/report_cat.rb +39 -0
- data/lib/tasks/report_cat.rake +4 -0
- data/spec/controllers/report_cat/reports_controller_spec.rb +100 -0
- data/spec/coverage_spec.rb +18 -0
- data/spec/data/helpers/report_charts.html +1 -0
- data/spec/data/helpers/report_charts.html.tmp +1 -0
- data/spec/data/helpers/report_form.html +63 -0
- data/spec/data/helpers/report_form.html.tmp +63 -0
- data/spec/data/helpers/report_form_param.html +1 -0
- data/spec/data/helpers/report_form_param.html.tmp +1 -0
- data/spec/data/helpers/report_list.html +1 -0
- data/spec/data/helpers/report_list.html.tmp +1 -0
- data/spec/data/helpers/report_param_checkbox.html +1 -0
- data/spec/data/helpers/report_param_checkbox.html.tmp +1 -0
- data/spec/data/helpers/report_param_date.html +60 -0
- data/spec/data/helpers/report_param_date.html.tmp +60 -0
- data/spec/data/helpers/report_param_hidden.html +1 -0
- data/spec/data/helpers/report_param_hidden.html.tmp +1 -0
- data/spec/data/helpers/report_param_select.html +3 -0
- data/spec/data/helpers/report_param_select.html.tmp +3 -0
- data/spec/data/helpers/report_param_text_field.html +1 -0
- data/spec/data/helpers/report_param_text_field.html.tmp +1 -0
- data/spec/data/helpers/report_table.html +1 -0
- data/spec/data/helpers/report_table.html.tmp +1 -0
- data/spec/data/helpers/report_table_hidden.html +1 -0
- data/spec/data/helpers/report_table_hidden.html.tmp +1 -0
- data/spec/data/lib/chart_columns.json +1 -0
- data/spec/data/lib/chart_columns.json.tmp +1 -0
- data/spec/data/lib/chart_data.json +1 -0
- data/spec/data/lib/chart_data.json.tmp +1 -0
- data/spec/data/lib/date_range_report_where.sql +6 -0
- data/spec/data/lib/date_range_report_where.sql.tmp +6 -0
- data/spec/data/lib/report.csv +3 -0
- data/spec/data/lib/report.csv.tmp +3 -0
- data/spec/data/lib/report.sql +1 -0
- data/spec/data/lib/report.sql.tmp +1 -0
- data/spec/data/models/sql_intersect.sql +5 -0
- data/spec/data/models/sql_intersect.sql.tmp +5 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +21 -0
- data/spec/dummy/app/controllers/root_controller.rb +20 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/user.rb +13 -0
- data/spec/dummy/app/models/visit.rb +16 -0
- data/spec/dummy/app/reports/retention_cohort_report.rb +19 -0
- data/spec/dummy/app/reports/retention_report.rb +30 -0
- data/spec/dummy/app/reports/user_report.rb +23 -0
- data/spec/dummy/app/views/layouts/admin.html.erb +19 -0
- data/spec/dummy/app/views/layouts/application.html.erb +19 -0
- data/spec/dummy/app/views/root/index.html.erb +8 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +30 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +31 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/report_cat.rb +15 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +38 -0
- data/spec/dummy/config/routes.rb +13 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +26 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +61 -0
- data/spec/dummy/log/test.log +26478 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/report_cat/reports_helper_spec.rb +224 -0
- data/spec/lib/report_cat/config_spec.rb +96 -0
- data/spec/lib/report_cat/core/chart_spec.rb +67 -0
- data/spec/lib/report_cat/core/column_spec.rb +156 -0
- data/spec/lib/report_cat/core/param_spec.rb +95 -0
- data/spec/lib/report_cat/core/report_spec.rb +342 -0
- data/spec/lib/report_cat/engine_spec.rb +9 -0
- data/spec/lib/report_cat/matchers/have_chart_spec.rb +36 -0
- data/spec/lib/report_cat/matchers/have_column_spec.rb +30 -0
- data/spec/lib/report_cat/matchers/have_param_spec.rb +33 -0
- data/spec/lib/report_cat/reports/cohort_report_spec.rb +215 -0
- data/spec/lib/report_cat/reports/date_range_report_spec.rb +125 -0
- data/spec/lib/report_cat/version_spec.rb +11 -0
- data/spec/lib/report_cat_spec.rb +62 -0
- data/spec/lib/tasks/report_cat.rake_spec.rb +13 -0
- data/spec/models/report_cat/date_range_spec.rb +144 -0
- data/spec/rails_helper.rb +49 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/setup_reports.rb +28 -0
- data/spec/views/report_cat/reports/index.html.erb_spec.rb +16 -0
- data/spec/views/report_cat/reports/show.html.erb_spec.rb +19 -0
- metadata +489 -0
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ReportCat::ReportsController do
|
4
|
+
|
5
|
+
include SetupReports
|
6
|
+
|
7
|
+
routes { ReportCat::Engine.routes }
|
8
|
+
|
9
|
+
before( :each ) do
|
10
|
+
setup_reports
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'is a subclass of ApplicationController' do
|
14
|
+
expect( @controller ).to be_a_kind_of( ApplicationController )
|
15
|
+
end
|
16
|
+
|
17
|
+
#############################################################################
|
18
|
+
# index
|
19
|
+
|
20
|
+
describe '#index' do
|
21
|
+
|
22
|
+
it 'gets successfully' do
|
23
|
+
get :index
|
24
|
+
expect( response ).to be_success
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'assigns reports' do
|
28
|
+
get :index
|
29
|
+
expect( assigns( :reports ) ).to be_an_instance_of( HashWithIndifferentAccess )
|
30
|
+
end
|
31
|
+
|
32
|
+
pending 'uses the configured before authentication filter' do
|
33
|
+
expect( @controller ).to receive( :instance_eval ).with( &ReportCat.config.authenticate_with )
|
34
|
+
expect( @controller ).to receive( :instance_eval ).with( &ReportCat.config.authorize_with )
|
35
|
+
get :index
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'renders with the configured layout' do
|
39
|
+
get :index
|
40
|
+
expect( response ).to render_template( ReportCat.config.layout )
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
#############################################################################
|
46
|
+
# show
|
47
|
+
|
48
|
+
describe '#show' do
|
49
|
+
|
50
|
+
before( :each ) do
|
51
|
+
allow( @report ).to receive( :query )
|
52
|
+
allow( ReportCat ).to receive( :reports ).and_return( @reports )
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'gets successfully' do
|
56
|
+
get :show, :id => @report.name
|
57
|
+
expect( response ).to be_success
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'assigns report' do
|
61
|
+
get :show, :id => @report.name
|
62
|
+
expect( assigns( :report ) ).to be_an_instance_of( Report )
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'formatting CSV' do
|
66
|
+
|
67
|
+
it 'renders CSV' do
|
68
|
+
get :show, :id => @report.name, :format => 'csv'
|
69
|
+
expect( response ).to be_success
|
70
|
+
expect( response.content_type ).to eql( 'text/csv' )
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'formatting HTML' do
|
76
|
+
|
77
|
+
it 'renders HTML' do
|
78
|
+
get :show, :id => @report.name, :format => 'html'
|
79
|
+
expect( response ).to be_success
|
80
|
+
expect( response.content_type ).to eql( 'text/html' )
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
#############################################################################
|
88
|
+
# set_reports
|
89
|
+
|
90
|
+
describe '#set_reports' do
|
91
|
+
|
92
|
+
it 'memoizes get_reports in @reports' do
|
93
|
+
expect( ReportCat ).to receive( :reports ).and_return( @reports )
|
94
|
+
controller.send( :set_reports )
|
95
|
+
expect( assigns( :reports ) ).to eql( @reports )
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'coverage' do
|
4
|
+
|
5
|
+
it 'has a spec for every file' do
|
6
|
+
[
|
7
|
+
'app',
|
8
|
+
'lib',
|
9
|
+
].each do |dir|
|
10
|
+
Dir.glob( File.join( ENGINE_ROOT, dir, '**', '*.{rb,erb,rake}' ) ) do |path|
|
11
|
+
next if File.basename( path ) =~ /^_/
|
12
|
+
path = path.sub( /#{ENGINE_ROOT}\//, '' )
|
13
|
+
expect( path ).to have_a_spec
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<div chart="pie" class="chart" columns="[["string","day"],["number","total"]]" data="[["2013-09-17",27],["2013-09-18",270]]" name="Pie Chart Test" options="{}"></div><div chart="bar" class="chart" columns="[["string","day"],["number","total"]]" data="[["2013-09-17",27],["2013-09-18",270]]" name="Bar Chart Test" options="{}"></div><div chart="line" class="chart" columns="[["string","day"],["number","total"]]" data="[["2013-09-17",27],["2013-09-18",270]]" name="Line Chart Test" options="{}"></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div chart="pie" class="chart" columns="[["string","day"],["number","total"]]" data="[["2013-09-17",27],["2013-09-18",270]]" name="Pie Chart Test" options="{}"></div><div chart="bar" class="chart" columns="[["string","day"],["number","total"]]" data="[["2013-09-17",27],["2013-09-18",270]]" name="Bar Chart Test" options="{}"></div><div chart="line" class="chart" columns="[["string","day"],["number","total"]]" data="[["2013-09-17",27],["2013-09-18",270]]" name="Line Chart Test" options="{}"></div>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<form accept-charset="UTF-8" action="" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div><div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.check_box_test__Check_Box_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.check box test">check box test</span></label><input id="check_box_test" name="check_box_test" type="checkbox" value="1" /></div><div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.date_test__Date_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.date test">date test</span></label><select id="date_test_year" name="date_test[year]">
|
2
|
+
<option value="2008">2008</option>
|
3
|
+
<option value="2009">2009</option>
|
4
|
+
<option value="2010">2010</option>
|
5
|
+
<option value="2011">2011</option>
|
6
|
+
<option value="2012">2012</option>
|
7
|
+
<option selected="selected" value="2013">2013</option>
|
8
|
+
<option value="2014">2014</option>
|
9
|
+
<option value="2015">2015</option>
|
10
|
+
<option value="2016">2016</option>
|
11
|
+
<option value="2017">2017</option>
|
12
|
+
<option value="2018">2018</option>
|
13
|
+
</select>
|
14
|
+
<select id="date_test_month" name="date_test[month]">
|
15
|
+
<option value="1">January</option>
|
16
|
+
<option value="2">February</option>
|
17
|
+
<option value="3">March</option>
|
18
|
+
<option value="4">April</option>
|
19
|
+
<option value="5">May</option>
|
20
|
+
<option value="6">June</option>
|
21
|
+
<option value="7">July</option>
|
22
|
+
<option value="8">August</option>
|
23
|
+
<option selected="selected" value="9">September</option>
|
24
|
+
<option value="10">October</option>
|
25
|
+
<option value="11">November</option>
|
26
|
+
<option value="12">December</option>
|
27
|
+
</select>
|
28
|
+
<select id="date_test_day" name="date_test[day]">
|
29
|
+
<option value="1">1</option>
|
30
|
+
<option value="2">2</option>
|
31
|
+
<option value="3">3</option>
|
32
|
+
<option value="4">4</option>
|
33
|
+
<option value="5">5</option>
|
34
|
+
<option value="6">6</option>
|
35
|
+
<option value="7">7</option>
|
36
|
+
<option value="8">8</option>
|
37
|
+
<option value="9">9</option>
|
38
|
+
<option value="10">10</option>
|
39
|
+
<option value="11">11</option>
|
40
|
+
<option value="12">12</option>
|
41
|
+
<option value="13">13</option>
|
42
|
+
<option value="14">14</option>
|
43
|
+
<option value="15">15</option>
|
44
|
+
<option selected="selected" value="16">16</option>
|
45
|
+
<option value="17">17</option>
|
46
|
+
<option value="18">18</option>
|
47
|
+
<option value="19">19</option>
|
48
|
+
<option value="20">20</option>
|
49
|
+
<option value="21">21</option>
|
50
|
+
<option value="22">22</option>
|
51
|
+
<option value="23">23</option>
|
52
|
+
<option value="24">24</option>
|
53
|
+
<option value="25">25</option>
|
54
|
+
<option value="26">26</option>
|
55
|
+
<option value="27">27</option>
|
56
|
+
<option value="28">28</option>
|
57
|
+
<option value="29">29</option>
|
58
|
+
<option value="30">30</option>
|
59
|
+
<option value="31">31</option>
|
60
|
+
</select>
|
61
|
+
</div><div><label></label><input id="hidden_test" name="hidden_test" type="hidden" value="true" /></div><div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.select_test__Select_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.select test">select test</span></label><select id="select_test" name="select_test"><option selected="selected" value="1">1</option>
|
62
|
+
<option value="2">2</option>
|
63
|
+
<option value="3">3</option></select></div><div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.text_field_test__Text_Field_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.text field test">text field test</span></label><input id="text_field_test" name="text_field_test" type="text" /></div><input name="commit" type="submit" value="Report" /></form>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<form accept-charset="UTF-8" action="" method="get"><div style="display:none"><input name="utf8" type="hidden" value="✓" /></div><div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.check_box_test__Check_Box_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.check box test">check box test</span></label><input id="check_box_test" name="check_box_test" type="checkbox" value="1" /></div><div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.date_test__Date_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.date test">date test</span></label><select id="date_test_year" name="date_test[year]">
|
2
|
+
<option value="2008">2008</option>
|
3
|
+
<option value="2009">2009</option>
|
4
|
+
<option value="2010">2010</option>
|
5
|
+
<option value="2011">2011</option>
|
6
|
+
<option value="2012">2012</option>
|
7
|
+
<option selected="selected" value="2013">2013</option>
|
8
|
+
<option value="2014">2014</option>
|
9
|
+
<option value="2015">2015</option>
|
10
|
+
<option value="2016">2016</option>
|
11
|
+
<option value="2017">2017</option>
|
12
|
+
<option value="2018">2018</option>
|
13
|
+
</select>
|
14
|
+
<select id="date_test_month" name="date_test[month]">
|
15
|
+
<option value="1">January</option>
|
16
|
+
<option value="2">February</option>
|
17
|
+
<option value="3">March</option>
|
18
|
+
<option value="4">April</option>
|
19
|
+
<option value="5">May</option>
|
20
|
+
<option value="6">June</option>
|
21
|
+
<option value="7">July</option>
|
22
|
+
<option value="8">August</option>
|
23
|
+
<option selected="selected" value="9">September</option>
|
24
|
+
<option value="10">October</option>
|
25
|
+
<option value="11">November</option>
|
26
|
+
<option value="12">December</option>
|
27
|
+
</select>
|
28
|
+
<select id="date_test_day" name="date_test[day]">
|
29
|
+
<option value="1">1</option>
|
30
|
+
<option value="2">2</option>
|
31
|
+
<option value="3">3</option>
|
32
|
+
<option value="4">4</option>
|
33
|
+
<option value="5">5</option>
|
34
|
+
<option value="6">6</option>
|
35
|
+
<option value="7">7</option>
|
36
|
+
<option value="8">8</option>
|
37
|
+
<option value="9">9</option>
|
38
|
+
<option value="10">10</option>
|
39
|
+
<option value="11">11</option>
|
40
|
+
<option value="12">12</option>
|
41
|
+
<option value="13">13</option>
|
42
|
+
<option value="14">14</option>
|
43
|
+
<option value="15">15</option>
|
44
|
+
<option selected="selected" value="16">16</option>
|
45
|
+
<option value="17">17</option>
|
46
|
+
<option value="18">18</option>
|
47
|
+
<option value="19">19</option>
|
48
|
+
<option value="20">20</option>
|
49
|
+
<option value="21">21</option>
|
50
|
+
<option value="22">22</option>
|
51
|
+
<option value="23">23</option>
|
52
|
+
<option value="24">24</option>
|
53
|
+
<option value="25">25</option>
|
54
|
+
<option value="26">26</option>
|
55
|
+
<option value="27">27</option>
|
56
|
+
<option value="28">28</option>
|
57
|
+
<option value="29">29</option>
|
58
|
+
<option value="30">30</option>
|
59
|
+
<option value="31">31</option>
|
60
|
+
</select>
|
61
|
+
</div><input id="hidden_test" name="hidden_test" type="hidden" value="true" /><div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.select_test__Select_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.select test">select test</span></label><select id="select_test" name="select_test"><option selected="selected" value="1">1</option>
|
62
|
+
<option value="2">2</option>
|
63
|
+
<option value="3">3</option></select></div><div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.text_field_test__Text_Field_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.text field test">text field test</span></label><input id="text_field_test" name="text_field_test" type="text" /></div><input name="commit" type="submit" value="Report" /></form>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.check_box_test__Check_Box_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.check box test">check box test</span></label><input id="check_box_test" name="check_box_test" type="checkbox" value="1" /></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div><label for="_span_class__translation_missing__title__translation_missing:_en.report_cat.params.check_box_test__Check_Box_Test__span_"><span class="translation missing" title="translation missing: en.report cat.params.check box test">check box test</span></label><input id="check_box_test" name="check_box_test" type="checkbox" value="1" /></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<ul><li><a href="/report_cat/reports/test"><span class="translation_missing" title="translation missing: en.report_cat.instances.test.name">Name</span></a> - <span class="translation_missing" title="translation missing: en.report_cat.instances.test.description">Description</span></li></ul>
|
@@ -0,0 +1 @@
|
|
1
|
+
<ul><li><a href="/report_cat/reports/test"><span class="translation_missing" title="translation missing: en.report_cat.instances.test.name">Name</span></a> - <span class="translation_missing" title="translation missing: en.report_cat.instances.test.description">Description</span></li></ul>
|
@@ -0,0 +1 @@
|
|
1
|
+
<input id="check_box_test" name="check_box_test" type="checkbox" value="1" />
|
@@ -0,0 +1 @@
|
|
1
|
+
<input id="check_box_test" name="check_box_test" type="checkbox" value="1" />
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<select id="date_test_year" name="date_test[year]">
|
2
|
+
<option value="2008">2008</option>
|
3
|
+
<option value="2009">2009</option>
|
4
|
+
<option value="2010">2010</option>
|
5
|
+
<option value="2011">2011</option>
|
6
|
+
<option value="2012">2012</option>
|
7
|
+
<option selected="selected" value="2013">2013</option>
|
8
|
+
<option value="2014">2014</option>
|
9
|
+
<option value="2015">2015</option>
|
10
|
+
<option value="2016">2016</option>
|
11
|
+
<option value="2017">2017</option>
|
12
|
+
<option value="2018">2018</option>
|
13
|
+
</select>
|
14
|
+
<select id="date_test_month" name="date_test[month]">
|
15
|
+
<option value="1">January</option>
|
16
|
+
<option value="2">February</option>
|
17
|
+
<option value="3">March</option>
|
18
|
+
<option value="4">April</option>
|
19
|
+
<option value="5">May</option>
|
20
|
+
<option value="6">June</option>
|
21
|
+
<option value="7">July</option>
|
22
|
+
<option value="8">August</option>
|
23
|
+
<option selected="selected" value="9">September</option>
|
24
|
+
<option value="10">October</option>
|
25
|
+
<option value="11">November</option>
|
26
|
+
<option value="12">December</option>
|
27
|
+
</select>
|
28
|
+
<select id="date_test_day" name="date_test[day]">
|
29
|
+
<option value="1">1</option>
|
30
|
+
<option value="2">2</option>
|
31
|
+
<option value="3">3</option>
|
32
|
+
<option value="4">4</option>
|
33
|
+
<option value="5">5</option>
|
34
|
+
<option value="6">6</option>
|
35
|
+
<option value="7">7</option>
|
36
|
+
<option value="8">8</option>
|
37
|
+
<option value="9">9</option>
|
38
|
+
<option value="10">10</option>
|
39
|
+
<option value="11">11</option>
|
40
|
+
<option value="12">12</option>
|
41
|
+
<option value="13">13</option>
|
42
|
+
<option value="14">14</option>
|
43
|
+
<option value="15">15</option>
|
44
|
+
<option selected="selected" value="16">16</option>
|
45
|
+
<option value="17">17</option>
|
46
|
+
<option value="18">18</option>
|
47
|
+
<option value="19">19</option>
|
48
|
+
<option value="20">20</option>
|
49
|
+
<option value="21">21</option>
|
50
|
+
<option value="22">22</option>
|
51
|
+
<option value="23">23</option>
|
52
|
+
<option value="24">24</option>
|
53
|
+
<option value="25">25</option>
|
54
|
+
<option value="26">26</option>
|
55
|
+
<option value="27">27</option>
|
56
|
+
<option value="28">28</option>
|
57
|
+
<option value="29">29</option>
|
58
|
+
<option value="30">30</option>
|
59
|
+
<option value="31">31</option>
|
60
|
+
</select>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<select id="date_test_year" name="date_test[year]">
|
2
|
+
<option value="2008">2008</option>
|
3
|
+
<option value="2009">2009</option>
|
4
|
+
<option value="2010">2010</option>
|
5
|
+
<option value="2011">2011</option>
|
6
|
+
<option value="2012">2012</option>
|
7
|
+
<option selected="selected" value="2013">2013</option>
|
8
|
+
<option value="2014">2014</option>
|
9
|
+
<option value="2015">2015</option>
|
10
|
+
<option value="2016">2016</option>
|
11
|
+
<option value="2017">2017</option>
|
12
|
+
<option value="2018">2018</option>
|
13
|
+
</select>
|
14
|
+
<select id="date_test_month" name="date_test[month]">
|
15
|
+
<option value="1">January</option>
|
16
|
+
<option value="2">February</option>
|
17
|
+
<option value="3">March</option>
|
18
|
+
<option value="4">April</option>
|
19
|
+
<option value="5">May</option>
|
20
|
+
<option value="6">June</option>
|
21
|
+
<option value="7">July</option>
|
22
|
+
<option value="8">August</option>
|
23
|
+
<option selected="selected" value="9">September</option>
|
24
|
+
<option value="10">October</option>
|
25
|
+
<option value="11">November</option>
|
26
|
+
<option value="12">December</option>
|
27
|
+
</select>
|
28
|
+
<select id="date_test_day" name="date_test[day]">
|
29
|
+
<option value="1">1</option>
|
30
|
+
<option value="2">2</option>
|
31
|
+
<option value="3">3</option>
|
32
|
+
<option value="4">4</option>
|
33
|
+
<option value="5">5</option>
|
34
|
+
<option value="6">6</option>
|
35
|
+
<option value="7">7</option>
|
36
|
+
<option value="8">8</option>
|
37
|
+
<option value="9">9</option>
|
38
|
+
<option value="10">10</option>
|
39
|
+
<option value="11">11</option>
|
40
|
+
<option value="12">12</option>
|
41
|
+
<option value="13">13</option>
|
42
|
+
<option value="14">14</option>
|
43
|
+
<option value="15">15</option>
|
44
|
+
<option selected="selected" value="16">16</option>
|
45
|
+
<option value="17">17</option>
|
46
|
+
<option value="18">18</option>
|
47
|
+
<option value="19">19</option>
|
48
|
+
<option value="20">20</option>
|
49
|
+
<option value="21">21</option>
|
50
|
+
<option value="22">22</option>
|
51
|
+
<option value="23">23</option>
|
52
|
+
<option value="24">24</option>
|
53
|
+
<option value="25">25</option>
|
54
|
+
<option value="26">26</option>
|
55
|
+
<option value="27">27</option>
|
56
|
+
<option value="28">28</option>
|
57
|
+
<option value="29">29</option>
|
58
|
+
<option value="30">30</option>
|
59
|
+
<option value="31">31</option>
|
60
|
+
</select>
|
@@ -0,0 +1 @@
|
|
1
|
+
<input id="hidden_test" name="hidden_test" type="hidden" value="true" />
|
@@ -0,0 +1 @@
|
|
1
|
+
<input id="hidden_test" name="hidden_test" type="hidden" value="true" />
|
@@ -0,0 +1 @@
|
|
1
|
+
<input id="text_field_test" name="text_field_test" type="text" />
|
@@ -0,0 +1 @@
|
|
1
|
+
<input id="text_field_test" name="text_field_test" type="text" />
|
@@ -0,0 +1 @@
|
|
1
|
+
<table border="1"><tr><th>day</th><th>total</th></tr><tr><td>2013-09-17</td><td>27</td></tr><tr><td>2013-09-18</td><td>270</td></tr></table>
|
@@ -0,0 +1 @@
|
|
1
|
+
<table border="1"><tr><th>day</th><th>total</th></tr><tr><td>2013-09-17</td><td>27</td></tr><tr><td>2013-09-18</td><td>270</td></tr></table>
|
@@ -0,0 +1 @@
|
|
1
|
+
<table border="1"><tr></tr><tr></tr><tr></tr></table>
|
@@ -0,0 +1 @@
|
|
1
|
+
<table border="1"><tr></tr><tr></tr><tr></tr></table>
|
@@ -0,0 +1 @@
|
|
1
|
+
[["string","day"],["number","day"],["number","total"]]
|
@@ -0,0 +1 @@
|
|
1
|
+
[["string","day"],["number","day"],["number","total"]]
|
@@ -0,0 +1 @@
|
|
1
|
+
[["2013-09-17","2013-09-17",27],["2013-09-18","2013-09-18",270]]
|
@@ -0,0 +1 @@
|
|
1
|
+
[["2013-09-17","2013-09-17",27],["2013-09-18","2013-09-18",270]]
|
@@ -0,0 +1 @@
|
|
1
|
+
select day,total from
|
@@ -0,0 +1 @@
|
|
1
|
+
select day,total from
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
# Prevent CSRF attacks by raising an exception.
|
3
|
+
# For APIs, you may want to use :null_session instead.
|
4
|
+
protect_from_forgery with: :exception
|
5
|
+
|
6
|
+
# This just makes the reports reload in development
|
7
|
+
|
8
|
+
before_filter :require_reports if Rails.env.development?
|
9
|
+
|
10
|
+
def authenticate!
|
11
|
+
render :text => 'forbidden' unless cookies[ :login ]
|
12
|
+
end
|
13
|
+
|
14
|
+
def authorize!
|
15
|
+
end
|
16
|
+
|
17
|
+
def require_reports
|
18
|
+
Dir[Rails.root + 'app/reports/**/*.rb'].each { |path| require_dependency path }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class RootController < ApplicationController
|
2
|
+
|
3
|
+
def index
|
4
|
+
end
|
5
|
+
|
6
|
+
def login
|
7
|
+
cookies[ :login ] = { :value => true, :expires => 10.years.from_now }
|
8
|
+
redirect_to :action => :index
|
9
|
+
end
|
10
|
+
|
11
|
+
def logout
|
12
|
+
cookies.delete( :login )
|
13
|
+
redirect_to :action => :index
|
14
|
+
end
|
15
|
+
|
16
|
+
def admin
|
17
|
+
redirect_to root_path
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
|
3
|
+
def self.random( total, days )
|
4
|
+
User.record_timestamps = false
|
5
|
+
|
6
|
+
(1..total).each do |i|
|
7
|
+
User.create( :created_at => Time.now - rand( days ).days, :activated => ( rand >= 0.5 ) )
|
8
|
+
end
|
9
|
+
|
10
|
+
User.record_timestamps = true
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|