Sha256: 50a66971c6fd672f45a583726f9f60644f24b8bad908a2345109af43870f78cd

Contents?: true

Size: 569 Bytes

Versions: 8

Compression:

Stored size: 569 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

8 entries across 8 versions & 2 rubygems

Version Path
ohm-2.3.0 test/core.rb
ohm-2.2.1 test/core.rb
sohm-0.0.1 test/core.rb
ohm-2.2.0 test/core.rb
ohm-2.1.0 test/core.rb
ohm-2.0.1 test/core.rb
ohm-2.0.0 test/core.rb
ohm-2.0.0.rc2 test/core.rb