Sha256: 65ecbcd247696d98c9c554c587f788a2fd43386558f7478702579cbc8ecf4d73

Contents?: true

Size: 851 Bytes

Versions: 18

Compression:

Stored size: 851 Bytes

Contents

require 'spec_helper'

module RailsBestPractices::Core
  describe ModelAttributes do
    let(:model_attributes) { ModelAttributes.new }

    before :each do
      model_attributes.add_attribute("Post", "title", :string)
      model_attributes.add_attribute("Post", "user_id", :integer)
    end

    it "should get model attributes" do
      model_attributes.get_attribute_type("Post", "title").should == :string
      model_attributes.get_attribute_type("Post", "user_id").should == :integer
      model_attributes.get_attribute_type("Post", "unknonw").should be_nil
    end

    it "should check is model attributes" do
      model_attributes.is_attribute?("Post", "title").should be_true
      model_attributes.is_attribute?("Post", "user_id").should be_true
      model_attributes.is_attribute?("Post", "unknonw").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_attributes_spec.rb
rails_best_practices-1.14.3 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.14.2 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.14.1 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.14.0 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.13.8 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.13.5 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.13.4 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.13.3 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.13.2 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.13.1 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.13.0 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.12.0 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.11.1 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.11.0 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.10.1 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.10.0 spec/rails_best_practices/core/model_attributes_spec.rb
rails_best_practices-1.9.1 spec/rails_best_practices/core/model_attributes_spec.rb