admin_data 1.1.12 → 1.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/app/controllers/admin_data/analytics_controller.rb +38 -0
- data/app/controllers/admin_data/public_controller.rb +2 -0
- data/app/controllers/admin_data/search_controller.rb +10 -5
- data/app/helpers/admin_data/application_helper.rb +21 -0
- data/app/views/admin_data/analytics/_bar_chart.html.erb +39 -0
- data/app/views/admin_data/analytics/index.html.erb +41 -0
- data/app/views/admin_data/search/search/_advance_search_form.html.erb +1 -7
- data/app/views/admin_data/search/search/_listing.html.erb +4 -2
- data/app/views/admin_data/search/search/_search_form.html.erb +0 -1
- data/app/views/admin_data/shared/_secondary_navigation.html.erb +5 -0
- data/app/views/layouts/admin_data.html.erb +4 -1
- data/config/routes.rb +8 -5
- data/lib/admin_data/analytics.rb +176 -0
- data/lib/admin_data/exceptions.rb +5 -0
- data/lib/admin_data/search.rb +139 -137
- data/lib/admin_data/version.rb +1 -1
- data/lib/admin_data.rb +3 -0
- data/lib/public/images/sort_by_asc.jpg +0 -0
- data/lib/public/images/sort_by_desc.jpg +0 -0
- data/lib/public/images/sort_by_nothing.jpg +0 -0
- data/lib/public/javascripts/advance_search/sortby.js +14 -0
- data/lib/public/javascripts/analytics/report.js +7 -0
- data/lib/public/stylesheets/base.css +25 -1
- data/test/rails_root/Gemfile +15 -12
- data/test/rails_root/Gemfile.lock +8 -2
- data/test/rails_root/README.md +16 -8
- data/test/rails_root/app/models/car.rb +3 -0
- data/test/rails_root/config/application.rb +0 -27
- data/test/rails_root/config/cucumber.yml +0 -2
- data/test/rails_root/config/database.yml.mysql +22 -0
- data/test/rails_root/config/database.yml.pg +15 -0
- data/test/rails_root/config/{database.yml → database.yml.sqlite3} +1 -1
- data/test/rails_root/db/development.sqlite3 +0 -0
- data/test/rails_root/db/migrate/{20091030202259_create_users.rb → 20091030202259_create_tables.rb} +7 -1
- data/test/rails_root/db/schema.rb +6 -0
- data/test/rails_root/features/quick_search.feature +0 -11
- data/test/rails_root/lib/tasks/dbs.rake +30 -0
- data/test/rails_root/lib/tasks/sample_cars.rake +18 -0
- data/test/rails_root/test/unit/car_test.rb +100 -0
- metadata +30 -13
- data/app/views/admin_data/search/search/_sortby.html.erb +0 -19
- data/test/rails_root/features/advance_search/sort.feature +0 -16
- data/test/rails_root/test/performance/browsing_test.rb +0 -9
data/lib/admin_data/search.rb
CHANGED
@@ -1,186 +1,188 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module AdminData
|
2
|
+
module Search
|
3
|
+
|
4
|
+
class Dbbase
|
5
|
+
def initialize(operands, table_name, field_name, operator)
|
6
|
+
@operands = operands
|
7
|
+
@table_name = table_name
|
8
|
+
@field_name = field_name
|
9
|
+
@operator = operator
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def like_operator
|
13
|
+
'LIKE'
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
def sql_field_name
|
17
|
+
"#{@table_name}.#{@field_name}"
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
def operands
|
21
|
+
@operands
|
22
|
+
end
|
21
23
|
end
|
22
|
-
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
class PostgresqlSpecific < Dbbase
|
26
|
+
def like_operator
|
27
|
+
'ILIKE'
|
28
|
+
end
|
27
29
|
end
|
28
|
-
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
class OracleSpecific < Dbbase
|
32
|
+
def sql_field_name
|
33
|
+
result = super
|
34
|
+
%w(contains is_exactly does_not_contain).include?(@operator) ? "upper(#{result})" : result
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
def operands
|
38
|
+
result = super
|
39
|
+
%w(contains is_exactly does_not_contain).include?(@operator) ? result.upcase : result
|
40
|
+
end
|
39
41
|
end
|
40
|
-
end
|
41
42
|
|
42
|
-
|
43
|
+
class Term
|
43
44
|
|
44
|
-
|
45
|
+
attr_accessor :error, :table_name, :field, :operator, :operands, :dbbase
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
def initialize(klass, value, search_type)
|
48
|
+
@table_name = klass.table_name
|
49
|
+
compute_search_fields(value)
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
adapter = AdminData.config.adapter_name.downcase
|
52
|
+
if adapter =~ /postgresql/
|
53
|
+
self.dbbase = PostgresqlSpecific.new(@operands, table_name, field, operator)
|
54
|
+
elsif adapter =~ /oracle/
|
55
|
+
self.dbbase = OracleSpecific.new(@operands, table_name, field, operator)
|
56
|
+
else
|
57
|
+
self.dbbase = Dbbase.new(@operands, table_name, field, operator)
|
58
|
+
end
|
57
59
|
end
|
58
|
-
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
def attribute_condition
|
62
|
+
return if valid? && operand_required? && operands.blank?
|
63
|
+
case operator
|
64
|
+
when 'contains'
|
65
|
+
["#{sql_field_name} #{like_operator} ?","%#{operands}%"]
|
65
66
|
|
66
|
-
|
67
|
-
|
67
|
+
when 'is_exactly'
|
68
|
+
["#{sql_field_name} = ?", operands]
|
68
69
|
|
69
|
-
|
70
|
-
|
70
|
+
when 'does_not_contain'
|
71
|
+
["#{sql_field_name} IS NULL OR #{sql_field_name} NOT #{like_operator} ?","%#{operands}%"]
|
71
72
|
|
72
|
-
|
73
|
-
|
73
|
+
when 'is_false'
|
74
|
+
["#{sql_field_name} = ?",false]
|
74
75
|
|
75
|
-
|
76
|
-
|
76
|
+
when 'is_true'
|
77
|
+
["#{sql_field_name} = ?",true]
|
77
78
|
|
78
|
-
|
79
|
-
|
79
|
+
when 'is_null'
|
80
|
+
["#{sql_field_name} IS NULL"]
|
80
81
|
|
81
|
-
|
82
|
-
|
82
|
+
when 'is_not_null'
|
83
|
+
["#{sql_field_name} IS NOT NULL"]
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
|
85
|
+
when 'is_on'
|
86
|
+
["#{sql_field_name} >= ? AND #{sql_field_name} < ?", values_after_cast.beginning_of_day,
|
87
|
+
values_after_cast.end_of_day]
|
87
88
|
|
88
|
-
|
89
|
-
|
89
|
+
when 'is_on_or_before_date'
|
90
|
+
["#{sql_field_name} <= ?",values_after_cast.end_of_day]
|
90
91
|
|
91
|
-
|
92
|
-
|
92
|
+
when 'is_on_or_after_date'
|
93
|
+
["#{sql_field_name} >= ?",values_after_cast.beginning_of_day]
|
93
94
|
|
94
|
-
|
95
|
-
|
95
|
+
when 'is_equal_to'
|
96
|
+
["#{sql_field_name} = ?",values_after_cast]
|
96
97
|
|
97
|
-
|
98
|
-
|
98
|
+
when 'greater_than'
|
99
|
+
["#{sql_field_name} > ?",values_after_cast]
|
99
100
|
|
100
|
-
|
101
|
-
|
101
|
+
when 'less_than'
|
102
|
+
["#{sql_field_name} < ?",values_after_cast]
|
102
103
|
|
103
|
-
|
104
|
-
|
104
|
+
else
|
105
|
+
# it means user did not select anything in operator. Ignore it.
|
106
|
+
end
|
105
107
|
end
|
106
|
-
end
|
107
108
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
109
|
+
def valid?
|
110
|
+
@error = nil
|
111
|
+
@error = validate
|
112
|
+
@error.blank?
|
113
|
+
end
|
113
114
|
|
114
|
-
|
115
|
+
private
|
115
116
|
|
116
|
-
|
117
|
-
|
118
|
-
|
117
|
+
def like_operator
|
118
|
+
dbbase.like_operator
|
119
|
+
end
|
119
120
|
|
120
|
-
|
121
|
-
|
122
|
-
|
121
|
+
def sql_field_name
|
122
|
+
dbbase.sql_field_name
|
123
|
+
end
|
123
124
|
|
124
|
-
|
125
|
-
|
126
|
-
|
125
|
+
def operands
|
126
|
+
dbbase.operands
|
127
|
+
end
|
127
128
|
|
128
|
-
|
129
|
-
|
130
|
-
|
129
|
+
def operand_required?
|
130
|
+
operator =~ /(contains|is_exactly|does_not_contain|is_on |is_on_or_before_date|is_on_or_after_date |greater_than|less_than|is_equal_to)/
|
131
|
+
end
|
131
132
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
def compute_search_fields(value)
|
134
|
+
@field, @operator, @operands = value.values_at(:col1, :col2, :col3)
|
135
|
+
# field value is directly used in the sql statement. So it is important to sanitize it
|
136
|
+
@field = @field.gsub(/\W/,'')
|
137
|
+
@operands = (@operands.blank? ? @operands : @operands.strip)
|
138
|
+
end
|
138
139
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
140
|
+
def values_after_cast
|
141
|
+
case operator
|
142
|
+
when /(is_on|is_on_or_before_date|is_on_or_after_date)/
|
143
|
+
AdminData::DateUtil.parse(operands)
|
144
|
+
when /(is_equal_to|greater_than|less_than)/
|
145
|
+
operands.to_i
|
146
|
+
else
|
147
|
+
operands
|
148
|
+
end
|
147
149
|
end
|
148
|
-
end
|
149
150
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
151
|
+
def validate
|
152
|
+
case operator
|
153
|
+
when /(is_on|is_on_or_before_date|is_on_or_after_date)/
|
154
|
+
"#{operands} is not a valid date" unless AdminData::DateUtil.valid?(operands)
|
155
|
+
when /(is_equal_to|greater_than|less_than)/
|
156
|
+
unless operands.blank?
|
157
|
+
"#{operands} is not a valid integer" unless operands =~ /^\d+$/
|
158
|
+
end
|
157
159
|
end
|
158
160
|
end
|
159
|
-
end
|
160
161
|
|
161
|
-
|
162
|
+
end # end of Term
|
162
163
|
|
163
164
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
165
|
+
def build_quick_search_condition( klass, search_term )
|
166
|
+
return nil if search_term.blank?
|
167
|
+
str_columns = klass.columns.select { |column| column.type.to_s =~ /(string|text)/i }
|
168
|
+
conditions = str_columns.collect do |column|
|
169
|
+
t = Term.new(klass, {:col1 => column.name, :col2 => 'contains', :col3 => search_term}, 'quick_search')
|
170
|
+
t.attribute_condition
|
171
|
+
end
|
172
|
+
AdminData::Util.or_merge_conditions(klass, *conditions)
|
170
173
|
end
|
171
|
-
AdminData::Util.or_merge_conditions(klass, *conditions)
|
172
|
-
end
|
173
174
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
175
|
+
def build_advance_search_condition(klass, options)
|
176
|
+
values = ( options.blank? ? [] : options.values )
|
177
|
+
terms = values.collect {|value| Term.new(klass, value, 'advance_search') }
|
178
|
+
valid_terms = terms.select{ |t| t.valid? }
|
179
|
+
errors = (terms - valid_terms).collect { |t| t.error }
|
180
|
+
return {:errors => errors} if errors.any?
|
180
181
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
182
|
+
r = klass.unscoped
|
183
|
+
valid_terms.each { |t| r = r.where(t.attribute_condition) }
|
184
|
+
{ :cond => r }
|
185
|
+
end
|
185
186
|
|
187
|
+
end
|
186
188
|
end
|
data/lib/admin_data/version.rb
CHANGED
data/lib/admin_data.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$(function(){
|
2
|
+
|
3
|
+
var form = $('#advance_search_form');
|
4
|
+
|
5
|
+
if (form.length === 0) return;
|
6
|
+
|
7
|
+
$('#view_table tr.thead').live('click', function(e){
|
8
|
+
var value = $(e.target).closest('.sortable').attr('data-sortby');
|
9
|
+
$('#advance_search_sortby').val(value);
|
10
|
+
form.submit();
|
11
|
+
return false;
|
12
|
+
});
|
13
|
+
|
14
|
+
});
|
@@ -902,13 +902,13 @@ table#view_table {
|
|
902
902
|
margin: 5px 0 5px 0;
|
903
903
|
border-collapse: collapse;
|
904
904
|
border-spacing: 0;
|
905
|
+
font-size:13px;
|
905
906
|
}
|
906
907
|
|
907
908
|
table#view_table th {
|
908
909
|
border: 1px solid #ccc;
|
909
910
|
letter-spacing: 2px;
|
910
911
|
text-align: left;
|
911
|
-
padding: 6px 6px 6px 12px;
|
912
912
|
}
|
913
913
|
|
914
914
|
|
@@ -1107,3 +1107,27 @@ ul#subnav li a:hover {
|
|
1107
1107
|
color:gray;
|
1108
1108
|
}
|
1109
1109
|
|
1110
|
+
th.sortable {
|
1111
|
+
background: url("/admin_data/public/images/sort_by_nothing.jpg") no-repeat scroll 0 -4px #CAE8EA;
|
1112
|
+
cursor: pointer;
|
1113
|
+
padding: 8px 12px 4px 16px;
|
1114
|
+
border-bottom: 1px solid #c1dad7;
|
1115
|
+
border-right: 1px solid #c1dad7;
|
1116
|
+
border-top: 1px solid #c1dad7;
|
1117
|
+
color: #4f6b72;
|
1118
|
+
letter-spacing: 1px;
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
th.sortable a {
|
1122
|
+
margin-left: 3px;
|
1123
|
+
color: #4F6B72;
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
th.sort_by_desc {
|
1127
|
+
background: url("/admin_data/public/images/sort_by_desc.jpg") no-repeat scroll 0 -4px #CAE8EA;
|
1128
|
+
}
|
1129
|
+
th.sort_by_asc {
|
1130
|
+
background: url("/admin_data/public/images/sort_by_asc.jpg") no-repeat scroll 0 -4px #CAE8EA;
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
|
data/test/rails_root/Gemfile
CHANGED
@@ -1,23 +1,26 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
+
#gem 'admin_data', :git => 'git://github.com/neerajdotname/admin_data.git'
|
4
|
+
gem 'admin_data', :path => File.expand_path("../../..", __FILE__)
|
5
|
+
|
3
6
|
gem 'rails', '3.0.3'
|
4
7
|
|
5
8
|
gem 'sqlite3-ruby', :require => 'sqlite3'
|
6
9
|
|
10
|
+
gem 'pg', '= 0.10.0'
|
11
|
+
|
12
|
+
gem "mysql2", '= 0.2.7'
|
13
|
+
|
7
14
|
gem 'ruby-debug'
|
8
15
|
|
9
16
|
gem 'faker'
|
10
17
|
|
11
|
-
#gem 'admin_data', :git => 'git://github.com/neerajdotname/admin_data.git'
|
12
|
-
gem 'admin_data', :path => File.expand_path("../../..", __FILE__)
|
13
|
-
|
14
|
-
group :development, :test do
|
15
|
-
gem 'factory_girl_rails'
|
16
|
-
gem 'database_cleaner'
|
17
|
-
gem 'shoulda'
|
18
|
-
gem "rspec-rails", ">= 2.0.1"
|
19
|
-
gem "cucumber-rails", ">= 0.3.2"
|
20
|
-
gem "capybara", "= 0.4.0"
|
21
|
-
gem "launchy", ">= 0.3.7"
|
22
|
-
end
|
23
18
|
|
19
|
+
gem 'factory_girl_rails'
|
20
|
+
gem 'database_cleaner'
|
21
|
+
gem 'shoulda'
|
22
|
+
gem "rspec-rails", ">= 2.0.1"
|
23
|
+
gem "cucumber-rails", ">= 0.3.2"
|
24
|
+
gem "capybara", "= 0.4.0"
|
25
|
+
gem "launchy", ">= 0.3.7"
|
26
|
+
gem 'minitest'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/nsingh/dev/personal/admin_data
|
3
3
|
specs:
|
4
|
-
admin_data (1.1.
|
5
|
-
will_paginate (
|
4
|
+
admin_data (1.1.12)
|
5
|
+
will_paginate (= 3.0.pre2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
@@ -86,7 +86,10 @@ GEM
|
|
86
86
|
mime-types (~> 1.16)
|
87
87
|
treetop (~> 1.4.8)
|
88
88
|
mime-types (1.16)
|
89
|
+
minitest (2.2.2)
|
90
|
+
mysql2 (0.2.7)
|
89
91
|
nokogiri (1.4.4)
|
92
|
+
pg (0.10.0)
|
90
93
|
polyglot (0.3.1)
|
91
94
|
rack (1.2.1)
|
92
95
|
rack-mount (0.6.13)
|
@@ -150,6 +153,9 @@ DEPENDENCIES
|
|
150
153
|
factory_girl_rails
|
151
154
|
faker
|
152
155
|
launchy (>= 0.3.7)
|
156
|
+
minitest
|
157
|
+
mysql2 (= 0.2.7)
|
158
|
+
pg (= 0.10.0)
|
153
159
|
rails (= 3.0.3)
|
154
160
|
rspec-rails (>= 2.0.1)
|
155
161
|
ruby-debug
|
data/test/rails_root/README.md
CHANGED
@@ -1,11 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Test setup #
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* rake db:test:prepare
|
7
|
-
* bundle exec cucumber
|
3
|
+
bundle install
|
4
|
+
rake db:migrate
|
5
|
+
rake db:test:prepare
|
8
6
|
|
7
|
+
# Cucumber test #
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
bundle exec cucumber
|
10
|
+
|
11
|
+
# Unit test #
|
12
|
+
|
13
|
+
ruby -I test test/unit/car_test.rb
|
14
|
+
|
15
|
+
# Switch database #
|
16
|
+
|
17
|
+
rake db:use:pg
|
18
|
+
rake db:use:sqlite3
|
19
|
+
rake db:use:mysql
|
@@ -8,35 +8,8 @@ Bundler.require(:default, Rails.env) if defined?(Bundler)
|
|
8
8
|
|
9
9
|
module AdminDataDemo
|
10
10
|
class Application < Rails::Application
|
11
|
-
# Settings in config/environments/* take precedence over those specified here.
|
12
|
-
# Application configuration should go into files in config/initializers
|
13
|
-
# -- all .rb files in that directory are automatically loaded.
|
14
|
-
|
15
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
-
|
18
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
-
|
22
|
-
# Activate observers that should always be running.
|
23
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
-
|
25
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
11
|
config.time_zone = 'Central Time (US & Canada)'
|
28
|
-
|
29
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
-
# config.i18n.default_locale = :de
|
32
|
-
|
33
|
-
# JavaScript files you want as :defaults (application.js is always included).
|
34
|
-
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
35
|
-
|
36
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
37
12
|
config.encoding = "utf-8"
|
38
|
-
|
39
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
40
13
|
config.filter_parameters += [:password]
|
41
14
|
end
|
42
15
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
development:
|
2
|
+
adapter: mysql2
|
3
|
+
encoding: utf8
|
4
|
+
reconnect: false
|
5
|
+
database: admin_data_development
|
6
|
+
pool: 5
|
7
|
+
username: root
|
8
|
+
password: welcome
|
9
|
+
host: localhost
|
10
|
+
|
11
|
+
# Warning: The database defined as "test" will be erased and
|
12
|
+
# re-generated from your development database when you run "rake".
|
13
|
+
# Do not set this db to the same as development or production.
|
14
|
+
test:
|
15
|
+
adapter: mysql2
|
16
|
+
encoding: utf8
|
17
|
+
reconnect: false
|
18
|
+
database: admin_data_test
|
19
|
+
pool: 5
|
20
|
+
username: root
|
21
|
+
password: welcome
|
22
|
+
host: localhost
|
@@ -0,0 +1,15 @@
|
|
1
|
+
development:
|
2
|
+
adapter: postgresql
|
3
|
+
database: admin_data_development
|
4
|
+
username: <%= ENV['USER'] %>
|
5
|
+
host: localhost
|
6
|
+
|
7
|
+
# Warning: The database defined as 'test' will be erased and
|
8
|
+
# re-generated from your development database when you run 'rake'.
|
9
|
+
# Do not set this db to the same as development or production.
|
10
|
+
test: &TEST
|
11
|
+
adapter: postgresql
|
12
|
+
database: admin_data_test
|
13
|
+
username: <%= ENV['USER'] %>
|
14
|
+
host: localhost
|
15
|
+
min_messages: warning
|
Binary file
|
@@ -12,6 +12,12 @@
|
|
12
12
|
|
13
13
|
ActiveRecord::Schema.define(:version => 20091030202259) do
|
14
14
|
|
15
|
+
create_table "cars", :force => true do |t|
|
16
|
+
t.string "name"
|
17
|
+
t.datetime "created_at"
|
18
|
+
t.datetime "updated_at"
|
19
|
+
end
|
20
|
+
|
15
21
|
create_table "cities", :force => true do |t|
|
16
22
|
t.string "name"
|
17
23
|
t.text "data"
|
@@ -39,17 +39,6 @@ Feature: quick search
|
|
39
39
|
Then I should see "seattle"
|
40
40
|
Then I should see population_5000
|
41
41
|
|
42
|
-
Scenario: sorting
|
43
|
-
Given the following user exists:
|
44
|
-
| first_name | last_name |
|
45
|
-
| Mary | Jane |
|
46
|
-
| John | Smith |
|
47
|
-
Given I visit quick_search page
|
48
|
-
When I select "id asc" from "sortby"
|
49
|
-
When I press "Search"
|
50
|
-
Then verify that user "first_name" is "Mary"
|
51
|
-
Then verify that user "last_name" is "Jane"
|
52
|
-
|
53
42
|
Scenario: quick search with search term
|
54
43
|
Given the following user exists:
|
55
44
|
| first_name | last_name |
|