mongoid_wice_grid 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/CHANGELOG +409 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +140 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +1188 -0
- data/Rakefile +40 -0
- data/SAVED_QUERIES_HOWTO.rdoc +123 -0
- data/VERSION +1 -0
- data/lib/filter_conditions_generators.rb +126 -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 +269 -0
- data/lib/generators/wice_grid/templates/wice_grid_config.rb +215 -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 +547 -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 +82 -0
- data/lib/helpers/wice_grid_view_helpers.rb +761 -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/mongoid_field.rb +50 -0
- data/lib/tasks/wice_grid_tasks.rake +28 -0
- data/lib/view_columns.rb +464 -0
- data/lib/views/create.rjs +13 -0
- data/lib/views/delete.rjs +12 -0
- data/lib/wice_grid.rb +521 -0
- data/lib/wice_grid_controller.rb +165 -0
- data/lib/wice_grid_core_ext.rb +179 -0
- data/lib/wice_grid_misc.rb +99 -0
- data/lib/wice_grid_serialized_queries_controller.rb +77 -0
- data/lib/wice_grid_serialized_query.rb +14 -0
- data/lib/wice_grid_spreadsheet.rb +33 -0
- data/test/.gitignore +2 -0
- data/test/blueprint.rb +17 -0
- data/test/database.yml +21 -0
- data/test/public/javascripts/jquery-1.4.2.min.js +154 -0
- data/test/public/javascripts/wice_grid.js +163 -0
- data/test/rails_mongoid_test.rb +104 -0
- data/test/rails_test_app.rb +71 -0
- data/test/require_gems.rb +19 -0
- data/test/schema.rb +33 -0
- data/test/spec_helper.rb +22 -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_initializer.rb +215 -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
- metadata +150 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
require "action_controller/railtie"
|
2
|
+
require "active_resource/railtie"
|
3
|
+
require 'wice_grid'
|
4
|
+
|
5
|
+
module Test
|
6
|
+
class Application < Rails::Application
|
7
|
+
config.secret_token = '84198d9ba8d271b3d95d252b17601cb0f4b18b5a790d0c1d9bcce95e1c03d9d6f615b21b66986a2bf2ea9b5e850e30f09dfbfa9ffa2586b8ce1f5f1a2e4a460d'
|
8
|
+
config.public_path = File.join(File.dirname(__FILE__), '/public')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Computer
|
13
|
+
include Mongoid::Document
|
14
|
+
belongs_to_related :user
|
15
|
+
field :name
|
16
|
+
end
|
17
|
+
|
18
|
+
class User
|
19
|
+
include Mongoid::Document
|
20
|
+
|
21
|
+
#identity :type => String
|
22
|
+
field :first_name
|
23
|
+
field :year, :type => Date
|
24
|
+
field :last_login, :type => Time
|
25
|
+
field :computers_number, :type => Integer
|
26
|
+
field :archived, :type => Boolean
|
27
|
+
|
28
|
+
def self.merge_conditions(*conditions)
|
29
|
+
""
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class UsersController < ActionController::Base
|
34
|
+
|
35
|
+
def self.columns(&block)
|
36
|
+
@@define_columns = block
|
37
|
+
end
|
38
|
+
|
39
|
+
def columns(grid)
|
40
|
+
@@define_columns.call(grid)
|
41
|
+
end
|
42
|
+
|
43
|
+
def index
|
44
|
+
@users_grid = initialize_grid(User)
|
45
|
+
render :inline => <<TEMPLATE
|
46
|
+
|
47
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
48
|
+
<html lang='en_us' xml:lang='en_us' xmlns='http://www.w3.org/1999/xhtml'>
|
49
|
+
<head>
|
50
|
+
<%= javascript_include_tag "jquery-1.4.2.min" %>
|
51
|
+
<%= include_wice_grid_assets %>
|
52
|
+
</head>
|
53
|
+
<body>
|
54
|
+
<%=
|
55
|
+
grid(@users_grid) do |g|
|
56
|
+
controller.columns(g)
|
57
|
+
end
|
58
|
+
%>
|
59
|
+
</body>
|
60
|
+
</html>
|
61
|
+
TEMPLATE
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
Test::Application.initialize!
|
66
|
+
Test::Application.routes.draw do
|
67
|
+
resources :users
|
68
|
+
end
|
69
|
+
|
70
|
+
require 'test/wice_grid_initializer'
|
71
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
lib_dir = File.dirname(__FILE__) + '/../lib'
|
2
|
+
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
|
6
|
+
gemfile = File.expand_path('Gemfile', __FILE__)
|
7
|
+
begin
|
8
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
9
|
+
require 'bundler'
|
10
|
+
Bundler.setup
|
11
|
+
rescue Bundler::GemNotFound => e
|
12
|
+
STDERR.puts e.message
|
13
|
+
STDERR.puts "Try running `bundle install`."
|
14
|
+
exit!
|
15
|
+
end if File.exist?(gemfile)
|
16
|
+
|
17
|
+
require 'bundler'
|
18
|
+
Bundler.require(:default, :test)# if defined?(Bundler)
|
19
|
+
|
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/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '/require_gems')
|
2
|
+
require File.join(File.dirname(__FILE__), '/rails_test_app')
|
3
|
+
|
4
|
+
require 'capybara'
|
5
|
+
require 'capybara/dsl'
|
6
|
+
Capybara.app = Rails.application
|
7
|
+
Capybara.save_and_open_page_path = File.join(File.dirname(__FILE__), '/public')
|
8
|
+
|
9
|
+
RSpec.configure do |rspec_config|
|
10
|
+
rspec_config.before(:each) do
|
11
|
+
Mongoid.configure do |mongoid_config|
|
12
|
+
name = "test_wice_grid"
|
13
|
+
host = "localhost"
|
14
|
+
mongoid_config.master = Mongo::Connection.new.db(name)
|
15
|
+
mongoid_config.master.collections.select{ |c| c.name != 'system.indexes' }.each { |c| c.drop }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'test/blueprint'
|
21
|
+
|
22
|
+
|
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
|