junodoc 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  module JunoDoc
2
- require 'jars/j2w-ejb-2.0_2011Jun06'
3
- require 'jars/xstream-1.3.1'
2
+ require File.dirname(__FILE__) + '/../../jars/j2w-ejb-2.0_2011Jun06'
3
+ require File.dirname(__FILE__) + '/../../jars/xstream-1.3.1'
4
4
 
5
5
  class Document
6
6
  import 'java.io.PrintWriter'
@@ -14,8 +14,6 @@ module JunoDoc
14
14
  import 'word.w2004.elements.Paragraph'
15
15
  import 'word.w2004.elements.Table'
16
16
 
17
- attr_accessor :name
18
-
19
17
  def initialize
20
18
  @doc = create_document
21
19
  end
@@ -34,7 +32,7 @@ module JunoDoc
34
32
  end
35
33
 
36
34
  def write_document(path)
37
- writer = PrintWriter.new(File.new(path + @name))
35
+ writer = PrintWriter.new(File.new(path))
38
36
  writer.println(@doc.getContent)
39
37
  writer.close
40
38
  end
@@ -1,3 +1,3 @@
1
1
  module Junodoc
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -3,17 +3,12 @@ require File.dirname(__FILE__) + "/spec_helper"
3
3
  describe JunoDoc::Document do
4
4
  before do
5
5
  @junodoc = JunoDoc::Document.new
6
- @junodoc.name = "what's_up.doc"
7
6
  end
8
7
 
9
8
  it "should be an instance of JunoDoc::Document" do
10
9
  @junodoc.class.must_equal(JunoDoc::Document)
11
10
  end
12
11
 
13
- it "should be able to set the name of the document" do
14
- @junodoc.name.must_equal("what's_up.doc")
15
- end
16
-
17
12
  it "should be able to add text to the document" do
18
13
  @junodoc.add_text("istanbul, not constantinople")
19
14
  end
@@ -33,6 +28,9 @@ describe JunoDoc::Document do
33
28
  @junodoc.add_text("istanbul, not constantinople")
34
29
  @junodoc.add_paragraph_break
35
30
  @junodoc.add_image("file://#{Dir.pwd}/spec/fixtures/image.jpg")
36
- @junodoc.write_document(Dir.pwd + '/spec/output/')
31
+ full_file_path = Dir.pwd + '/spec/output/test.doc'
32
+ @junodoc.write_document(full_file_path)
33
+ File.exists?(full_file_path).must_equal true
34
+ File.unlink(full_file_path)
37
35
  end
38
36
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: junodoc
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dan Herrera