aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib')
-rwxr-xr-xspec/lib/external_command_scripts/output.sh22
-rw-r--r--spec/lib/external_command_spec.rb40
-rw-r--r--spec/lib/tmail_extensions_spec.rb9
3 files changed, 9 insertions, 62 deletions
diff --git a/spec/lib/external_command_scripts/output.sh b/spec/lib/external_command_scripts/output.sh
deleted file mode 100755
index 0472c89a3..000000000
--- a/spec/lib/external_command_scripts/output.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-out_msg=${1:-out}
-err_msg=${2:-}
-repeats=${3:-10}
-exit_status=${4:-0}
-
-n=0
-while [ "$n" -lt "$repeats" ]
-do
- if [ -n "$out_msg" ]
- then
- echo "$out_msg $n"
- fi
- if [ -n "$err_msg" ]
- then
- echo >&2 "$err_msg $n"
- fi
- n=$[$n + 1]
-done
-
-exit "$exit_status"
diff --git a/spec/lib/external_command_spec.rb b/spec/lib/external_command_spec.rb
deleted file mode 100644
index 0ff1a9c0a..000000000
--- a/spec/lib/external_command_spec.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# This is a test of the external_command library
-
-require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-script_dir = File.join(File.dirname(__FILE__), 'external_command_scripts')
-output_script = File.join(script_dir, "output.sh")
-
-require 'external_command'
-
-describe "when running ExternalCommand" do
-
- it "should get correct status code for /bin/true" do
- t = ExternalCommand.new("/bin/true").run()
- t.status.should == 0
- t.out.should == ""
- t.err.should == ""
- end
-
- it "should get correct status code for /bin/false" do
- f = ExternalCommand.new("/bin/false").run()
- f.status.should == 1
- f.out.should == ""
- f.err.should == ""
- end
-
- it "should get stdout and stderr" do
- f = ExternalCommand.new(output_script, "out", "err", "10", "23").run()
- f.status.should == 23
- f.out.should == (0..9).map {|i| "out #{i}\n"}.join("")
- f.err.should == (0..9).map {|i| "err #{i}\n"}.join("")
- end
-
- it "should work with large amounts of data" do
- f = ExternalCommand.new(output_script, "a longer output line", "a longer error line", "10000", "5").run()
- f.status.should == 5
- f.out.should == (0..9999).map {|i| "a longer output line #{i}\n"}.join("")
- f.err.should == (0..9999).map {|i| "a longer error line #{i}\n"}.join("")
- end
-
-end
-
diff --git a/spec/lib/tmail_extensions_spec.rb b/spec/lib/tmail_extensions_spec.rb
index c647fe522..ffb8cb178 100644
--- a/spec/lib/tmail_extensions_spec.rb
+++ b/spec/lib/tmail_extensions_spec.rb
@@ -27,5 +27,14 @@ describe "when using TMail" do
mail.to.should == ["request-66666-caa77777@whatdotheyknow.com", "foi@example.com"]
end
+ it 'should convert to utf8' do
+ # NB this isn't actually a TMail extension, but is core TMail;
+ # this was just a convenient place to assert the UTF8
+ # conversion is working
+ mail = TMail::Mail.parse(load_file_fixture('iso8859_2_raw_email.email'))
+ mail.subject.should have_text(/gjatë/u)
+ mail.body.is_utf8?.should == true
+ end
+
end