Sha256: 186633ce87b15dcc63b64caa4837b08b1c31e09197300d6884af5d51a641481d
Contents?: true
Size: 717 Bytes
Versions: 15
Compression:
Stored size: 717 Bytes
Contents
require_relative 'helper' class Post < Ohm::Model end class User < Ohm::Model attribute :name index :name 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 test "#ids returns an array with the ids" do user_ids = [ User.create(name: "John").id, User.create(name: "Jane").id ] assert_equal user_ids, User.all.ids result = User.find(name: "John").union(name: "Jane") assert_equal user_ids, result.ids end
Version data entries
15 entries across 15 versions & 3 rubygems