spec/kattr_spec.rb in kattr-0.0.1 vs spec/kattr_spec.rb in kattr-0.0.2
- old
+ new
@@ -1,33 +1,36 @@
require_relative '../lib/kattr'
-describe Class do
- before do
- class Dog
- cattr_reader :teeth
- cattr_writer :eye_color
- cattr_accessor :hair_color
+class Dog
+ extend KAttr
+
+ kattr_reader :teeth
+ kattr_writer :eye_color
+ kattr_accessor :size
- def self.teeth
- "sharp"
- end
-
- def self.eye_color
- @@eye_color
- end
- end
+ def self.teeth
+ "sharp"
end
- it 'cattr_reader' do
- Dog.teeth.should eq("sharp")
+ def self.eye_color
+ @@eye_color
end
+end
- it 'cattr_writer' do
- Dog.eye_color = "green"
- Dog.eye_color.should eq("green")
- end
+describe Dog do
+ context 'with KAttr' do
- it 'cattr_accessor' do
- Dog.hair_color = 'grey'
- Dog.hair_color.should eq("grey")
+ it 'has sharp teeth' do
+ Dog.teeth.should eq 'sharp'
+ end
+
+ it 'has lovely green eyes' do
+ Dog.eye_color = 'green'
+ Dog.eye_color.should eq 'green'
+ end
+
+ it 'is bloody humongous!' do
+ Dog.size = 'huge'
+ Dog.size.should eq 'huge'
+ end
end
end