admin_data 1.0.22 → 1.1.0

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.
Files changed (116) hide show
  1. data/History.txt +23 -16
  2. data/README.md +1 -1
  3. data/Rakefile +2 -2
  4. data/app/controllers/admin_data/application_controller.rb +111 -0
  5. data/app/controllers/admin_data/crud_controller.rb +100 -0
  6. data/app/controllers/admin_data/feed_controller.rb +38 -16
  7. data/app/controllers/admin_data/home_controller.rb +11 -0
  8. data/app/controllers/admin_data/migration_controller.rb +12 -12
  9. data/app/controllers/admin_data/public_controller.rb +29 -19
  10. data/app/controllers/admin_data/search_controller.rb +99 -103
  11. data/app/controllers/admin_data/table_structure_controller.rb +25 -0
  12. data/app/helpers/admin_data/application_helper.rb +287 -0
  13. data/app/views/admin_data/crud/association/_association_info.html.erb +11 -0
  14. data/app/views/admin_data/crud/association/_belongs_to_info.html.erb +7 -0
  15. data/app/views/admin_data/{main → crud}/association/_habtm_info.html.erb +3 -3
  16. data/app/views/admin_data/{main → crud}/association/_has_many_info.html.erb +3 -3
  17. data/app/views/admin_data/crud/association/_has_one_info.html.erb +6 -0
  18. data/app/views/admin_data/{main → crud}/edit.html.erb +9 -9
  19. data/app/views/admin_data/{main → crud}/misc/_form.html.erb +6 -6
  20. data/app/views/admin_data/{main → crud}/misc/_modify_record.html.erb +4 -4
  21. data/app/views/admin_data/{main → crud}/new.html.erb +7 -7
  22. data/app/views/admin_data/{main → crud}/show.html.erb +10 -10
  23. data/app/views/admin_data/{main → home}/index.html.erb +2 -2
  24. data/app/views/admin_data/migration/index.html.erb +3 -3
  25. data/app/views/admin_data/search/_search_base.html.erb +5 -5
  26. data/app/views/admin_data/search/quick_search.html.erb +4 -4
  27. data/app/views/admin_data/search/search/_listing.html.erb +11 -9
  28. data/app/views/admin_data/search/search/_sortby.html.erb +4 -3
  29. data/app/views/admin_data/search/search/_title.html.erb +7 -7
  30. data/app/views/admin_data/shared/_breadcrum.html.erb +11 -5
  31. data/app/views/admin_data/shared/_header.html.erb +6 -6
  32. data/app/views/admin_data/shared/_secondary_navigation.html.erb +13 -14
  33. data/app/views/admin_data/{main/table_structure.html.erb → table_structure/index.html.erb} +11 -11
  34. data/app/views/layouts/admin_data.html.erb +15 -15
  35. data/config/routes.rb +3 -3
  36. data/lib/admin_data.rb +29 -6
  37. data/lib/admin_data/active_record_util.rb +38 -6
  38. data/lib/admin_data/configuration.rb +113 -0
  39. data/lib/admin_data/deprecation.rb +31 -0
  40. data/lib/admin_data/railtie.rb +2 -7
  41. data/lib/admin_data/search.rb +1 -1
  42. data/lib/admin_data/util.rb +74 -161
  43. data/lib/admin_data/version.rb +1 -1
  44. data/test/rails_root/app/controllers/application_controller.rb +3 -0
  45. data/test/rails_root/app/helpers/application_helper.rb +5 -0
  46. data/test/rails_root/app/models/city.rb +22 -0
  47. data/test/rails_root/app/models/club.rb +3 -0
  48. data/test/rails_root/app/models/newspaper.rb +4 -0
  49. data/test/rails_root/app/models/phone_number.rb +3 -0
  50. data/test/rails_root/app/models/user.rb +17 -0
  51. data/test/rails_root/app/models/website.rb +3 -0
  52. data/test/rails_root/config/application.rb +42 -0
  53. data/test/rails_root/config/boot.rb +13 -0
  54. data/test/rails_root/config/environment.rb +5 -0
  55. data/test/rails_root/config/environments/development.rb +22 -0
  56. data/test/rails_root/config/environments/production.rb +49 -0
  57. data/test/rails_root/config/environments/test.rb +35 -0
  58. data/test/rails_root/config/initializers/admin_data.rb +22 -0
  59. data/test/rails_root/config/initializers/backtrace_silencers.rb +7 -0
  60. data/test/rails_root/config/initializers/empty_spaces_to_nil.rb +10 -0
  61. data/test/rails_root/config/initializers/inflections.rb +10 -0
  62. data/test/rails_root/config/initializers/mime_types.rb +5 -0
  63. data/test/rails_root/config/initializers/secret_token.rb +7 -0
  64. data/test/rails_root/config/initializers/session_store.rb +8 -0
  65. data/test/rails_root/config/routes.rb +9 -0
  66. data/test/rails_root/db/migrate/20091030202259_create_users.rb +55 -0
  67. data/test/rails_root/db/schema.rb +63 -0
  68. data/test/rails_root/db/seeds.rb +40 -0
  69. data/test/rails_root/features/step_definitions/advance_search_steps.rb +13 -0
  70. data/test/rails_root/features/step_definitions/app_steps.rb +40 -0
  71. data/test/rails_root/features/step_definitions/async.rb +18 -0
  72. data/test/rails_root/features/step_definitions/crud_show_steps.rb +37 -0
  73. data/test/rails_root/features/step_definitions/feed_steps.rb +3 -0
  74. data/test/rails_root/features/step_definitions/quick_search_steps.rb +65 -0
  75. data/test/rails_root/features/step_definitions/util.rb +86 -0
  76. data/test/rails_root/features/step_definitions/web_steps.rb +219 -0
  77. data/test/rails_root/features/support/env.rb +68 -0
  78. data/test/rails_root/features/support/paths.rb +33 -0
  79. data/test/rails_root/test/factories.rb +30 -0
  80. data/test/rails_root/test/performance/browsing_test.rb +9 -0
  81. data/test/rails_root/test/test_helper.rb +13 -0
  82. metadata +100 -49
  83. data/app/controllers/admin_data/base_controller.rb +0 -112
  84. data/app/controllers/admin_data/main_controller.rb +0 -141
  85. data/app/views/admin_data/main/association/_association_info.html.erb +0 -11
  86. data/app/views/admin_data/main/association/_belongs_to_info.html.erb +0 -7
  87. data/app/views/admin_data/main/association/_has_one_info.html.erb +0 -6
  88. data/lib/admin_data/chelper.rb +0 -37
  89. data/lib/admin_data/helpers.rb +0 -271
  90. data/lib/admin_data/settings.rb +0 -67
  91. data/lib/css/base.css +0 -1108
  92. data/lib/css/vendor/jquery-ui-1.7.2.custom.css +0 -406
  93. data/lib/js/advance_search/act_on_result.js +0 -45
  94. data/lib/js/advance_search/advance_search.js +0 -83
  95. data/lib/js/advance_search/advance_search_structure.js +0 -79
  96. data/lib/js/advance_search/ajaxify_advance_search.js +0 -28
  97. data/lib/js/advance_search/build_first_row.js +0 -8
  98. data/lib/js/advance_search/event_bindings.js +0 -76
  99. data/lib/js/advance_search/global_ajax_setting.js +0 -10
  100. data/lib/js/advance_search/trigger_submit_on_domready.js +0 -6
  101. data/lib/js/misc/drop_down_change.js +0 -8
  102. data/lib/js/misc/js_util.js +0 -58
  103. data/lib/js/misc/quick_search_input_focus.js +0 -6
  104. data/lib/js/test/act_on_result.js +0 -120
  105. data/lib/js/test/advance_search.js +0 -80
  106. data/lib/js/test/ajaxify_advance_search.js +0 -29
  107. data/lib/js/test/build_first_row.js +0 -10
  108. data/lib/js/test/event_bindings.js +0 -100
  109. data/lib/js/vendor/jack.js +0 -903
  110. data/lib/js/vendor/jquery-1.4.2.js +0 -6240
  111. data/lib/js/vendor/jquery-ui-1.7.2.custom.min.js +0 -298
  112. data/lib/js/vendor/jquery.ba-isjquery.js +0 -21
  113. data/lib/js/vendor/jquery.form.js +0 -814
  114. data/lib/js/vendor/log.js +0 -9
  115. data/lib/js/vendor/qunit.js +0 -1043
  116. data/lib/js/vendor/rails.js +0 -132
@@ -0,0 +1,49 @@
1
+ AdminDataDemo::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = true # heroku needs this
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ end
@@ -0,0 +1,35 @@
1
+ AdminDataDemo::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,22 @@
1
+ AdminData.config do |config|
2
+
3
+ config.number_of_records_per_page = 2
4
+
5
+ config.is_allowed_to_view = lambda {|_| return true}
6
+ config.is_allowed_to_update = lambda {|_| return true}
7
+
8
+ config.feed_authentication_user_id = 'admin_data'
9
+ config.feed_authentication_password = 'welcome'
10
+
11
+ config.find_conditions = {'City' => lambda { |params| {:conditions => ["name =?", params[:id]] }}}
12
+
13
+
14
+ config.column_settings = { 'City' => { :data => lambda { |model| model.send(:data).to_a.flatten.inspect } } }
15
+
16
+ config.drop_down_for_associations = { 'PhoneNumber' => false}
17
+
18
+ config.columns_order = {'Website' => [:dns_provider, :user_id] }
19
+
20
+ config.column_headers = {'City' => {:id => 'ID', :name => 'City Name', :data => 'City Info'}}
21
+
22
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # empty spaces should be saved as NULL in database
2
+ module ActiveRecord
3
+ class Base
4
+ before_validation do |record|
5
+ record.attributes.each do |attr, value|
6
+ record[attr] = value.blank? ? nil : value.strip if value.respond_to?(:strip)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ AdminDataDemo::Application.config.secret_token = 'a8406a8e3c074aa11e9795ba5500797645fefdf2f5b186239ba51abe89ac4446487b9138a99e7ef29dd9ed0a453c0c8f1503561ac2838c5575f656c985130037'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ AdminDataDemo::Application.config.session_store :cookie_store, :key => '_admin_data_demo_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rake db:sessions:create")
8
+ # AdminDataDemo::Application.config.session_store :active_record_store
@@ -0,0 +1,9 @@
1
+ AdminDataDemo::Application.routes.draw do
2
+
3
+ #root :to => "/admin_data"
4
+ match "/" => redirect("/admin_data")
5
+
6
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
7
+ # Note: This route will make all actions in every controller accessible via GET requests.
8
+ # match ':controller(/:action(/:id(.:format)))'
9
+ end
@@ -0,0 +1,55 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :first_name
5
+ t.string :last_name
6
+ t.integer :age
7
+ t.text :data
8
+ t.boolean :active, :default => false
9
+ t.text :description
10
+ t.datetime :born_at
11
+ t.timestamps
12
+ end
13
+
14
+ create_table :phone_numbers do |t|
15
+ t.string :number
16
+ t.integer :user_id
17
+ t.timestamps
18
+ end
19
+
20
+ create_table :websites do |t|
21
+ t.string :url
22
+ t.integer :user_id
23
+ t.string :dns_provider, :default => 'yahoo'
24
+ t.timestamps
25
+ end
26
+
27
+ create_table :cities do |t|
28
+ t.string :name
29
+ t.text :data
30
+ t.timestamps
31
+ end
32
+
33
+ create_table :clubs do |t|
34
+ t.string :name
35
+ end
36
+ create_table :clubs_users, :id => false do |t|
37
+ t.integer :user_id, :null => false
38
+ t.integer :club_id, :null => false
39
+ end
40
+
41
+ # primary_key is not id. It is paper_id .
42
+ # model name is Newspaper
43
+ # set :id => false if the primary_key is string
44
+ # set :id => false if you do not want autoincremental id
45
+ create_table :papers, :id => false, :force => true, :primary_key => 'paper_id' do |t|
46
+ t.string :paper_id, :null => false
47
+ t.string :name
48
+ end
49
+
50
+ end
51
+
52
+ def self.down
53
+ drop_table :users
54
+ end
55
+ end
@@ -0,0 +1,63 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended to check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(:version => 20091030202259) do
14
+
15
+ create_table "cities", :force => true do |t|
16
+ t.string "name"
17
+ t.text "data"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ end
21
+
22
+ create_table "clubs", :force => true do |t|
23
+ t.string "name"
24
+ end
25
+
26
+ create_table "clubs_users", :id => false, :force => true do |t|
27
+ t.integer "user_id", :null => false
28
+ t.integer "club_id", :null => false
29
+ end
30
+
31
+ create_table "papers", :id => false, :force => true do |t|
32
+ t.string "paper_id", :null => false
33
+ t.string "name"
34
+ end
35
+
36
+ create_table "phone_numbers", :force => true do |t|
37
+ t.string "number"
38
+ t.integer "user_id"
39
+ t.datetime "created_at"
40
+ t.datetime "updated_at"
41
+ end
42
+
43
+ create_table "users", :force => true do |t|
44
+ t.string "first_name"
45
+ t.string "last_name"
46
+ t.integer "age"
47
+ t.text "data"
48
+ t.boolean "active", :default => false
49
+ t.text "description"
50
+ t.datetime "born_at"
51
+ t.datetime "created_at"
52
+ t.datetime "updated_at"
53
+ end
54
+
55
+ create_table "websites", :force => true do |t|
56
+ t.string "url"
57
+ t.integer "user_id"
58
+ t.string "dns_provider", :default => "yahoo"
59
+ t.datetime "created_at"
60
+ t.datetime "updated_at"
61
+ end
62
+
63
+ end
@@ -0,0 +1,40 @@
1
+ User.all.each {|r| r.destroy }
2
+ Club.all.each {|r| r.destroy }
3
+ Newspaper.delete_all
4
+ City.delete_all
5
+
6
+
7
+ (1..100).to_a.each_with_index do |i,e|
8
+ User.create!(:data => {:year => 1900 + i, :music => 'rock, jazz'},
9
+ :first_name => Faker::Name.first_name,
10
+ :last_name => Faker::Name.last_name,
11
+ :active => true,
12
+ :age => 1 + i,
13
+ :description => Faker::Lorem.paragraph,
14
+ :born_at => Time.now)
15
+ end
16
+
17
+ User.find(:all).each do |u|
18
+ 2.times do
19
+ u.phone_numbers.create!(:number => Faker::PhoneNumber.phone_number)
20
+ end
21
+ u.create_website(:url => 'http://www.' + Faker::Internet.domain_name)
22
+ u.clubs.create!(:name => Faker::Company.name)
23
+ end
24
+
25
+ n = Newspaper.new(:name => 'DC Experss')
26
+ n.paper_id = 'dc_express'
27
+ n.save!
28
+
29
+ n = Newspaper.new(:name => 'NYC Experss')
30
+ n.paper_id = 'nyc_express'
31
+ n.save!
32
+
33
+ City.create(:name => 'seattle')
34
+ City.create(:name => 'nyc')
35
+ City.create(:name => 'miami')
36
+
37
+ puts "City records: " + City.count.to_s
38
+ puts "User records: " + User.count.to_s
39
+ puts "Newspaper records: " + Newspaper.count.to_s
40
+ puts "Club records: " + Club.count.to_s
@@ -0,0 +1,13 @@
1
+ Then /^async page should have text as current date for "(.*)"$/ do |css_selector|
2
+ wait_until { page.evaluate_script("jQuery.active === 0") }
3
+
4
+ page.find(css_selector).value.should == Time.now.strftime('%d-%B-%Y')
5
+ end
6
+
7
+ Given /^first user's value for active is nil$/ do
8
+ User.update_all('active = NULL', "id = #{User.first.id}")
9
+ end
10
+
11
+ Given /^last user's value for active is nil$/ do
12
+ User.update_all('active = NULL', "id = #{User.last.id}")
13
+ end
@@ -0,0 +1,40 @@
1
+ Given /^a phone_number exists$/ do
2
+ Factory(:phone_number)
3
+ end
4
+
5
+ When /^I visit (.*) page$/ do |target_page|
6
+ case target_page
7
+ when 'admin_data'
8
+ visit '/admin_data'
9
+
10
+ when 'quick_search'
11
+ visit '/admin_data/quick_search/user'
12
+
13
+ when 'advance_search'
14
+ visit '/admin_data/advance_search/user'
15
+
16
+ when 'user show'
17
+ visit "/admin_data/klass/user/#{User.last.id}"
18
+
19
+ when 'phone_number show'
20
+ visit "/admin_data/klass/phone_number/#{PhoneNumber.last.id}"
21
+
22
+ when 'newspaper show'
23
+ visit "/admin_data/klass/newspaper/#{Newspaper.last.paper_id}"
24
+
25
+ when 'user feed'
26
+ visit "/admin_data/feed/user"
27
+
28
+ when 'quick search page with association info'
29
+ visit "/admin_data/quick_search/phone_number?base=user&children=phone_numbers&model_id=#{User.last.id}"
30
+
31
+ when 'quick search with wrong klass name'
32
+ visit "/admin_data/quick_search/phone_number_wrong"
33
+
34
+ when 'quick search with wrong base klass name'
35
+ visit "/admin_data/quick_search/phone_number?base=user_wrong&children=phone_numbers&model_id=#{User.last.id}"
36
+
37
+ when 'quick search with wrong children klass name'
38
+ visit "/admin_data/quick_search/phone_number?base=user&children=phone_numbers_wrong&model_id=#{User.last.id}"
39
+ end
40
+ end
@@ -0,0 +1,18 @@
1
+ Then /^async verify that number of "(.*)" records is "(.*)"$/ do |klass, count|
2
+ wait_until { page.evaluate_script("jQuery.active === 0") }
3
+ klass.constantize.count.should == count.to_i
4
+ end
5
+
6
+ Then /^async click "(.*)"$/ do |text|
7
+ wait_until { page.evaluate_script("jQuery.active === 0") }
8
+
9
+ page.evaluate_script('window.confirm = function() { return true; }')
10
+ page.click_link_or_button(text)
11
+ end
12
+
13
+ Then /^asyc I should see "(.*)"$/ do |text|
14
+ wait_until { page.evaluate_script("jQuery.active === 0") }
15
+
16
+ page.should have_content(text)
17
+ end
18
+
@@ -0,0 +1,37 @@
1
+ Then /^I should see crud show tabular attributes$/ do
2
+ data = tableish('table.table tr', 'td,th').flatten
3
+ data[0].should == "id"
4
+ data[2].should == "first_name"
5
+ data[3].should == "Mary"
6
+ data[4].should == "last_name"
7
+ data[5].should == "Jane"
8
+ data[6].should == "age"
9
+ data[7].should == "21"
10
+ data[8].should == "data"
11
+ data[9].should == "nil"
12
+ data[10].should == "active"
13
+ data[11].should == "false"
14
+ data[12].should == "description"
15
+ data[13].should == ""
16
+ data[14].should == "born_at"
17
+ data[15].should =~ /30-August-2010/
18
+ end
19
+
20
+ Then /^I should find value "(.*)" for "(.*)"$/ do |text, column|
21
+ index = (column == 'created_at') ? 9 : 10
22
+ page.should have_xpath( "//form//div[@class='data'][#{index}]", :text => Regexp.new(text) )
23
+ end
24
+
25
+ Then /^I should notice id of the last person$/ do
26
+ page.should have_content("ID #{User.last.id}")
27
+ end
28
+
29
+ Then /^I should notice id of website of the last person$/ do
30
+ page.should have_content("ID #{User.last.website.id}")
31
+ end
32
+
33
+ Given /^user owns two clubs "sun-shine" and "rise-n-shine"$/ do
34
+ u = User.last
35
+ u.clubs.create(:name => 'sun-shine')
36
+ u.clubs.create(:name => 'rise-n-shine')
37
+ end