spec/citeproc/variable_spec.rb in citeproc-0.0.2 vs spec/citeproc/variable_spec.rb in citeproc-0.0.3
- old
+ new
@@ -25,13 +25,13 @@
it 'accepts a numeric value' do
Variable.new(23).should == '23'
Variable.new(23.1).should == '23.1'
end
- it 'accepts an attributes hash' do
- Variable.new(:value => 'test').should == 'test'
- end
+ # it 'raises type error when initialized with a hash' do
+ # lambda { Variable.new(:value => 'test') }.should raise_error(TypeError)
+ # end
it 'supports self yielding block' do
Variable.new { |v| v.value = 'test' }.should == 'test'
end
end
@@ -48,10 +48,15 @@
end
it 'contains :text fields' do
Variable.fields[:text].should_not be_empty
end
+
+ it 'contains :number fields' do
+ Variable.fields[:numbers].should_not be_empty
+ Variable.fields[:number].should_not be_empty
+ end
it 'accepts either string or symbol input' do
Variable.fields[:names].should equal Variable.fields['names']
end
end
@@ -59,9 +64,10 @@
describe '.types' do
it 'given a field name returns the corresponding type' do
Variable.types[:author].should == :names
Variable.types[:issued].should == :date
Variable.types[:abstract].should == :text
+ Variable.types[:issue].should == :number
end
it 'accepts either string or symbol input' do
Variable.types.should have_key(:author)
Variable.types['author'].should equal Variable.types[:author]
\ No newline at end of file