wice_grid 3.0.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/CHANGELOG +412 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +1179 -0
- data/Rakefile +42 -0
- data/SAVED_QUERIES_HOWTO.rdoc +123 -0
- data/VERSION +1 -0
- data/lib/generators/wice_grid/templates/calendarview.css +107 -0
- data/lib/generators/wice_grid/templates/calendarview.js +1168 -0
- data/lib/generators/wice_grid/templates/icons/arrow_down.gif +0 -0
- data/lib/generators/wice_grid/templates/icons/arrow_up.gif +0 -0
- data/lib/generators/wice_grid/templates/icons/calendar_view_month.png +0 -0
- data/lib/generators/wice_grid/templates/icons/delete.png +0 -0
- data/lib/generators/wice_grid/templates/icons/expand.png +0 -0
- data/lib/generators/wice_grid/templates/icons/page_white_excel.png +0 -0
- data/lib/generators/wice_grid/templates/icons/page_white_find.png +0 -0
- data/lib/generators/wice_grid/templates/icons/table.png +0 -0
- data/lib/generators/wice_grid/templates/icons/table_refresh.png +0 -0
- data/lib/generators/wice_grid/templates/icons/tick_all.png +0 -0
- data/lib/generators/wice_grid/templates/icons/untick_all.png +0 -0
- data/lib/generators/wice_grid/templates/wice_grid.css +173 -0
- data/lib/generators/wice_grid/templates/wice_grid.yml +279 -0
- data/lib/generators/wice_grid/templates/wice_grid_config.rb +154 -0
- data/lib/generators/wice_grid/templates/wice_grid_jquery.js +161 -0
- data/lib/generators/wice_grid/templates/wice_grid_prototype.js +153 -0
- data/lib/generators/wice_grid/wice_grid_assets_jquery_generator.rb +32 -0
- data/lib/generators/wice_grid/wice_grid_assets_prototype_generator.rb +34 -0
- data/lib/grid_output_buffer.rb +52 -0
- data/lib/grid_renderer.rb +535 -0
- data/lib/helpers/js_calendar_helpers.rb +183 -0
- data/lib/helpers/wice_grid_misc_view_helpers.rb +113 -0
- data/lib/helpers/wice_grid_serialized_queries_view_helpers.rb +91 -0
- data/lib/helpers/wice_grid_view_helpers.rb +781 -0
- data/lib/js_adaptors/jquery_adaptor.rb +145 -0
- data/lib/js_adaptors/js_adaptor.rb +12 -0
- data/lib/js_adaptors/prototype_adaptor.rb +168 -0
- data/lib/table_column_matrix.rb +51 -0
- data/lib/tasks/wice_grid_tasks.rake +28 -0
- data/lib/view_columns.rb +486 -0
- data/lib/views/create.rjs +13 -0
- data/lib/views/create_jq.rjs +31 -0
- data/lib/views/delete.rjs +12 -0
- data/lib/views/delete_jq.rjs +26 -0
- data/lib/wice_grid.rb +827 -0
- data/lib/wice_grid_controller.rb +165 -0
- data/lib/wice_grid_core_ext.rb +179 -0
- data/lib/wice_grid_misc.rb +98 -0
- data/lib/wice_grid_serialized_queries_controller.rb +86 -0
- data/lib/wice_grid_serialized_query.rb +15 -0
- data/lib/wice_grid_spreadsheet.rb +33 -0
- data/test/.gitignore +2 -0
- data/test/database.yml +21 -0
- data/test/schema.rb +33 -0
- data/test/test_helper.rb +89 -0
- data/test/views/projects_and_people_grid.html.erb +12 -0
- data/test/views/projects_and_people_grid_invalid.html.erb +12 -0
- data/test/views/simple_projects_grid.html.erb +9 -0
- data/test/wice_grid_core_ext_test.rb +183 -0
- data/test/wice_grid_functional_test.rb +68 -0
- data/test/wice_grid_misc_test.rb +41 -0
- data/test/wice_grid_test.rb +42 -0
- data/test/wice_grid_view_helper_test.rb +12 -0
- data/wice_grid.gemspec +111 -0
- metadata +153 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
class WiceGridSerializedQuery < ActiveRecord::Base #:nodoc:
|
3
|
+
serialize :query
|
4
|
+
|
5
|
+
validates_uniqueness_of :name, :scope => :grid_name, :on => :create,
|
6
|
+
:message => 'A query with this name already exists'
|
7
|
+
|
8
|
+
validates_presence_of :name, :message => 'Please submit the name of the custom query'
|
9
|
+
|
10
|
+
def self.list(name, controller)
|
11
|
+
conditions = {:grid_name => name}
|
12
|
+
self.find(:all, :conditions => conditions)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'csv'
|
3
|
+
|
4
|
+
module Wice
|
5
|
+
class Spreadsheet #:nodoc:
|
6
|
+
|
7
|
+
attr_reader :tempfile
|
8
|
+
# CSV in 1.9.1 is a version of FasterCSV
|
9
|
+
if RUBY_VERSION == '1.9.1' || RUBY_VERSION == '1.9.2'
|
10
|
+
|
11
|
+
def initialize(name, field_separator) #:nodoc:
|
12
|
+
@tempfile = Tempfile.new(name)
|
13
|
+
@csv = CSV.new(@tempfile, :col_sep => field_separator)
|
14
|
+
end
|
15
|
+
|
16
|
+
def << (row) #:nodoc:
|
17
|
+
@csv << row
|
18
|
+
end
|
19
|
+
|
20
|
+
else
|
21
|
+
def initialize(name, field_separator) #:nodoc:
|
22
|
+
@tempfile = Tempfile.new(name)
|
23
|
+
@field_separator = field_separator
|
24
|
+
end
|
25
|
+
|
26
|
+
def << (row) #:nodoc:
|
27
|
+
CSV::Writer.generate(@tempfile, @field_separator) do |csv|
|
28
|
+
csv << row.map(&:to_s)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/test/.gitignore
ADDED
data/test/database.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
sqlite:
|
2
|
+
:adapter: sqlite
|
3
|
+
:dbfile: vendor/plugins/wice_grid/test/wice_grid_plugin.sqlite.db
|
4
|
+
|
5
|
+
sqlite3:
|
6
|
+
:adapter: sqlite3
|
7
|
+
:dbfile: vendor/plugins/wice_grid/test/wice_grid_plugin.sqlite3.db
|
8
|
+
|
9
|
+
postgresql:
|
10
|
+
:adapter: postgresql
|
11
|
+
:username: postgres
|
12
|
+
:password: postgres
|
13
|
+
:database: wice_grid_plugin_test
|
14
|
+
:min_messages: ERROR
|
15
|
+
|
16
|
+
mysql:
|
17
|
+
:adapter: mysql
|
18
|
+
:host: localhost
|
19
|
+
:username: root
|
20
|
+
:password:
|
21
|
+
:database: wice_grid_plugin_test
|
data/test/schema.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
|
3
|
+
create_table :people, :force => true do |t|
|
4
|
+
t.string :firstname
|
5
|
+
t.string :lastname
|
6
|
+
t.string :email
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table :projects, :force => true do |t|
|
11
|
+
t.string :name
|
12
|
+
t.integer :person_id
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
|
16
|
+
create_table :tasks, :force => true do |t|
|
17
|
+
t.integer :project_id
|
18
|
+
t.integer :person_id
|
19
|
+
t.string :name
|
20
|
+
t.text :description
|
21
|
+
t.boolean :done
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table :saved_queries, :force => true do |t|
|
26
|
+
t.column :name, :string
|
27
|
+
t.column :grid_name, :string
|
28
|
+
t.column :query, :text
|
29
|
+
t.column :grid_hash, :string
|
30
|
+
|
31
|
+
t.timestamps
|
32
|
+
end
|
33
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
ENV['RAILS_ENV'] = 'test'
|
2
|
+
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
|
3
|
+
|
4
|
+
ENV['DB'] = 'mysql'
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
|
8
|
+
|
9
|
+
def load_schema
|
10
|
+
|
11
|
+
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
12
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
13
|
+
|
14
|
+
db_adapter = ENV['DB']
|
15
|
+
|
16
|
+
# no db passed, try one of these fine config-free DBs before bombing.
|
17
|
+
db_adapter ||=
|
18
|
+
begin
|
19
|
+
require 'rubygems'
|
20
|
+
require 'sqlite'
|
21
|
+
'sqlite'
|
22
|
+
rescue MissingSourceFile
|
23
|
+
begin
|
24
|
+
require 'sqlite3'
|
25
|
+
'sqlite3'
|
26
|
+
rescue MissingSourceFile
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if db_adapter.nil?
|
31
|
+
raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
|
32
|
+
end
|
33
|
+
|
34
|
+
ActiveRecord::Base.establish_connection(config[db_adapter])
|
35
|
+
load(File.dirname(__FILE__) + "/schema.rb")
|
36
|
+
require File.dirname(__FILE__) + '/../init.rb'
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
#
|
42
|
+
#
|
43
|
+
|
44
|
+
require File.join(File.dirname(__FILE__), '../generators/wice_grid_assets/templates/initializers/wice_grid_config.rb')
|
45
|
+
|
46
|
+
load_schema
|
47
|
+
|
48
|
+
class Person < ActiveRecord::Base
|
49
|
+
has_many :projects
|
50
|
+
has_many :tasks
|
51
|
+
end
|
52
|
+
|
53
|
+
class Project < ActiveRecord::Base
|
54
|
+
belongs_to :person
|
55
|
+
validates_presence_of :person_id
|
56
|
+
end
|
57
|
+
|
58
|
+
class Task < ActiveRecord::Base
|
59
|
+
belongs_to :project
|
60
|
+
belongs_to :person
|
61
|
+
validates_presence_of :project_id
|
62
|
+
validates_presence_of :person_id
|
63
|
+
end
|
64
|
+
|
65
|
+
class SavedQuery < ActiveRecord::Base
|
66
|
+
def self.list(a, b)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
NUM_PEOPLE = 10
|
71
|
+
NUM_PROJECTS = 5
|
72
|
+
NUM_TASKS = 1000
|
73
|
+
|
74
|
+
NUM_PEOPLE.times do |i|
|
75
|
+
Person.create!(:firstname => "Firstname%02d" % i, :lastname => "Lastname%02d" % i, :email => "user%02d@example.com" % i)
|
76
|
+
end
|
77
|
+
|
78
|
+
NUM_PROJECTS.times do |i|
|
79
|
+
Project.create!(:name => "Project%02d" % i, :person => Person.all[i % NUM_PEOPLE])
|
80
|
+
end
|
81
|
+
|
82
|
+
NUM_TASKS.times do |i|
|
83
|
+
project = Project.find(:first, :order => 'RAND()')
|
84
|
+
owner = Person.find(:first, :order => 'RAND()')
|
85
|
+
Task.create!(:name => "Task%03d" % i,
|
86
|
+
:description => "Description%03d" % i,
|
87
|
+
:person => Person.all[i % NUM_PEOPLE],
|
88
|
+
:project => Project.all[i % NUM_PROJECTS])
|
89
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= grid(@grid) do |g|
|
2
|
+
|
3
|
+
g.column(:attribute_name => 'name')
|
4
|
+
|
5
|
+
g.column(:attribute_name => 'firstname', :model_class => 'Person')
|
6
|
+
g.column(:attribute_name => 'lastname', :model_class => 'Person')
|
7
|
+
|
8
|
+
g.column(:attribute_name => 'updated_at') do |project|
|
9
|
+
project.updated_at.strftime("%d/%m/%Y %H:%M")
|
10
|
+
end
|
11
|
+
|
12
|
+
end -%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= grid(@grid) do |g|
|
2
|
+
|
3
|
+
g.column(:attribute_name => 'name')
|
4
|
+
|
5
|
+
g.column(:attribute_name => 'firstname', :model_class => 'Person')
|
6
|
+
g.column(:attribute_name => 'lastname', :model_class => 'Person')
|
7
|
+
|
8
|
+
g.column(:attribute_name => 'updated_at') do |project|
|
9
|
+
project.updated_at.strftime("%d/%m/%Y %H:%M")
|
10
|
+
end
|
11
|
+
|
12
|
+
end -%>
|
@@ -0,0 +1,183 @@
|
|
1
|
+
# More or less complete
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
5
|
+
|
6
|
+
class WiceGridCoreExtTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
#
|
9
|
+
# Hash
|
10
|
+
#
|
11
|
+
|
12
|
+
def test_rec_merge
|
13
|
+
|
14
|
+
# required for will_paginate
|
15
|
+
# read this - http://err.lighthouseapp.com/projects/466/tickets/197-using-param_name-something-page-leads-to-invalid-behavior
|
16
|
+
|
17
|
+
a_hash = {34 => 12, :key1 => 87, :key2 => {:f => 67} }
|
18
|
+
b_hash = {34 => 'x', :key3 => 987, :key2 => {:key4 => {:key5 => 0} } }
|
19
|
+
|
20
|
+
assert_equal({:key3 => 987, 34 => "x", :key1 => 87, :key2 => {:key4 => {:key5 => 0}, :f => 67}} , a_hash.rec_merge(b_hash))
|
21
|
+
|
22
|
+
a_hash = {34 => 12, :key1 => 87}
|
23
|
+
b_hash = {34 => 12}
|
24
|
+
|
25
|
+
assert_equal({34 => 12, :key1 => 87} , a_hash.rec_merge(b_hash))
|
26
|
+
|
27
|
+
a_hash = {34 => { :f => :moo}, :key1 => 87}
|
28
|
+
b_hash = {34 => { :k => [1,2, { :z => :baz }]}, :key1 => 87}
|
29
|
+
|
30
|
+
assert_equal({34 => { :f => :moo, :k => [1,2, { :z => :baz}]}, :key1 => 87} , a_hash.rec_merge(b_hash))
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_hash_make_hash
|
35
|
+
|
36
|
+
assert_equal({}, Hash.make_hash(:key, nil))
|
37
|
+
assert_equal({}, Hash.make_hash(:key, ''))
|
38
|
+
|
39
|
+
assert_equal({:key => "value"}, Hash.make_hash(:key, "value"))
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_hash_deep_clone_yl
|
44
|
+
|
45
|
+
a = {}
|
46
|
+
b = a.deep_clone_yl
|
47
|
+
assert_equal a, b
|
48
|
+
assert_not_same a, b
|
49
|
+
|
50
|
+
a = {'a' => 'b'}
|
51
|
+
b = a.deep_clone_yl
|
52
|
+
assert_equal a, b
|
53
|
+
assert_not_same a, b
|
54
|
+
|
55
|
+
a = {'a' => 'b', 'c' => {'d' => 'e'}}
|
56
|
+
b = a.deep_clone_yl
|
57
|
+
assert_equal a, b
|
58
|
+
assert_equal a['c'], b['c']
|
59
|
+
assert_not_same a, b
|
60
|
+
assert_not_same a['c'], b['c']
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_hash_add_or_append_class_value_on_empty_hash
|
65
|
+
|
66
|
+
h = {}
|
67
|
+
|
68
|
+
h.add_or_append_class_value!('foo')
|
69
|
+
assert_equal({:class => 'foo'}, h)
|
70
|
+
|
71
|
+
res = h.add_or_append_class_value!('bar')
|
72
|
+
assert_equal({:class => 'foo bar'}, h)
|
73
|
+
|
74
|
+
assert_equal(res, h)
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_hash_add_or_append_class_value_key_normalization
|
79
|
+
|
80
|
+
h = {'class' => 'foo'}
|
81
|
+
|
82
|
+
h.add_or_append_class_value!('bar')
|
83
|
+
assert_equal({:class => 'foo bar'}, h)
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_hash_parameter_names_and_values
|
88
|
+
|
89
|
+
assert_equal([], {}.parameter_names_and_values)
|
90
|
+
assert_equal([], {}.parameter_names_and_values(%w(foo)))
|
91
|
+
|
92
|
+
|
93
|
+
assert_equal([['a', 'b']], {'a' => 'b'}.parameter_names_and_values)
|
94
|
+
assert_equal([['a', 'b'], ['c[d]', 'e']], {'a' => 'b', 'c' => {'d' => 'e'}}.parameter_names_and_values)
|
95
|
+
|
96
|
+
assert_equal([['foo[a]', 'b']], {'a' => 'b'}.parameter_names_and_values(%w(foo)))
|
97
|
+
assert_equal([['foo[a]', 'b'], ['foo[c][d]', 'e']], {'a' => 'b', 'c' => {'d' => 'e'}}.parameter_names_and_values(%w(foo)))
|
98
|
+
|
99
|
+
assert_equal(
|
100
|
+
[["a[d][e]", 5], ["a[b]", 3], ["a[c]", 4]].sort,
|
101
|
+
{ :a => { :b => 3, :c => 4, :d => { :e => 5 }} }.parameter_names_and_values.sort
|
102
|
+
)
|
103
|
+
|
104
|
+
assert_equal(
|
105
|
+
[["foo[baz][a][d][e]", 5], ["foo[baz][a][b]", 3], ["foo[baz][a][c]", 4]].sort,
|
106
|
+
{ :a => { :b => 3, :c => 4, :d => { :e => 5 }} }.parameter_names_and_values(['foo', 'baz']).sort
|
107
|
+
)
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
# Enumerable
|
113
|
+
#
|
114
|
+
|
115
|
+
def test_enumerable_all_items_are_of_class
|
116
|
+
|
117
|
+
assert([].respond_to?(:all_items_are_of_class))
|
118
|
+
assert({}.respond_to?(:all_items_are_of_class))
|
119
|
+
|
120
|
+
assert_equal false, [].all_items_are_of_class(Object)
|
121
|
+
|
122
|
+
assert_equal true, [1, 2, 3].all_items_are_of_class(Numeric)
|
123
|
+
assert_equal true, %(one two three).all_items_are_of_class(String)
|
124
|
+
|
125
|
+
assert_equal false, [1, 2, "apple"].all_items_are_of_class(String)
|
126
|
+
assert_equal false, [1, 2, nil].all_items_are_of_class(String)
|
127
|
+
assert_equal false, [1, 2.5].all_items_are_of_class(String)
|
128
|
+
|
129
|
+
assert_equal true, [1, 2, "apple"].all_items_are_of_class(Object)
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
#
|
134
|
+
# Object
|
135
|
+
#
|
136
|
+
|
137
|
+
def test_object_deep_send
|
138
|
+
|
139
|
+
wrapper = Struct.new(:hop)
|
140
|
+
|
141
|
+
z = wrapper.new(123)
|
142
|
+
y = wrapper.new(z)
|
143
|
+
x = wrapper.new(y)
|
144
|
+
|
145
|
+
assert_equal x, x.deep_send
|
146
|
+
assert_equal y, x.deep_send(:hop)
|
147
|
+
assert_equal z, x.deep_send(:hop, :hop)
|
148
|
+
assert_equal 123, x.deep_send(:hop, :hop, :hop)
|
149
|
+
|
150
|
+
assert_nil x.deep_send(:non_existing_method)
|
151
|
+
assert_nil x.deep_send(:hop, :non_existing_method)
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
#
|
157
|
+
# Array
|
158
|
+
#
|
159
|
+
|
160
|
+
def test_array_to_parameter_name
|
161
|
+
|
162
|
+
assert_equal '', [].to_parameter_name
|
163
|
+
assert_equal 'foo', %w(foo).to_parameter_name
|
164
|
+
assert_equal 'foo[bar]', %w(foo bar).to_parameter_name
|
165
|
+
assert_equal 'foo[bar][baz]', %w(foo bar baz).to_parameter_name
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
#
|
170
|
+
# ActionView
|
171
|
+
#
|
172
|
+
|
173
|
+
include ActionView::Helpers::TagHelper
|
174
|
+
|
175
|
+
def test_action_view_tag_options_visibility
|
176
|
+
assert_nothing_raised {
|
177
|
+
tag_options({})
|
178
|
+
}
|
179
|
+
assert_equal(%! class="foo" style="baz"!, tag_options({:class => 'foo', :style => 'baz'}))
|
180
|
+
end
|
181
|
+
|
182
|
+
|
183
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
|
4
|
+
require 'action_controller/test_process'
|
5
|
+
|
6
|
+
class TestControllerBase < ActionController::Base
|
7
|
+
|
8
|
+
def render_wice_grid_view(name)
|
9
|
+
render :file => File.join(File.dirname(__FILE__), "views/#{name}.html.erb")
|
10
|
+
end
|
11
|
+
|
12
|
+
def rescue_action(e)
|
13
|
+
raise e
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class ProjectsController < TestControllerBase
|
19
|
+
|
20
|
+
def index
|
21
|
+
@grid = initialize_grid(Project, :order => 'created_at', :order_direction => 'DESC')
|
22
|
+
render_wice_grid_view('simple_projects_grid')
|
23
|
+
end
|
24
|
+
|
25
|
+
def index2
|
26
|
+
@grid = initialize_grid(Project, :include => :person, :order => 'created_at', :order_direction => 'DESC')
|
27
|
+
render_wice_grid_view('projects_and_people_grid')
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# class TasksController < TestControllerBase
|
33
|
+
#
|
34
|
+
# def index
|
35
|
+
# @grid = initialize_grid(Task, :include => [{:project => :person}, :person])
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# end
|
39
|
+
|
40
|
+
class WiceGridFunctionalTest < ActionController::TestCase
|
41
|
+
|
42
|
+
def setup
|
43
|
+
|
44
|
+
@controller = ProjectsController.new
|
45
|
+
@request = ActionController::TestRequest.new
|
46
|
+
@response = ActionController::TestResponse.new
|
47
|
+
|
48
|
+
ActionController::Routing::Routes.draw do |map|
|
49
|
+
map.resources :projects
|
50
|
+
map.resources :tasks
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_index_without_parameters
|
56
|
+
get :index
|
57
|
+
assert_response :success
|
58
|
+
assert css_select("table")
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_index2_without_parameters
|
62
|
+
#
|
63
|
+
# get :index2
|
64
|
+
# assert_response :success
|
65
|
+
#assert css_select("table")
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|