Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OID::Bit#cast_value #26232

Merged
merged 1 commit into from
Aug 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def type
:bit
end

def cast(value)
def cast_value(value)
if ::String === value
case value
when /^0x/i
Expand All @@ -16,7 +16,7 @@ def cast(value)
value # Bit-string notation
end
else
value
value.to_s
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ def test_assigning_invalid_hex_string_raises_exception
end

def test_roundtrip
PostgresqlBitString.create! a_bit: "00001010", a_bit_varying: "0101"
record = PostgresqlBitString.first
record = PostgresqlBitString.create!(a_bit: "00001010", a_bit_varying: "0101")
assert_equal "00001010", record.a_bit
assert_equal "0101", record.a_bit_varying
assert_nil record.another_bit
assert_nil record.another_bit_varying

record.a_bit = "11111111"
record.a_bit_varying = "0xF"
Expand Down