Skip to content

Commit

Permalink
rails 5: fix canvas_partman
Browse files Browse the repository at this point in the history
refs CNVS-34862

Change-Id: I196adc8f6e103490f1589d206d4efff0bf94d5a0
Reviewed-on: https://gerrit.instructure.com/102245
Tested-by: Jenkins
Reviewed-by: Simon Williams <[email protected]>
Product-Review: Cody Cutrer <[email protected]>
QA-Review: Cody Cutrer <[email protected]>
  • Loading branch information
ccutrer committed Feb 15, 2017
1 parent 4930ea3 commit 6158735
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ def arel_table_from_key_values(attributes)

@arel_tables ||= {}
@arel_tables[partition_table_name] ||= begin
Arel::Table.new(partition_table_name, { engine: self.arel_engine })
if ::ActiveRecord.version < Gem::Version.new('5')
Arel::Table.new(partition_table_name, { engine: self.arel_engine })
else
Arel::Table.new(partition_table_name, type_caster: type_caster)
end
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@
describe "#create_initial_partitions" do
it "creates sufficient partitions" do
expect(subject.base_class).to receive(:maximum).and_return(13)
expect(subject).to receive(:create_partition).with(0)
expect(subject).to receive(:create_partition).with(5)
expect(subject).to receive(:create_partition).with(10)
expect(subject).to receive(:create_partition).with(15)
expect(subject).to receive(:create_partition).with(20)
expect(subject).to receive(:create_partition).with(0, graceful: true)
expect(subject).to receive(:create_partition).with(5, graceful: true)
expect(subject).to receive(:create_partition).with(10, graceful: true)
expect(subject).to receive(:create_partition).with(15, graceful: true)
expect(subject).to receive(:create_partition).with(20, graceful: true)

subject.create_initial_partitions(2)
end
Expand Down

0 comments on commit 6158735

Please sign in to comment.