Skip to content

Commit

Permalink
Failing test for :alias_attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
davekrupinski committed Jul 9, 2011
1 parent e2540c8 commit 20961f2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/unit/mongoid/attributes_spec.rb
Expand Up @@ -902,4 +902,32 @@
end
end
end

describe "#alias_attribute" do

let(:klass) do
class AliasAttributeTestClass
include Mongoid::Document
field :name, :type => String
alias_attribute :title, :name
end
AliasAttributeTestClass.new
end

it "sets and accesses :name fine" do
klass.name = "baseline"
klass.name.should == "baseline"
end

it "aliases :name value as :title" do
klass.name = "a value"
klass.title.should == "a value"
end

it "aliases :name= as :title=" do
klass.title = "a title value"
klass.name.should == "a title value"
end
end

end

0 comments on commit 20961f2

Please sign in to comment.