Sha256: f32d7dca31bb3820dc43f586615e31349821859f1ae265459b77c2ee4309ac5f

Contents?: true

Size: 631 Bytes

Versions: 22

Compression:

Stored size: 631 Bytes

Contents

# encoding: UTF-8

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

class Event < Ohm::Model
  attribute :name
  attribute :location
end

test "assign attributes from the hash" do
  event = Event.new(:name => "Ruby Tuesday")
  assert_equal event.name, "Ruby Tuesday"
end

test "assign an ID and save the object" do
  event1 = Event.create(:name => "Ruby Tuesday")
  event2 = Event.create(:name => "Ruby Meetup")

  assert_equal "1", event1.id
  assert_equal "2", event2.id
end

test "save the attributes in UTF8" do
 event = Event.create(:name => "32° Kisei-sen")
 assert "32° Kisei-sen" == Event[event.id].name
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ohm-1.4.0 test/core.rb
ohm-2.0.0.alpha4 test/core.rb
ohm-2.0.0.alpha3 test/core.rb
ohm-2.0.0.alpha2 test/core.rb
ohm-2.0.0.alpha1 test/core.rb
ohm-1.3.2 test/core.rb
ohm-1.3.1 test/core.rb
ohm-1.3.0 test/core.rb
ohm-1.2.0 test/core.rb
ohm-1.1.2 test/core.rb
ohm-1.1.1 test/core.rb
ohm-1.1.0 test/core.rb
ohm-1.1.0.rc1 test/core.rb
ohm-1.0.2 test/core.rb
ohm-1.0.1 test/core.rb
ohm-1.0.0 test/core.rb
ohm-1.0.0.rc4 test/core.rb
ohm-1.0.0.rc3 test/core.rb
ohm-1.0.0.rc2 test/core.rb
ohm-1.0.0.rc1 test/core.rb