From 0d567cb98d186697103d9378b253cd36cf7172de Mon Sep 17 00:00:00 2001 From: Joachim Filip Ignacy Bartosik Date: Mon, 11 Jul 2011 09:42:35 +0200 Subject: Use hobo from git to make :null=>false default for some types of fields New version of hobo shows :datetime differently so some tests were updated. --- site/Gemfile | 2 +- site/Gemfile.lock | 52 ++++++++++++++------------ site/app/models/agenda.rb | 4 +- site/app/models/agenda_item.rb | 12 +++--- site/app/models/proxy.rb | 4 +- site/app/models/user.rb | 2 +- site/config/application.rb | 1 + site/db/schema.rb | 44 +++++++++++----------- site/features/step_definitions/agenda_steps.rb | 2 +- 9 files changed, 64 insertions(+), 59 deletions(-) diff --git a/site/Gemfile b/site/Gemfile index 2e090f4..f30b723 100644 --- a/site/Gemfile +++ b/site/Gemfile @@ -21,4 +21,4 @@ group :development, :test do gem 'fuubar-cucumber' end -gem "hobo", ">= 1.3.0.pre28" +gem "hobo", ">= 1.3.0.pre28", :git => 'git://github.com/ahenobarbi/hobo.git', :branch => 'rails3' diff --git a/site/Gemfile.lock b/site/Gemfile.lock index 8b1a867..67689be 100644 --- a/site/Gemfile.lock +++ b/site/Gemfile.lock @@ -1,3 +1,21 @@ +GIT + remote: git://github.com/ahenobarbi/hobo.git + revision: b33a9a69a2e1ce09b98c00ecee6c51bd1459fee5 + branch: rails3 + specs: + dryml (1.3.0) + actionpack (~> 3.0.0) + hobo_support (= 1.3.0) + hobo (1.3.0) + dryml (= 1.3.0) + hobo_fields (= 1.3.0) + hobo_support (= 1.3.0) + will_paginate (>= 3.0.pre) + hobo_fields (1.3.0) + hobo_support (= 1.3.0) + hobo_support (1.3.0) + rails (~> 3.0.0) + GEM remote: http://rubygems.org/ specs: @@ -8,7 +26,7 @@ GEM actionpack (3.0.3) activemodel (= 3.0.3) activesupport (= 3.0.3) - builder (>= 2.1.2) + builder (~> 2.1.2) erubis (~> 2.6.6) i18n (~> 0.4) rack (~> 1.2.1) @@ -17,7 +35,7 @@ GEM tzinfo (~> 0.3.23) activemodel (3.0.3) activesupport (= 3.0.3) - builder (>= 2.1.2) + builder (~> 2.1.2) i18n (~> 0.4) activerecord (3.0.3) activemodel (= 3.0.3) @@ -29,10 +47,10 @@ GEM activesupport (= 3.0.3) activesupport (3.0.3) addressable (2.2.5) - arel (2.0.9) + arel (2.0.10) bcrypt-ruby (2.1.4) bluecloth (2.1.0) - builder (3.0.0) + builder (2.1.2) capybara (0.4.1.2) celerity (>= 0.7.9) culerity (>= 0.2.4) @@ -71,9 +89,6 @@ GEM devise (>= 1.1.1) fbgraph diff-lcs (1.1.2) - dryml (1.3.0.pre28) - actionpack (>= 3.0.0) - hobo_support (= 1.3.0.pre28) email_spec (1.1.1) rspec (~> 2.0) erubis (2.6.6) @@ -105,29 +120,18 @@ GEM gherkin (2.3.5) json (>= 1.4.6) hashie (1.0.0) - hobo (1.3.0.pre28) - dryml (= 1.3.0.pre28) - hobo_fields (= 1.3.0.pre28) - hobo_support (= 1.3.0.pre28) - rails (>= 3.0.0) - will_paginate (>= 3.0.pre) hobo_devise (0.0.2) devise (>= 1.1.7) devise_oauth2_facebook hobo (>= 1.3.0.pre28) - hobo_fields (1.3.0.pre28) - hobo_support (= 1.3.0.pre28) - rails (>= 3.0.0) - hobo_support (1.3.0.pre28) - rails (>= 3.0.0) - i18n (0.5.0) + i18n (0.6.0) json (1.4.6) json_pure (1.5.3) launchy (0.4.0) configuration (>= 0.0.5) rake (>= 0.8.1) linecache (0.43) - mail (2.2.15) + mail (2.2.19) activesupport (>= 2.3.6) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -141,7 +145,7 @@ GEM multi_json (>= 0.0.5) orm_adapter (0.0.5) polyglot (0.3.1) - rack (1.2.2) + rack (1.2.3) rack-mount (0.6.14) rack (>= 1.0.0) rack-test (0.5.7) @@ -199,10 +203,10 @@ GEM typhoeus (0.2.4) mime-types mime-types - tzinfo (0.3.25) + tzinfo (0.3.29) warden (1.0.4) rack (>= 1.0) - will_paginate (3.0.pre2) + will_paginate (3.0.pre) xpath (0.1.3) nokogiri (~> 1.3) @@ -219,7 +223,7 @@ DEPENDENCIES email_spec factory_girl fuubar-cucumber - hobo (>= 1.3.0.pre28) + hobo (>= 1.3.0.pre28)! hobo_devise (>= 0.0.2) launchy rails (= 3.0.3) diff --git a/site/app/models/agenda.rb b/site/app/models/agenda.rb index 1afed67..680773a 100644 --- a/site/app/models/agenda.rb +++ b/site/app/models/agenda.rb @@ -4,8 +4,8 @@ class Agenda < ActiveRecord::Base fields do meeting_time :datetime - email_reminder_sent :boolean, :null => false, :default => false - meeting_log :text, :null => false, :default => '' + email_reminder_sent :boolean + meeting_log :text timestamps end diff --git a/site/app/models/agenda_item.rb b/site/app/models/agenda_item.rb index b76b067..938e2e1 100644 --- a/site/app/models/agenda_item.rb +++ b/site/app/models/agenda_item.rb @@ -3,12 +3,12 @@ class AgendaItem < ActiveRecord::Base hobo_model # Don't put anything above this fields do - title :string - discussion :string - body :text - rejected :boolean, :default => false - timelimits :text, :null => false, :default => '' - discussion_time :string, :null => false, :default => '' + title :string + discussion :string + body :markdown + rejected :boolean, :default => false + timelimits :text + discussion_time :string timestamps end diff --git a/site/app/models/proxy.rb b/site/app/models/proxy.rb index 1fdb93f..00630f8 100644 --- a/site/app/models/proxy.rb +++ b/site/app/models/proxy.rb @@ -5,8 +5,8 @@ class Proxy < ActiveRecord::Base fields do # Remeber nicks from when meeting took place # May be useful when reading logs (if user changes nick) - council_member_nick :string, :null => false - proxy_nick :string, :null => false + council_member_nick :string + proxy_nick :string timestamps end diff --git a/site/app/models/user.rb b/site/app/models/user.rb index cde0df5..bba0a6e 100644 --- a/site/app/models/user.rb +++ b/site/app/models/user.rb @@ -7,7 +7,7 @@ class User < ActiveRecord::Base irc_nick :string, :required, :unique email :email_address, :login => true administrator :boolean, :default => false - council_member :boolean, :default => false, :null => false + council_member :boolean, :default => false timestamps end diff --git a/site/config/application.rb b/site/config/application.rb index 306aff9..4a8f752 100644 --- a/site/config/application.rb +++ b/site/config/application.rb @@ -10,6 +10,7 @@ module Council class Application < Rails::Application config.hobo.dryml_only_templates = true + config.hobo.null_false_by_default = true # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers diff --git a/site/db/schema.rb b/site/db/schema.rb index 2b69ac8..641ac4b 100644 --- a/site/db/schema.rb +++ b/site/db/schema.rb @@ -10,13 +10,13 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110706145154) do +ActiveRecord::Schema.define(:version => 20110711074750) do create_table "agenda_items", :force => true do |t| - t.string "title" - t.string "discussion" - t.text "body" - t.boolean "rejected", :default => false + t.string "title", :default => "", :null => false + t.string "discussion", :default => "", :null => false + t.text "body", :default => "", :null => false + t.boolean "rejected", :default => false, :null => false t.datetime "created_at" t.datetime "updated_at" t.integer "user_id" @@ -32,7 +32,7 @@ ActiveRecord::Schema.define(:version => 20110706145154) do t.datetime "meeting_time" t.datetime "created_at" t.datetime "updated_at" - t.string "state", :default => "open" + t.string "state", :default => "open", :null => false t.datetime "key_timestamp" t.boolean "email_reminder_sent", :default => false, :null => false t.text "meeting_log", :default => "", :null => false @@ -57,7 +57,7 @@ ActiveRecord::Schema.define(:version => 20110706145154) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" create_table "participations", :force => true do |t| - t.string "irc_nick" + t.string "irc_nick", :default => "", :null => false t.datetime "created_at" t.datetime "updated_at" t.integer "participant_id" @@ -68,13 +68,13 @@ ActiveRecord::Schema.define(:version => 20110706145154) do add_index "participations", ["participant_id"], :name => "index_participations_on_participant_id" create_table "proxies", :force => true do |t| - t.string "council_member_nick", :null => false - t.string "proxy_nick", :null => false + t.string "council_member_nick", :default => "", :null => false + t.string "proxy_nick", :default => "", :null => false t.datetime "created_at" t.datetime "updated_at" - t.integer "council_member_id", :null => false - t.integer "proxy_id", :null => false - t.integer "agenda_id", :null => false + t.integer "council_member_id", :null => false + t.integer "proxy_id", :null => false + t.integer "agenda_id", :null => false end add_index "proxies", ["agenda_id"], :name => "index_proxies_on_agenda_id" @@ -82,18 +82,18 @@ ActiveRecord::Schema.define(:version => 20110706145154) do add_index "proxies", ["proxy_id"], :name => "index_proxies_on_proxy_id" create_table "users", :force => true do |t| - t.string "salt", :limit => 40 - t.string "remember_token" + t.string "salt", :limit => 40, :default => "", :null => false + t.string "remember_token", :default => "", :null => false t.datetime "remember_token_expires_at" - t.string "name" - t.string "crypted_password", :limit => 60 - t.string "irc_nick" - t.string "email" - t.boolean "administrator", :default => false + t.string "name", :default => "", :null => false + t.string "crypted_password", :limit => 60, :default => "", :null => false + t.string "irc_nick", :default => "", :null => false + t.string "email", :default => "", :null => false + t.boolean "administrator", :default => false, :null => false t.boolean "council_member", :default => false, :null => false t.datetime "created_at" t.datetime "updated_at" - t.string "state", :default => "active" + t.string "state", :default => "active", :null => false t.datetime "key_timestamp" end @@ -112,10 +112,10 @@ ActiveRecord::Schema.define(:version => 20110706145154) do add_index "votes", ["voting_option_id"], :name => "index_votes_on_voting_option_id" create_table "voting_options", :force => true do |t| - t.string "description" + t.string "description", :default => "", :null => false t.datetime "created_at" t.datetime "updated_at" - t.integer "agenda_item_id", :null => false + t.integer "agenda_item_id", :null => false end add_index "voting_options", ["agenda_item_id"], :name => "index_voting_options_on_agenda_item_id" diff --git a/site/features/step_definitions/agenda_steps.rb b/site/features/step_definitions/agenda_steps.rb index 8613fb1..20a6f2a 100644 --- a/site/features/step_definitions/agenda_steps.rb +++ b/site/features/step_definitions/agenda_steps.rb @@ -6,7 +6,7 @@ Given /^an ?(\w*) agenda$/ do |state| end Then /^I should see current date as meeting time$/ do - Then "I should see \"#{Time.now.strftime("%Y-%m-%d")}\" as meeting time" + Then "I should see \"#{Time.now.strftime("%d %b %Y")}\" as meeting time" end When /^I follow link to first agenda$/ do -- cgit v1.2.3-65-gdbad