Sha256: cb7df78e88b99da761d9f1c1be5b19901f8049c35b893962ae872792a27d349d

Contents?: true

Size: 532 Bytes

Versions: 4

Compression:

Stored size: 532 Bytes

Contents

require 'spec_helper'

describe Mongoid::SortedRelations do
  context "having the book The Art of War" do
    let(:book) { Book.new(:title => 'The Art of War') }

    context "written by the authors Sun Tzu, Sun Wu and Lao Zi" do
      before { book.author_ids = [Author.create(:name => 'Sun Tzu').id, Author.create(:name => 'Sun Wu').id, Author.create(:name => 'Lao Zi').id] }
      before { book.save and book.reload }

      the("book.sorted_authors.map(&:name)") { should eql ['Sun Tzu', 'Sun Wu', 'Lao Zi'] }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-sorted-relations-0.0.4 spec/mongoid/sorted_relations_spec.rb
mongoid-sorted-relations-0.0.3 spec/mongoid/sorted_relations_spec.rb
mongoid-sorted-relations-0.0.2 spec/mongoid/sorted_relations_spec.rb
mongoid-sorted-relations-0.0.1 spec/mongoid/sorted_relations_spec.rb