oop_rails_server 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/oop_rails_server/helpers.rb +60 -9
- data/lib/oop_rails_server/rails_server.rb +1 -1
- data/lib/oop_rails_server/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44eb1325d0019e89344b163584820b439319eb83
|
4
|
+
data.tar.gz: 70b0e6e9382f2012f912a810731276654b57c3f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edd31796cdb8b5a1d31a1b377b8e5bc8567593791ea2bc69b554c69415d82376a3c3b3724812f9f3c07c4741ac0efbc50f1f4a9fa55c5f0ae57ac08d2a0e8215
|
7
|
+
data.tar.gz: 8f6457793ed0b1838c79e19266f3424cd93e724327a1f575860a2320cb5c728262b8fd46abe1e2f3d623d38646477bda15ed983166f5138a6a16c8f16cab1bc7
|
@@ -23,7 +23,7 @@ module OopRailsServer
|
|
23
23
|
|
24
24
|
def get_success(subpath, options = { })
|
25
25
|
data = get(subpath, options)
|
26
|
-
data.
|
26
|
+
expect(data).to match(/oop_rails_server_base_template/i) unless options[:no_layout]
|
27
27
|
data
|
28
28
|
end
|
29
29
|
|
@@ -33,7 +33,7 @@ module OopRailsServer
|
|
33
33
|
|
34
34
|
data = get_success(subpath, options)
|
35
35
|
regexes.each do |regex|
|
36
|
-
data.
|
36
|
+
expect(data).to match(regex)
|
37
37
|
end
|
38
38
|
|
39
39
|
data
|
@@ -55,9 +55,9 @@ module OopRailsServer
|
|
55
55
|
#{data.inspect}}
|
56
56
|
end
|
57
57
|
|
58
|
-
json['exception'].
|
59
|
-
json['exception']['class'].
|
60
|
-
json['exception']['message'].
|
58
|
+
expect(json['exception']).to be
|
59
|
+
expect(json['exception']['class']).to eq(class_name.to_s)
|
60
|
+
expect(json['exception']['message']).to match(message)
|
61
61
|
end
|
62
62
|
|
63
63
|
def rails_template_name
|
@@ -78,19 +78,70 @@ it should return the fully-qualified path to the root of your project (gem, appl
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def rails_server_additional_gemfile_lines
|
81
|
-
[
|
82
|
-
"gem 'fortitude', :path => '#{rails_server_project_root}'"
|
83
|
-
]
|
81
|
+
[ ]
|
84
82
|
end
|
85
83
|
|
86
84
|
def rails_server_default_version
|
87
|
-
|
85
|
+
nil
|
88
86
|
end
|
89
87
|
|
90
88
|
def rails_servers
|
91
89
|
@rails_servers ||= { }
|
92
90
|
end
|
93
91
|
|
92
|
+
def mail_sent_to(destination_address, the_rails_server = nil)
|
93
|
+
the_rails_server ||= rails_server
|
94
|
+
|
95
|
+
mail_file = File.join(mail_directory_for_rails_server(the_rails_server), destination_address)
|
96
|
+
|
97
|
+
if File.exist?(mail_file)
|
98
|
+
contents = File.read(mail_file).split(/\n/)
|
99
|
+
headers = { }
|
100
|
+
last_header = nil
|
101
|
+
body = ""
|
102
|
+
have_started_body = false
|
103
|
+
|
104
|
+
contents.each do |line|
|
105
|
+
if have_started_body
|
106
|
+
body << "#{line.chomp}\n"
|
107
|
+
elsif line.strip.length == 0
|
108
|
+
have_started_body = true
|
109
|
+
elsif line =~ /^(\S+):\s+(.*?)\s*$/i
|
110
|
+
last_header = $1
|
111
|
+
headers[last_header] = $2
|
112
|
+
elsif line =~ /^\s+(.*?)\s*$/i && last_header
|
113
|
+
headers[last_header] << " #{$1}"
|
114
|
+
else
|
115
|
+
raise "Unexpected line in #{mail_file.inspect}:\n#{line}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
{ :headers => headers, :body => body }
|
120
|
+
else
|
121
|
+
if File.exist?(mail_directory_for_rails_server(the_rails_server))
|
122
|
+
$stderr.puts "WARNING: No mails for #{destination_address.inspect}: #{Dir.entries(mail_directory_for_rails_server(the_rails_server))}"
|
123
|
+
else
|
124
|
+
$stderr.puts "WARNING: No mails: no dir: #{mail_directory_for_rails_server(the_rails_server)}"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def clear_mails!(the_rails_server = nil)
|
130
|
+
the_rails_server ||= rails_server
|
131
|
+
|
132
|
+
mail_directory = mail_directory_for_rails_server(the_rails_server)
|
133
|
+
entries = Dir.entries(mail_directory).select do |entry|
|
134
|
+
entry !~ /^\./ && entry =~ /^\S.*@/
|
135
|
+
end
|
136
|
+
|
137
|
+
entries.each { |e| File.delete(File.join(mail_directory, e)) }
|
138
|
+
end
|
139
|
+
|
140
|
+
def mail_directory_for_rails_server(the_rails_server = nil)
|
141
|
+
the_rails_server ||= rails_server
|
142
|
+
File.join(the_rails_server.rails_root, 'tmp', 'mails')
|
143
|
+
end
|
144
|
+
|
94
145
|
def rails_server
|
95
146
|
if rails_servers.size == 1
|
96
147
|
rails_servers[rails_servers.keys.first]
|
@@ -27,7 +27,7 @@ module OopRailsServer
|
|
27
27
|
@additional_gemfile_lines = Array(options[:additional_gemfile_lines] || [ ])
|
28
28
|
|
29
29
|
|
30
|
-
@rails_root = File.join(@runtime_base_directory, rails_version.to_s, name.to_s)
|
30
|
+
@rails_root = File.expand_path(File.join(@runtime_base_directory, rails_version.to_s, name.to_s))
|
31
31
|
@port = 20_000 + rand(10_000)
|
32
32
|
@server_pid = nil
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oop_rails_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Geweke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|