Sha256: 8fa6f11803cc6d2e29719f1bf3381f8d0a916d7829e5198eba1363ef6d27b5c0
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' describe RestModel::Association do describe "#initialize" do context "options[:class_name]" do context "when it's passed" do subject do RestModel::Association.new(:login, class_name: :some_class) end it "sets class_name" do subject.instance_variable_get("@class_name").should == "SomeClass" end end context "when it isn't passed" do subject {RestModel::Association.new(:login)} it "uses default class_name" do subject.instance_variable_get("@class_name").should == "Login" end end end context "options[:many]" do context "when it's true" do subject {RestModel::Association.new(:login, many: true)} its(:one?) {should be_false} its(:many?) {should be_true} end context "when it's false" do subject {RestModel::Association.new(:login, many: false)} its(:one?) {should be_true} its(:many?) {should be_false} end context "when it isn't passed" do subject {RestModel::Association.new(:login)} its(:one?) {should be_true} its(:many?) {should be_false} end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rest_model-0.3.1 | spec/unit/key/association_spec.rb |
rest_model-0.3.0 | spec/unit/key/association_spec.rb |
rest_model-0.2.3 | spec/unit/key/association_spec.rb |