Sha256: 833010e7e30b0b47cac7e233481432acab33c437ac738559b5ec8a0d22515a59

Contents?: true

Size: 731 Bytes

Versions: 2

Compression:

Stored size: 731 Bytes

Contents

# encoding: UTF-8

require File.expand_path("./helper", File.dirname(__FILE__))

class Post < Ohm::Model
  include Ohm::Typecast

  attribute :content
end

test "handles nil case correctly" do
  post = Post.create(:content => nil)
  post = Post[post.id]

  assert nil == post.content
end

test "still responds to string methods properly" do
  post = Post.create(:content => "FooBar")
  post = Post[post.id]

  assert "foobar" == post.content.downcase
end

test "mutating methods like upcase!" do
  post = Post.create(:content => "FooBar")
  post = Post[post.id]

  post.content.upcase!

  assert "FOOBAR" == post.content.to_s
end

test "inspecting" do
  post = Post.new(:content => "FooBar")
  assert 'FooBar' == post.content
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ohm-contrib-0.0.34 test/typecast_string_test.rb
ohm-contrib-0.0.33 test/typecast_string_test.rb