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.
Files changed (46) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile.lock +1 -1
  3. data/README.md +1 -1
  4. data/app/controllers/admin_data/analytics_controller.rb +38 -0
  5. data/app/controllers/admin_data/public_controller.rb +2 -0
  6. data/app/controllers/admin_data/search_controller.rb +10 -5
  7. data/app/helpers/admin_data/application_helper.rb +21 -0
  8. data/app/views/admin_data/analytics/_bar_chart.html.erb +39 -0
  9. data/app/views/admin_data/analytics/index.html.erb +41 -0
  10. data/app/views/admin_data/search/search/_advance_search_form.html.erb +1 -7
  11. data/app/views/admin_data/search/search/_listing.html.erb +4 -2
  12. data/app/views/admin_data/search/search/_search_form.html.erb +0 -1
  13. data/app/views/admin_data/shared/_secondary_navigation.html.erb +5 -0
  14. data/app/views/layouts/admin_data.html.erb +4 -1
  15. data/config/routes.rb +8 -5
  16. data/lib/admin_data/analytics.rb +176 -0
  17. data/lib/admin_data/exceptions.rb +5 -0
  18. data/lib/admin_data/search.rb +139 -137
  19. data/lib/admin_data/version.rb +1 -1
  20. data/lib/admin_data.rb +3 -0
  21. data/lib/public/images/sort_by_asc.jpg +0 -0
  22. data/lib/public/images/sort_by_desc.jpg +0 -0
  23. data/lib/public/images/sort_by_nothing.jpg +0 -0
  24. data/lib/public/javascripts/advance_search/sortby.js +14 -0
  25. data/lib/public/javascripts/analytics/report.js +7 -0
  26. data/lib/public/stylesheets/base.css +25 -1
  27. data/test/rails_root/Gemfile +15 -12
  28. data/test/rails_root/Gemfile.lock +8 -2
  29. data/test/rails_root/README.md +16 -8
  30. data/test/rails_root/app/models/car.rb +3 -0
  31. data/test/rails_root/config/application.rb +0 -27
  32. data/test/rails_root/config/cucumber.yml +0 -2
  33. data/test/rails_root/config/database.yml.mysql +22 -0
  34. data/test/rails_root/config/database.yml.pg +15 -0
  35. data/test/rails_root/config/{database.yml → database.yml.sqlite3} +1 -1
  36. data/test/rails_root/db/development.sqlite3 +0 -0
  37. data/test/rails_root/db/migrate/{20091030202259_create_users.rb → 20091030202259_create_tables.rb} +7 -1
  38. data/test/rails_root/db/schema.rb +6 -0
  39. data/test/rails_root/features/quick_search.feature +0 -11
  40. data/test/rails_root/lib/tasks/dbs.rake +30 -0
  41. data/test/rails_root/lib/tasks/sample_cars.rake +18 -0
  42. data/test/rails_root/test/unit/car_test.rb +100 -0
  43. metadata +30 -13
  44. data/app/views/admin_data/search/search/_sortby.html.erb +0 -19
  45. data/test/rails_root/features/advance_search/sort.feature +0 -16
  46. data/test/rails_root/test/performance/browsing_test.rb +0 -9
@@ -1,186 +1,188 @@
1
- module Search
2
-
3
- class Dbbase
4
- def initialize(operands, table_name, field_name, operator)
5
- @operands = operands
6
- @table_name = table_name
7
- @field_name = field_name
8
- @operator = operator
9
- end
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
- def like_operator
12
- 'LIKE'
13
- end
12
+ def like_operator
13
+ 'LIKE'
14
+ end
14
15
 
15
- def sql_field_name
16
- "#{@table_name}.#{@field_name}"
17
- end
16
+ def sql_field_name
17
+ "#{@table_name}.#{@field_name}"
18
+ end
18
19
 
19
- def operands
20
- @operands
20
+ def operands
21
+ @operands
22
+ end
21
23
  end
22
- end
23
24
 
24
- class PostgresqlSpecific < Dbbase
25
- def like_operator
26
- 'ILIKE'
25
+ class PostgresqlSpecific < Dbbase
26
+ def like_operator
27
+ 'ILIKE'
28
+ end
27
29
  end
28
- end
29
30
 
30
- class OracleSpecific < Dbbase
31
- def sql_field_name
32
- result = super
33
- %w(contains is_exactly does_not_contain).include?(@operator) ? "upper(#{result})" : result
34
- end
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
- def operands
37
- result = super
38
- %w(contains is_exactly does_not_contain).include?(@operator) ? result.upcase : result
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
- class Term
43
+ class Term
43
44
 
44
- attr_accessor :error, :table_name, :field, :operator, :operands, :dbbase
45
+ attr_accessor :error, :table_name, :field, :operator, :operands, :dbbase
45
46
 
46
- def initialize(klass, value, search_type)
47
- @table_name = klass.table_name
48
- compute_search_fields(value)
47
+ def initialize(klass, value, search_type)
48
+ @table_name = klass.table_name
49
+ compute_search_fields(value)
49
50
 
50
- adapter = AdminData.config.adapter_name.downcase
51
- if adapter =~ /postgresql/
52
- self.dbbase = PostgresqlSpecific.new(@operands, table_name, field, operator)
53
- elsif adapter =~ /oracle/
54
- self.dbbase = OracleSpecific.new(@operands, table_name, field, operator)
55
- else
56
- self.dbbase = Dbbase.new(@operands, table_name, field, operator)
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
- def attribute_condition
61
- return if valid? && operand_required? && operands.blank?
62
- case operator
63
- when 'contains'
64
- ["#{sql_field_name} #{like_operator} ?","%#{operands}%"]
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
- when 'is_exactly'
67
- ["#{sql_field_name} = ?", operands]
67
+ when 'is_exactly'
68
+ ["#{sql_field_name} = ?", operands]
68
69
 
69
- when 'does_not_contain'
70
- ["#{sql_field_name} IS NULL OR #{sql_field_name} NOT #{like_operator} ?","%#{operands}%"]
70
+ when 'does_not_contain'
71
+ ["#{sql_field_name} IS NULL OR #{sql_field_name} NOT #{like_operator} ?","%#{operands}%"]
71
72
 
72
- when 'is_false'
73
- ["#{sql_field_name} = ?",false]
73
+ when 'is_false'
74
+ ["#{sql_field_name} = ?",false]
74
75
 
75
- when 'is_true'
76
- ["#{sql_field_name} = ?",true]
76
+ when 'is_true'
77
+ ["#{sql_field_name} = ?",true]
77
78
 
78
- when 'is_null'
79
- ["#{sql_field_name} IS NULL"]
79
+ when 'is_null'
80
+ ["#{sql_field_name} IS NULL"]
80
81
 
81
- when 'is_not_null'
82
- ["#{sql_field_name} IS NOT NULL"]
82
+ when 'is_not_null'
83
+ ["#{sql_field_name} IS NOT NULL"]
83
84
 
84
- when 'is_on'
85
- ["#{sql_field_name} >= ? AND #{sql_field_name} < ?", values_after_cast.beginning_of_day,
86
- values_after_cast.end_of_day]
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
- when 'is_on_or_before_date'
89
- ["#{sql_field_name} <= ?",values_after_cast.end_of_day]
89
+ when 'is_on_or_before_date'
90
+ ["#{sql_field_name} <= ?",values_after_cast.end_of_day]
90
91
 
91
- when 'is_on_or_after_date'
92
- ["#{sql_field_name} >= ?",values_after_cast.beginning_of_day]
92
+ when 'is_on_or_after_date'
93
+ ["#{sql_field_name} >= ?",values_after_cast.beginning_of_day]
93
94
 
94
- when 'is_equal_to'
95
- ["#{sql_field_name} = ?",values_after_cast]
95
+ when 'is_equal_to'
96
+ ["#{sql_field_name} = ?",values_after_cast]
96
97
 
97
- when 'greater_than'
98
- ["#{sql_field_name} > ?",values_after_cast]
98
+ when 'greater_than'
99
+ ["#{sql_field_name} > ?",values_after_cast]
99
100
 
100
- when 'less_than'
101
- ["#{sql_field_name} < ?",values_after_cast]
101
+ when 'less_than'
102
+ ["#{sql_field_name} < ?",values_after_cast]
102
103
 
103
- else
104
- # it means user did not select anything in operator. Ignore it.
104
+ else
105
+ # it means user did not select anything in operator. Ignore it.
106
+ end
105
107
  end
106
- end
107
108
 
108
- def valid?
109
- @error = nil
110
- @error = validate
111
- @error.blank?
112
- end
109
+ def valid?
110
+ @error = nil
111
+ @error = validate
112
+ @error.blank?
113
+ end
113
114
 
114
- private
115
+ private
115
116
 
116
- def like_operator
117
- dbbase.like_operator
118
- end
117
+ def like_operator
118
+ dbbase.like_operator
119
+ end
119
120
 
120
- def sql_field_name
121
- dbbase.sql_field_name
122
- end
121
+ def sql_field_name
122
+ dbbase.sql_field_name
123
+ end
123
124
 
124
- def operands
125
- dbbase.operands
126
- end
125
+ def operands
126
+ dbbase.operands
127
+ end
127
128
 
128
- def operand_required?
129
- 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)/
130
- end
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
- def compute_search_fields(value)
133
- @field, @operator, @operands = value.values_at(:col1, :col2, :col3)
134
- # field value is directly used in the sql statement. So it is important to sanitize it
135
- @field = @field.gsub(/\W/,'')
136
- @operands = (@operands.blank? ? @operands : @operands.strip)
137
- end
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
- def values_after_cast
140
- case operator
141
- when /(is_on|is_on_or_before_date|is_on_or_after_date)/
142
- AdminData::DateUtil.parse(operands)
143
- when /(is_equal_to|greater_than|less_than)/
144
- operands.to_i
145
- else
146
- operands
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
- def validate
151
- case operator
152
- when /(is_on|is_on_or_before_date|is_on_or_after_date)/
153
- "#{operands} is not a valid date" unless AdminData::DateUtil.valid?(operands)
154
- when /(is_equal_to|greater_than|less_than)/
155
- unless operands.blank?
156
- "#{operands} is not a valid integer" unless operands =~ /^\d+$/
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
- end # end of Term
162
+ end # end of Term
162
163
 
163
164
 
164
- def build_quick_search_conditions( klass, search_term )
165
- return nil if search_term.blank?
166
- str_columns = klass.columns.select { |column| column.type.to_s =~ /(string|text)/i }
167
- conditions = str_columns.collect do |column|
168
- t = Term.new(klass, {:col1 => column.name, :col2 => 'contains', :col3 => search_term}, 'quick_search')
169
- t.attribute_condition
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
- def build_advance_search_conditions(klass, options)
175
- values = ( options.blank? ? [] : options.values )
176
- terms = values.collect {|value| Term.new(klass, value, 'advance_search') }
177
- valid_terms = terms.select{ |t| t.valid? }
178
- errors = (terms - valid_terms).collect { |t| t.error }
179
- return {:errors => errors} if errors.any?
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
- r = klass.unscoped
182
- valid_terms.each { |t| r = r.where(t.attribute_condition) }
183
- { :cond => r }
184
- end
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
@@ -1,3 +1,3 @@
1
1
  module AdminData
2
- VERSION = '1.1.12'
2
+ VERSION = '1.1.13'
3
3
  end
data/lib/admin_data.rb CHANGED
@@ -13,9 +13,12 @@ module AdminData
13
13
  autoload :SetupConfig
14
14
  autoload :DateUtil
15
15
  autoload :Authenticator
16
+ autoload :Search
17
+ autoload :Analytics
16
18
 
17
19
  include SetupConfig
18
20
 
19
21
  end
20
22
 
21
23
  require 'admin_data/railtie'
24
+ require 'admin_data/exceptions'
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
+ });
@@ -0,0 +1,7 @@
1
+ $(function(){
2
+
3
+ $('input[name=report_type]').change(function(){
4
+ window.location = $(this).val();
5
+ });
6
+
7
+ });
@@ -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
+
@@ -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.11)
5
- will_paginate (>= 3.0.pre2)
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
@@ -1,11 +1,19 @@
1
- # This respository is used for running cucumber tests for admin_data#
1
+ # Test setup #
2
2
 
3
- # How do I run test?
4
- * bundle install
5
- * rake db:migrate
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
- #TODO add test for delete a record
11
- ## TODO add test for destroy a record
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
@@ -0,0 +1,3 @@
1
+ class Car < ActiveRecord::Base
2
+
3
+ end
@@ -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
@@ -7,5 +7,3 @@ default: <%= std_opts %> features
7
7
  wip: --tags @wip:3 --wip features
8
8
  rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
9
9
  javascript: --tags @javascript
10
-
11
-
@@ -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
@@ -22,4 +22,4 @@ production:
22
22
  timeout: 5000
23
23
 
24
24
  cucumber:
25
- <<: *test
25
+ <<: *test
Binary file
@@ -1,5 +1,11 @@
1
- class CreateUsers < ActiveRecord::Migration
1
+ class CreateTables < ActiveRecord::Migration
2
2
  def self.up
3
+
4
+ create_table :cars do |t|
5
+ t.string :name
6
+ t.timestamps
7
+ end
8
+
3
9
  create_table :users do |t|
4
10
  t.string :first_name
5
11
  t.string :last_name
@@ -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 |