Skip to content

Commit

Permalink
Add support for #cast_values to EmptyResult
Browse files Browse the repository at this point in the history
This method was introduced in 4.2, where it is used for type casting.
  • Loading branch information
jkemperman committed Sep 26, 2016
1 parent 5db6a6b commit 4b944d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def column_types
def columns
@columns ||= []
end

def cast_values(type_overrides = nil)
rows
end
end

end
8 changes: 8 additions & 0 deletions spec/nulldb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,11 @@ def should_have_column(klass, col_name, col_type)
}.to_not raise_error
end
end

describe ActiveRecord::ConnectionAdapters::NullDBAdapter::EmptyResult do
it "should return an empty array from #cast_values" do
result = described_class.new
expect( result.cast_values ).to be_a Array
expect( result.cast_values ).to be_empty
end
end

0 comments on commit 4b944d3

Please sign in to comment.