Permalink
Browse files

Include Launchy in gemfile. Be sure that Launchy is used correctly th…

…rough tests.
  • Loading branch information...
1 parent 72da386 commit 016fe4f5f2afc732645f3ee3ab1d5c83a2bb3ea4 @hammerdr hammerdr committed Apr 3, 2012
Showing with 22 additions and 1 deletion.
  1. +1 −0 Gemfile
  2. +1 −0 Gemfile.lock
  3. +0 −1 lib/email_spec/email_viewer.rb
  4. +20 −0 spec/email_spec/email_viewer_spec.rb
View
@@ -20,6 +20,7 @@ gem 'sqlite3-ruby', :require=>'sqlite3'
#gem 'email_spec', :path => '.'
gem 'capybara'
gem 'database_cleaner'
+gem 'launchy'
gem "test-unit"
View
@@ -170,6 +170,7 @@ DEPENDENCIES
email_spec!
growl-glue
jeweler
+ launchy
mail
mimetype-fu
pony
@@ -76,7 +76,6 @@ def self.save_and_open_email_attachments_list(mail)
open_in_text_editor(filename)
end
- # TODO: use the launchy gem for this stuff...
def self.open_in_text_editor(filename)
Launchy.open(URI.parse("file://#{File.expand_path(filename)}"), :application => :editor)
end
@@ -0,0 +1,20 @@
+require 'spec_helper'
+require 'launchy'
+
+describe EmailSpec::EmailViewer do
+ describe ".open_in_browser" do
+ it "should open with launchy" do
+ expected_uri = URI("file://#{File.expand_path("a_file")}")
+ Launchy.should_receive(:open).with(expected_uri)
+ EmailSpec::EmailViewer.open_in_browser("a_file")
+ end
+ end
+
+ describe ".open_in_text_editor" do
+ it "should open with launchy" do
+ expected_uri = URI("file://#{File.expand_path("a_file")}")
+ Launchy.should_receive(:open).with(expected_uri, {application: :editor})
+ EmailSpec::EmailViewer.open_in_text_editor("a_file")
+ end
+ end
+end

0 comments on commit 016fe4f

Please sign in to comment.