Simplify test schema, update form_builder#label test

This commit is contained in:
Jon Atack 2014-10-16 22:32:56 +02:00
parent 00aa193f5f
commit e3163bc247
2 changed files with 5 additions and 15 deletions

View File

@ -6,8 +6,7 @@ module Ransack
router = ActionDispatch::Routing::RouteSet.new
router.draw do
resources :people
resources :notes
resources :people, :comments, :notes
get ':controller(/:action(/:id(.:format)))'
end
@ -64,8 +63,10 @@ module Ransack
context 'with belongs_to association attributes' do
it 'falls back to associated model + column name when no translation' do
html = @f.label :group_name_cont
expect(html).to match /Group Name contains/i
@controller.view_context.search_form_for Comment.search do |f|
html = f.label :article_title_cont
expect(html).to match /Article Title contains/
end
end
end

View File

@ -22,10 +22,6 @@ else
)
end
class Group < ActiveRecord::Base
has_many :people
end
class Person < ActiveRecord::Base
if ActiveRecord::VERSION::MAJOR == 3
default_scope order('id DESC')
@ -33,7 +29,6 @@ class Person < ActiveRecord::Base
default_scope { order(id: :desc) }
end
belongs_to :parent, :class_name => 'Person', :foreign_key => :parent_id
belongs_to :group
has_many :children, :class_name => 'Person', :foreign_key => :parent_id
has_many :articles
has_many :comments
@ -131,14 +126,8 @@ module Schema
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
create_table :groups, :force => true do |t|
t.string :name
t.timestamps null: false
end
create_table :people, :force => true do |t|
t.integer :parent_id
t.integer :group_id
t.string :name
t.string :email
t.string :only_search