Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
[data_objects] Provide spec for subclasses of String as parameters
Browse files Browse the repository at this point in the history
* See previous commit 59923d1, 441ecd5.

[#1123 state:resolved]

Signed-off-by: Alex Coles <alex@alexcolesportfolio.com>
  • Loading branch information
myabc committed Nov 14, 2009
1 parent 441ecd5 commit 02efb86
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions data_objects/lib/data_objects/spec/typecast/string_spec.rb
Expand Up @@ -83,4 +83,25 @@

end

class StringWithExtraPowers < String; end

describe 'writing a kind of (subclass of) String' do

before do
@reader = @connection.create_command("SELECT id FROM widgets WHERE id = ?").execute_reader(StringWithExtraPowers.new("2"))
@reader.next!
@values = @reader.values
end

after do
@reader.close
end

it 'should return the correct entry' do
# Some of the drivers starts autoincrementation from 0 not 1
@values.first.should satisfy { |val| val == 1 or val == 2 }
end

end

end

0 comments on commit 02efb86

Please sign in to comment.