pickle 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -3
- data/History.txt +5 -0
- data/Rakefile +12 -1
- data/VERSION +1 -1
- data/features/email/email.feature +4 -0
- data/lib/pickle/email.rb +8 -1
- data/pickle.gemspec +1 -1
- data/spec/pickle/email_spec.rb +2 -3
- metadata +2 -2
data/.gitignore
CHANGED
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -30,7 +30,7 @@ end
|
|
30
30
|
namespace :rcov do
|
31
31
|
desc "Verify RCov threshold for #{PluginName}"
|
32
32
|
RCov::VerifyTask.new(:verify => :rcov) do |t|
|
33
|
-
t.threshold =
|
33
|
+
t.threshold = 98.67
|
34
34
|
t.index_html = File.join(File.dirname(__FILE__), 'doc/coverage/index.html')
|
35
35
|
end
|
36
36
|
end
|
@@ -81,4 +81,15 @@ begin
|
|
81
81
|
|
82
82
|
rescue LoadError
|
83
83
|
puts "Jeweler not available for gem tasks. Install it with: sudo gem install jeweler"
|
84
|
+
end
|
85
|
+
|
86
|
+
begin
|
87
|
+
require 'yard'
|
88
|
+
|
89
|
+
YARD::Rake::YardocTask.new(:doc) do |t|
|
90
|
+
t.files = ['lib/**/*.rb', 'generators/**/*.rb']
|
91
|
+
end
|
92
|
+
|
93
|
+
rescue LoadError
|
94
|
+
puts "YARD not available for doc tasks. Install it with: sudo gem install yard"
|
84
95
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.8
|
@@ -58,3 +58,7 @@ Feature: I can test emails are sent
|
|
58
58
|
Then 1 email should be delivered to the user
|
59
59
|
And I follow "example page" in the email
|
60
60
|
Then I should be at the user's page
|
61
|
+
|
62
|
+
Scenario: Save and open email
|
63
|
+
Given an email "Gday" with body: "Gday Mate" is delivered to fred@gmail.com
|
64
|
+
Then show me the email
|
data/lib/pickle/email.rb
CHANGED
@@ -30,11 +30,18 @@ module Pickle
|
|
30
30
|
end
|
31
31
|
|
32
32
|
protected
|
33
|
+
def open_in_browser(path) # :nodoc
|
34
|
+
require "launchy"
|
35
|
+
Launchy::Browser.run(path)
|
36
|
+
rescue LoadError
|
37
|
+
warn "Sorry, you need to install launchy to open emails: `gem install launchy`"
|
38
|
+
end
|
39
|
+
|
33
40
|
# Saves the emails out to RAILS_ROOT/tmp/ and opens it in the default
|
34
41
|
# web browser if on OS X. (depends on webrat)
|
35
42
|
def save_and_open_emails
|
36
43
|
emails_to_open = @emails || emails
|
37
|
-
filename = "
|
44
|
+
filename = "pickle-email-#{Time.now.to_i}.html"
|
38
45
|
File.open(filename, "w") do |f|
|
39
46
|
emails_to_open.each_with_index do |e, i|
|
40
47
|
f.write "<h1>Email #{i+1}</h1><pre>#{e}</pre><hr />"
|
data/pickle.gemspec
CHANGED
data/spec/pickle/email_spec.rb
CHANGED
@@ -102,7 +102,6 @@ describe Pickle::Email do
|
|
102
102
|
|
103
103
|
describe "#save_and_open_emails" do
|
104
104
|
before do
|
105
|
-
stub!(:open_in_browser)
|
106
105
|
stub!(:emails).and_return(["Contents of Email 1"])
|
107
106
|
@now = "2008-01-01".to_time
|
108
107
|
Time.stub!(:now).and_return(@now)
|
@@ -124,11 +123,11 @@ describe Pickle::Email do
|
|
124
123
|
|
125
124
|
it "should create a file in Rails/tmp with the emails in it" do
|
126
125
|
save_and_open_emails
|
127
|
-
File.read("
|
126
|
+
File.read("pickle-email-#{@now.to_i}.html").should == "<h1>Email 1</h1><pre>Contents of Email 1</pre><hr />"
|
128
127
|
end
|
129
128
|
|
130
129
|
it "should call open_in_browser on created tmp file" do
|
131
|
-
should_receive(:open_in_browser).with("
|
130
|
+
should_receive(:open_in_browser).with("pickle-email-#{@now.to_i}.html")
|
132
131
|
save_and_open_emails
|
133
132
|
end
|
134
133
|
end
|