Sha256: 062415f62b2d52cb78694fe3e0494bbd6329d62d2fde6bc4b4cac9b4259ff949

Contents?: true

Size: 571 Bytes

Versions: 7

Compression:

Stored size: 571 Bytes

Contents

require_relative "helper"

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_equal "32° Kisei-sen", Event[event.id].name
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ohm_util-0.1 test/core.rb
ohm-3.1.1 test/core.rb
ohm-3.1.0 test/core.rb
ohm-3.0.3 test/core.rb
ohm-3.0.2 test/core.rb
ohm-3.0.1 test/core.rb
ohm-3.0.0 test/core.rb