spec/check_spec.rb in check_writer-0.4.3 vs spec/check_spec.rb in check_writer-0.4.4
- old
+ new
@@ -62,10 +62,24 @@
# write_content_to_file('test', data)
assert_data_matches_file_content('test', data)
end
+ context "void" do
+ before(:each) do
+ @check.void = true
+ @data = @check.to_pdf
+ end
+
+ it "generates a pdf with VOID on the check stub" do
+ # Use this line to re-write the PDF we test against
+ # write_content_to_file('void', @data)
+
+ assert_data_matches_file_content('void', @data)
+ end
+ end
+
context "with stubs" do
before(:each) do
@check.with_stubs = true
@data = @check.to_pdf
end
@@ -74,40 +88,77 @@
# Use this line to re-write the PDF we test against
# write_content_to_file('with_stubs', @data)
assert_data_matches_file_content('with_stubs', @data)
end
+
+ context "blank" do
+ before(:each) do
+ @check.blank = true
+ @data = @check.to_pdf
+ end
+
+ it "generates a pdf with VOID on the check stub" do
+ # Use this line to re-write the PDF we test against
+ # write_content_to_file('blank', @data)
+
+ assert_data_matches_file_content('blank', @data)
+ end
+ end
end
+ it "raises exception when stub_format invalid" do
+ expect { @check.stub_format = :wrong }.to raise_error
+ expect { @check.stub_format = :two_thirds }.to_not raise_error
+ end
+
+ context "with two-thirds stub" do
+ before(:each) do
+ @check.stub_format = :two_thirds
+ @check.with_stubs = true
+ @data = @check.to_pdf
+ end
+
+ it "generates a pdf with check stubs stroked and some basic info" do
+ # Use this line to re-write the PDF we test against
+ # write_content_to_file('with_two_thirds_stub', @data)
+
+ assert_data_matches_file_content('with_two_thirds_stub', @data)
+ end
+ end
+
context "with stub table data" do
before(:each) do
@stub_table_data = [
['Name', 'Acct No', 'Invoice', 'Date', 'Notes', 'Amount'], # header
['Box Company LLC', '89982376', '1978612', '1/1/2000', 'For boxes delivered', '$1,000.00'],
['Box Company LLC', '89982376', '1978612', '1/1/2000', 'For boxes delivered', '$1,000.00']
]
@check.stub_table_data = @stub_table_data
@check.stub_table_options = {:row_colors => ['ff0000', 'ffffff']}
+ @check.stub_table_lambda = lambda { |t|
+ t.cells.column(5).align = :right
+ }
@check.with_stubs = true
@data = @check.to_pdf
end
it "generates a pdf with stub table data" do
# Use this line to re-write the PDF we test against
# write_content_to_file('with_stub_table_data', @data)
- #assert_data_matches_file_content('with_stub_table_data', @data)
+ assert_data_matches_file_content('with_stub_table_data', @data)
end
end
context "with second signature line" do
before(:each) do
@check.second_signature_line = true
@data = @check.to_pdf
end
it "generates a pdf with a second signature line" do
# Use this line to re-write the PDF we test against
- write_content_to_file('with_second_signature_line', @data)
+ # write_content_to_file('with_second_signature_line', @data)
assert_data_matches_file_content('with_second_signature_line', @data)
end
end