spec/unit/fields/checkbox_spec.rb in pdf_ravager-0.1.0 vs spec/unit/fields/checkbox_spec.rb in pdf_ravager-0.2.0
- old
+ new
@@ -1,27 +1,36 @@
require File.dirname(__FILE__) + '/fields_helper'
-require 'pdf_ravager/template'
-class TestCheckbox < MiniTest::Unit::TestCase
+describe PDFRavager::Fields::Checkbox do
- def setup
- @checked = PDFRavager::Fields::Checkbox.new('checkbox1', true, :true_value => 'foo', :false_value => 'bar')
- @unchecked = PDFRavager::Fields::Checkbox.new('checkbox2', false, :true_value => 'foo', :false_value => 'bar')
- end
+ let(:checked) { PDFRavager::Fields::Checkbox.new('checkbox1', true, :true_value => 'foo', :false_value => 'bar') }
+ let(:unchecked) { PDFRavager::Fields::Checkbox.new('checkbox2', false, :true_value => 'foo', :false_value => 'bar') }
- def test_that_custom_checked_acro_form_value_is_set
- assert_equal @checked.acro_form_value, 'foo'
- end
+ context 'checked' do
+ context 'AcroForm value' do
+ it 'sets value properly' do
+ expect(checked.xfa_value).to eq('foo')
+ end
+ end
- def test_that_custom_checked_xfa_value_is_set
- assert_equal @checked.xfa_value, 'foo'
+ context 'XFA value' do
+ it 'sets value properly' do
+ expect(checked.xfa_value).to eq('foo')
+ end
+ end
end
- def test_that_custom_unchecked_acro_form_value_is_set
- assert_equal @unchecked.acro_form_value, 'bar'
- end
+ context 'unchecked' do
+ context 'AcroForm value' do
+ it 'sets value properly' do
+ expect(unchecked.xfa_value).to eq('bar')
+ end
+ end
- def test_that_custom_unchecked_xfa_value_is_set
- assert_equal @unchecked.xfa_value, 'bar'
+ context 'XFA value' do
+ it 'sets value properly' do
+ expect(unchecked.xfa_value).to eq('bar')
+ end
+ end
end
end