capybara-email 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -132,7 +132,7 @@ end
132
132
 
133
133
  [Brian Cardarella](http://twitter.com/bcardarella)
134
134
 
135
- [We are very thankful for the many contributors](https://github.com/dockyard/client_side_validations-simple_form/graphs/contributors)
135
+ [We are very thankful for the many contributors](https://github.com/dockyard/capybara-email/graphs/contributors)
136
136
 
137
137
  ## Versioning ##
138
138
 
@@ -10,7 +10,6 @@ class Capybara::Email::Driver < Capybara::Driver::Base
10
10
  Capybara.current_session.visit([url.path, url.query].compact.join('?'))
11
11
  end
12
12
 
13
-
14
13
  def body
15
14
  dom.to_xml
16
15
  end
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Email
3
- VERSION = '2.0.1'
3
+ VERSION = '2.0.2'
4
4
  end
5
5
  end
@@ -28,9 +28,28 @@ class Capybara::Node::Email < Capybara::Node::Document
28
28
  base.from
29
29
  end
30
30
 
31
- # Will open the email body in your browser
32
- def save_and_open
33
- ::Capybara.save_and_open_page(body)
31
+ # Save a snapshot of the page.
32
+ #
33
+ # @param [String] path The path to where it should be saved [optional]
34
+ #
35
+ def save_page(path = nil)
36
+ path ||= "capybara-email-#{Time.new.strftime("%Y%m%d%H%M%S")}#{rand(10**10)}.html"
37
+ path = File.expand_path(path, Capybara.save_and_open_page_path) if Capybara.save_and_open_page_path
38
+
39
+ FileUtils.mkdir_p(File.dirname(path))
40
+
41
+ File.open(path,'w') { |f| f.write(body) }
42
+ path
34
43
  end
35
44
 
45
+ # Save a snapshot of the page and open it in a browser for inspection
46
+ #
47
+ # @param [String] path The path to where it should be saved [optional]
48
+ #
49
+ def save_and_open(file_name = nil)
50
+ require 'launchy'
51
+ Launchy.open(save_page(file_name))
52
+ rescue LoadError
53
+ warn 'Please install the launchy gem to open page with save_and_open_page'
54
+ end
36
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-email
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-22 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '3.0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '3.0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bourne
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  segments:
140
140
  - 0
141
- hash: -1760701146044086480
141
+ hash: 1988258438555355399
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  none: false
144
144
  requirements:
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: -1760701146044086480
150
+ hash: 1988258438555355399
151
151
  requirements: []
152
152
  rubyforge_project:
153
153
  rubygems_version: 1.8.23