Skip to content
Browse files

Update attribute spec to work on all VMs

  • Loading branch information...
1 parent ceed87f commit 138c19dfd7d2b5e4bdcb11fc44b30895b4caada2 @solnic committed Jun 4, 2011
Showing with 12 additions and 8 deletions.
  1. +12 −8 spec/integration/virtus/class_methods/attribute_spec.rb
View
20 spec/integration/virtus/class_methods/attribute_spec.rb
@@ -16,6 +16,10 @@
described_class.attribute(:bday, Date, :writer => :protected)
end
+ let(:public_instance_methods) { described_class.public_instance_methods.map { |method| method.to_s } }
+ let(:protected_instance_methods) { described_class.protected_instance_methods.map { |method| method.to_s } }
+ let(:private_instance_methods) { described_class.private_instance_methods.map { |method| method.to_s } }
+
it "should create an attribute" do
described_class.attributes.should have_key(:name)
end
@@ -25,35 +29,35 @@
end
it "creates attribute writer" do
- described_class.public_instance_methods.should include('name=')
+ public_instance_methods.should include('name=')
end
it "creates attribute reader" do
- described_class.public_instance_methods.should include('name')
+ public_instance_methods.should include('name')
end
it "creates attribute private reader when :accessor => :private" do
- described_class.private_instance_methods.should include('email')
+ private_instance_methods.should include('email')
end
it "creates attribute private writer when :accessor => :private" do
- described_class.private_instance_methods.should include('email=')
+ private_instance_methods.should include('email=')
end
it "creates attribute protected reader when :accessor => :protected" do
- described_class.protected_instance_methods.should include('address')
+ protected_instance_methods.should include('address')
end
it "creates attribute protected writer when :accessor => :protected" do
- described_class.protected_instance_methods.should include('address=')
+ protected_instance_methods.should include('address=')
end
it "creates attribute private reader when :reader => :private" do
- described_class.private_instance_methods.should include('age')
+ private_instance_methods.should include('age')
end
it "creates attribute protected writer when :writer => :protected" do
- described_class.protected_instance_methods.should include('bday=')
+ protected_instance_methods.should include('bday=')
end
end
end

0 comments on commit 138c19d

Please sign in to comment.
Something went wrong with that request. Please try again.