Sha256: 25ec2a227a6296f4987abde43483708f27b626ea42fc3d3c32882cc7882096f2
Contents?: true
Size: 1.33 KB
Versions: 24
Compression:
Stored size: 1.33 KB
Contents
require 'spec_helper' require 'unit/resource/builder/shared_example_for_association' describe Resource::Builder::Relations do describe ".has_one" do before do class Example < Transcriber::Resource has_one :item, some_option: 'option' end end let(:field) {:item} let(:many) {false} let(:options) {{some_option: 'option', many: many, has: true}} it_behaves_like "an association" it "puts a new relation in relation list" do Example.relations.find {|relation| relation.name == field}.name.should == field end end describe ".has_many" do before do class Example < Transcriber::Resource has_many :items, some_option: 'option' end end let(:field) {:items} let(:many) {true} let(:options) {{some_option: 'option', many: many, has: true}} it_behaves_like "an association" it "puts a new relation in relation list" do Example.relations.find {|relation| relation.name == field}.name.should == field end end describe ".belongs_to" do before do class Example < Transcriber::Resource belongs_to :item, some_option: 'option' end end let(:field) {:item} let(:many) {false} let(:options) {{some_option: 'option', many: many, has: false}} it_behaves_like "an association" end end
Version data entries
24 entries across 24 versions & 1 rubygems