aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/carlosgoce/calendar.rb4
-rw-r--r--lib/carlosgoce/layouts.rb7
-rw-r--r--spec/calendar_spec.rb11
3 files changed, 22 insertions, 0 deletions
diff --git a/lib/carlosgoce/calendar.rb b/lib/carlosgoce/calendar.rb
index 96ac182..370ada6 100644
--- a/lib/carlosgoce/calendar.rb
+++ b/lib/carlosgoce/calendar.rb
@@ -29,5 +29,9 @@ module CarlosGoce
end
}
end
+
+ def generate(layout, file)
+ layout.create file
+ end
end
end
diff --git a/lib/carlosgoce/layouts.rb b/lib/carlosgoce/layouts.rb
new file mode 100644
index 0000000..65d5ad1
--- /dev/null
+++ b/lib/carlosgoce/layouts.rb
@@ -0,0 +1,7 @@
+module CarlosGoce
+ class Layout
+ def create(file)
+
+ end
+ end
+end \ No newline at end of file
diff --git a/spec/calendar_spec.rb b/spec/calendar_spec.rb
index ce042fc..765c4d9 100644
--- a/spec/calendar_spec.rb
+++ b/spec/calendar_spec.rb
@@ -1,5 +1,6 @@
require 'rspec'
require_relative '../lib/carlosgoce/calendar'
+require_relative '../lib/carlosgoce/layouts'
I18n.load_path = Dir['config/locales/*.yml']
I18n.backend.load_translations
@@ -42,4 +43,14 @@ describe 'Calendar' do
end
end
+
+ 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')
+ file = 'destionation.pdf'
+ expect(layout).to receive(:create).with(file)
+
+ @calendar.generate(layout, file)
+ end
+ end
end \ No newline at end of file