Sha256: fd0ebc2c80b17e1fb875429c44e7da72f9ef8b8480f4cee50c942ca63450dc5e

Contents?: true

Size: 882 Bytes

Versions: 2

Compression:

Stored size: 882 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Netzke::ActiveRecord::Attributes do
  it "should return Netzke attributes in natural order" do
    User.send(:netzke_attrs_in_natural_order).map{ |a| a[:name] }.should == %w(id first_name last_name role__name created_at updated_at)
  end

  it "should return exposed Netzke attributes" do
    class UserExt < User
      netzke_expose_attributes :first_name, :created_at
    end
    UserExt.netzke_attributes.map{ |a| a[:name] }.should == %w(id first_name created_at)
  end

  it "should return Netzke attributes including an association attribute represented by a virtual method" do
    Book.netzke_attributes.map{ |a| a[:name] }.should == %w(id author__name title exemplars digitized notes created_at updated_at)
    Book.netzke_attributes.detect{ |a| a[:name] == "author__name" }[:attr_type].should == :string
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
netzke-basepack-0.6.2 spec/active_record/attributes_spec.rb
netzke-basepack-0.6.1 spec/active_record/attributes_spec.rb