check_writer 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/check_writer.gemspec +2 -2
- data/lib/check_writer/attribute_formatting.rb +2 -1
- data/lib/check_writer/check.rb +1 -1
- data/spec/assets/test-0.12.0.pdf +0 -0
- data/spec/assets/test-0.6.1.pdf +0 -0
- data/spec/assets/test-0.6.3.pdf +0 -0
- data/spec/assets/two_in_one-0.12.0.pdf +0 -0
- data/spec/assets/two_in_one-0.6.1.pdf +0 -0
- data/spec/assets/two_in_one-0.6.3.pdf +0 -0
- data/spec/assets/with_stubs-0.12.0.pdf +0 -0
- data/spec/assets/with_stubs-0.6.1.pdf +0 -0
- data/spec/assets/with_stubs-0.6.3.pdf +0 -0
- data/spec/check_spec.rb +9 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/check_writer.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "check_writer"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ryan Winograd"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-12"
|
13
13
|
s.description = "Ruby library for generating PDF checks that you can take to the bank"
|
14
14
|
s.email = "ryan@thewinograds.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -22,7 +22,8 @@ module CheckWriter
|
|
22
22
|
# amount = 1000 => $1,000.00
|
23
23
|
def formatted_amount
|
24
24
|
separated_dollars = dollars.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1,")
|
25
|
-
"
|
25
|
+
cents_string = (cents < 10) ? "0#{cents}" : cents
|
26
|
+
"$#{separated_dollars}.#{cents_string}"
|
26
27
|
end
|
27
28
|
|
28
29
|
# Converts numeric amount of the check into words.
|
data/lib/check_writer/check.rb
CHANGED
@@ -164,7 +164,7 @@ module CheckWriter
|
|
164
164
|
@pdf.horizontal_rule
|
165
165
|
@pdf.move_down 2
|
166
166
|
# TODO: better currency formatting
|
167
|
-
@pdf.text "NOT VALID IF OVER
|
167
|
+
@pdf.text "NOT VALID IF OVER #{formatted_amount}", :size => 8, :align => :center
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
data/spec/assets/test-0.12.0.pdf
CHANGED
Binary file
|
data/spec/assets/test-0.6.1.pdf
CHANGED
Binary file
|
data/spec/assets/test-0.6.3.pdf
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/check_spec.rb
CHANGED
@@ -42,6 +42,15 @@ describe "CheckWriter::Check" do
|
|
42
42
|
@check.formatted_amount.should == "$1,003.23"
|
43
43
|
end
|
44
44
|
|
45
|
+
context "a check for an amount with 0 cents" do
|
46
|
+
before(:each) do
|
47
|
+
@check.amount = 410.0
|
48
|
+
end
|
49
|
+
it "should includes two zeros in the cents" do
|
50
|
+
@check.formatted_amount.should == "$410.00"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
45
54
|
it "assigns the number" do
|
46
55
|
@check.number.should == '12345'
|
47
56
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: check_writer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Winograd
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|