Sha256: ab8581f8c2aa8bd5227dadfc45a8b5ae61c9337484e9ce1c1e5cfff6e11edb63

Contents?: true

Size: 1.01 KB

Versions: 18

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

module RailsBestPractices::Core
  describe ModelAssociations do
    let(:model_associations) { ModelAssociations.new }

    before :each do
      model_associations.add_association("Project", "project_manager", "belongs_to")
      model_associations.add_association("Project", "people", "has_many", "Person")
    end

    it "should get model associations" do
      model_associations.get_association("Project", "project_manager").should == {"meta" => "belongs_to", "class_name" => "ProjectManager"}
      model_associations.get_association("Project", "people").should == {"meta" => "has_many", "class_name" => "Person"}
      model_associations.get_association("Project", "unknown").should be_nil
    end

    it "should check is model associatiosn" do
      model_associations.is_association?("Project", "project_manager").should be_true
      model_associations.is_association?("Project", "people").should be_true
      model_associations.is_association?("Project", "unknown").should be_false
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rails_best_practices-1.14.4 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.14.3 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.14.2 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.14.1 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.14.0 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.13.8 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.13.5 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.13.4 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.13.3 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.13.2 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.13.1 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.13.0 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.12.0 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.11.1 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.11.0 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.10.1 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.10.0 spec/rails_best_practices/core/model_associations_spec.rb
rails_best_practices-1.9.1 spec/rails_best_practices/core/model_associations_spec.rb