Merge pull request #1263 from activerecord-hackery/revert-1176-1153-incorrect-reference-to-table-alias
Revert "Add spec described in #1153."
This commit is contained in:
commit
25c5c9dfec
|
@ -1,31 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
module Ransack
|
|
||||||
describe Search do
|
|
||||||
describe '#ransack' do
|
|
||||||
context 'parameters provided in a harmonious order' do
|
|
||||||
it 'produces the expected result' do
|
|
||||||
result = ProviderCalendar.
|
|
||||||
ransack({ "account_email_cont" => "account1", "user_email_eq" => "user2@somedomain.com" }).
|
|
||||||
result.
|
|
||||||
map(&:provider_id).
|
|
||||||
sort
|
|
||||||
|
|
||||||
expect(result).to eq(["account1_user2@mail.com", "aksshkdhak@whatever.provider.com"])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'parameters provided in a disharmonious order' do
|
|
||||||
it 'produces the expected result' do
|
|
||||||
result = ProviderCalendar.
|
|
||||||
ransack({ "user_email_eq" => "user2@somedomain.com", "account_email_cont" => "account1" }).
|
|
||||||
result.
|
|
||||||
map(&:provider_id).
|
|
||||||
sort
|
|
||||||
|
|
||||||
expect(result).to eq(["account1_user2@mail.com", "aksshkdhak@whatever.provider.com"])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -199,34 +199,6 @@ class Note < ActiveRecord::Base
|
||||||
belongs_to :notable, polymorphic: true
|
belongs_to :notable, polymorphic: true
|
||||||
end
|
end
|
||||||
|
|
||||||
class User < ActiveRecord::Base
|
|
||||||
has_many :accounts,
|
|
||||||
class_name: "ProviderAccount"
|
|
||||||
has_many :contacts,
|
|
||||||
class_name: "ProviderContact",
|
|
||||||
through: :accounts,
|
|
||||||
source: :contacts
|
|
||||||
has_many :calendars,
|
|
||||||
class_name: "ProviderCalendar",
|
|
||||||
through: :accounts,
|
|
||||||
source: :calendars
|
|
||||||
end
|
|
||||||
|
|
||||||
class ProviderAccount < ActiveRecord::Base
|
|
||||||
belongs_to :user
|
|
||||||
|
|
||||||
has_many :calendars, class_name: "ProviderCalendar"
|
|
||||||
end
|
|
||||||
|
|
||||||
class ProviderCalendar < ActiveRecord::Base
|
|
||||||
belongs_to :account,
|
|
||||||
class_name: "ProviderAccount",
|
|
||||||
foreign_key: "provider_account_id",
|
|
||||||
inverse_of: :calendars
|
|
||||||
|
|
||||||
has_one :user, through: :account
|
|
||||||
end
|
|
||||||
|
|
||||||
module Schema
|
module Schema
|
||||||
def self.create
|
def self.create
|
||||||
ActiveRecord::Migration.verbose = false
|
ActiveRecord::Migration.verbose = false
|
||||||
|
@ -285,25 +257,6 @@ module Schema
|
||||||
t.integer :target_person_id
|
t.integer :target_person_id
|
||||||
t.integer :article_id
|
t.integer :article_id
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "users", force: :cascade do |t|
|
|
||||||
t.string "email", default: "", null: false
|
|
||||||
t.index ["email"], name: "idx_users_on_email", unique: true
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "provider_accounts", force: :cascade do |t|
|
|
||||||
t.bigint "user_id", null: false
|
|
||||||
t.string "email", null: false
|
|
||||||
t.index ["email"], name: "idx_p_accounts_on_email"
|
|
||||||
t.index ["user_id"], name: "idx_p_accounts_on_user_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "provider_calendars", force: :cascade do |t|
|
|
||||||
t.bigint "provider_account_id", null: false
|
|
||||||
t.string "provider_id", null: false
|
|
||||||
t.index ["provider_account_id", "provider_id"], name: "idx_p_calendars_on_p_account_id_and_p_id", unique: true
|
|
||||||
t.index ["provider_account_id"], name: "idx_p_calendars_on_p_account_id"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
10.times do
|
10.times do
|
||||||
|
@ -325,21 +278,6 @@ module Schema
|
||||||
body: 'First post!',
|
body: 'First post!',
|
||||||
article: Article.make(title: 'Hello, world!')
|
article: Article.make(title: 'Hello, world!')
|
||||||
)
|
)
|
||||||
|
|
||||||
user1 = User.create!(email: "user1@somedomain.com")
|
|
||||||
user2 = User.create!(email: "user2@somedomain.com")
|
|
||||||
user1_acct1 = ProviderAccount.create!(user: user1, email: "account1_user1@mail.com")
|
|
||||||
user1_acct2 = ProviderAccount.create!(user: user1, email: "account2_user1@mail.com")
|
|
||||||
user2_acct1 = ProviderAccount.create!(user: user2, email: "account1_user2@mail.com")
|
|
||||||
user2_acct2 = ProviderAccount.create!(user: user2, email: "account2_user2@mail.com")
|
|
||||||
ProviderCalendar.create!(account: user1_acct1, provider_id: "account1_user1@mail.com")
|
|
||||||
ProviderCalendar.create!(account: user1_acct1, provider_id: "something_else@whatever.provider.com")
|
|
||||||
ProviderCalendar.create!(account: user1_acct2, provider_id: "account2_user1@mail.com")
|
|
||||||
ProviderCalendar.create!(account: user1_acct2, provider_id: "blahblahblah@whatever.provider.com")
|
|
||||||
ProviderCalendar.create!(account: user2_acct1, provider_id: "account1_user2@mail.com")
|
|
||||||
ProviderCalendar.create!(account: user2_acct1, provider_id: "aksshkdhak@whatever.provider.com")
|
|
||||||
ProviderCalendar.create!(account: user2_acct2, provider_id: "account2_user2@mail.com")
|
|
||||||
ProviderCalendar.create!(account: user2_acct2, provider_id: "noisenoisenoise@whatever.provider.com")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue