Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add spec for Virtus::ClassMethods#attributes

* Make sure the deprecation warning is returned
  • Loading branch information...
commit 5bbc3af0fb969b094c754caf2b8ec4673ea1fd80 1 parent 9e1bd9d
Dan Kubb dkubb authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 spec/unit/virtus/class_methods/attributes_spec.rb
23 spec/unit/virtus/class_methods/attributes_spec.rb
View
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe Virtus::ClassMethods, '#attributes' do
+ subject { object.attributes }
+
+ before do
+ @original_stderr, $stderr = $stderr, StringIO.new
+ end
+
+ after do
+ $stderr = @original_stderr
+ end
+
+ let(:object) { Class.new { extend Virtus::ClassMethods } }
+
+ it { should be_instance_of(Virtus::AttributeSet) }
+
+ it 'returns a deprecation warning' do
+ lambda { subject }.should change { $stderr.string.dup }.from('').to(
+ "#{object}.attributes is deprecated. Use #{object}.attribute_set instead: #{__FILE__}:4\n"
+ )
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.