Sha256: c5b8a1998e2f999bfd4efc02016b724f7ab939913efc179bdf7e256ed1cbde8b

Contents?: true

Size: 415 Bytes

Versions: 1

Compression:

Stored size: 415 Bytes

Contents

require_relative 'helper'

class Post < Ohm::Model
end

class User < Ohm::Model
  set :posts, :Post
end

test '#exists? returns false if the given id is not included in the set' do
  assert !User.create.posts.exists?('nonexistent')
end

test '#exists? returns true if the given id is included in the set' do
  user = User.create
  post = Post.create
  user.posts.add(post)

  assert user.posts.exists?(post.id)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ohm-2.0.0.rc1 test/set.rb