aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-23 20:45:52 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-23 20:45:52 +0100
commit0ead2c0121026f70b6a98348cc1d71e11ced5a38 (patch)
treec045a1db0f089659f86a5d98b52b5ef8cd44345f
parentd1d3d417b77d73b87273bec06b28604de494c07d (diff)
downloadpdf-calendars-0ead2c0121026f70b6a98348cc1d71e11ced5a38.tar.gz
pdf-calendars-0ead2c0121026f70b6a98348cc1d71e11ced5a38.tar.bz2
pdf-calendars-0ead2c0121026f70b6a98348cc1d71e11ced5a38.zip
Add new expectation
-rw-r--r--lib/carlosgoce/layout/layouts.rb9
-rw-r--r--lib/carlosgoce/layouts.rb7
-rw-r--r--spec/calendar_spec.rb4
-rw-r--r--spec/layouts_spec.rb18
-rw-r--r--spec/output/.gitignore0
5 files changed, 29 insertions, 9 deletions
diff --git a/lib/carlosgoce/layout/layouts.rb b/lib/carlosgoce/layout/layouts.rb
new file mode 100644
index 0000000..7871ebb
--- /dev/null
+++ b/lib/carlosgoce/layout/layouts.rb
@@ -0,0 +1,9 @@
+module CarlosGoce
+ module Layout
+ class Simple
+ def create (file, data, year)
+
+ end
+ end
+ end
+end \ No newline at end of file
diff --git a/lib/carlosgoce/layouts.rb b/lib/carlosgoce/layouts.rb
deleted file mode 100644
index f3e171c..0000000
--- a/lib/carlosgoce/layouts.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module CarlosGoce
- class Layout
- def create(file, hash, year)
-
- end
- end
-end \ No newline at end of file
diff --git a/spec/calendar_spec.rb b/spec/calendar_spec.rb
index 3680b3b..6739a9f 100644
--- a/spec/calendar_spec.rb
+++ b/spec/calendar_spec.rb
@@ -1,6 +1,6 @@
require 'rspec'
require_relative '../lib/carlosgoce/calendar'
-require_relative '../lib/carlosgoce/layouts'
+require_relative '../lib/carlosgoce/layout/layouts'
I18n.load_path = Dir['config/locales/*.yml']
I18n.backend.load_translations
@@ -45,7 +45,7 @@ describe 'Calendar' do
describe 'Can generate a pdfs' do
it 'should receive a layout and pass it the data to create the specified file' do
- layout = instance_double('CarlosGoce::Layout')
+ layout = instance_double('CarlosGoce::Layout::Simple')
file = 'destionation.pdf'
year = 2015
expect(layout).to receive(:create).with(file, @calendar.to_h, year)
diff --git a/spec/layouts_spec.rb b/spec/layouts_spec.rb
new file mode 100644
index 0000000..5ff9ccf
--- /dev/null
+++ b/spec/layouts_spec.rb
@@ -0,0 +1,18 @@
+require 'rspec'
+require_relative '../lib/carlosgoce/calendar'
+require_relative '../lib/carlosgoce/layout/layouts'
+
+describe 'Layout simple' do
+ before(:each) do
+ @calendar = CarlosGoce::Calendar.new
+ @layout = CarlosGoce::Layout::Simple.new
+ @file = 'output/simple.pdf'
+ FileUtils.rm_f(@file)
+ end
+
+ # Check the generated file on spec/output
+ it 'creates a pdf' do
+ @calendar.generate(@layout, @file, Date.today.year)
+ expect(File.exist? @file).to be(true), lambda {"File #{@file} was not created"}
+ end
+end \ No newline at end of file
diff --git a/spec/output/.gitignore b/spec/output/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/spec/output/.gitignore