lilypad 0.2.1 → 0.2.2

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.
@@ -5,7 +5,7 @@ describe Rack::Lilypad do
5
5
  include Rack::Test::Methods
6
6
 
7
7
  before(:each) do
8
- ENV['RACK_ENV'] = 'production'
8
+ ENV['RAILS_ENV'] = ENV['RACK_ENV'] = 'production'
9
9
  @app = lambda { |env| raise TestError, 'Test' }
10
10
  @env = Rack::MockRequest.env_for("/pulse")
11
11
  @http = mock(:http)
@@ -52,16 +52,17 @@ describe Rack::Lilypad do
52
52
 
53
53
  notifier = Rack::Lilypad.new(@app, '')
54
54
  notifier.call(@env) rescue nil
55
-
56
- # Validate XML
57
- xsd = Nokogiri::XML::Schema(File.read(SPEC + '/fixtures/hoptoad_2_0.xsd'))
58
- doc = Nokogiri::XML(Rack::Lilypad::Hoptoad.last_request)
59
-
60
- errors = xsd.validate(doc)
61
- errors.each do |error|
62
- puts error.message
55
+ validate_xml
56
+ end
57
+
58
+ it "should allow direct access to the post method" do
59
+ @http.should_receive(:post)
60
+ begin
61
+ raise TestError, 'Test'
62
+ rescue Exception => e
63
+ Rack::Lilypad.notify(e)
63
64
  end
64
- errors.length.should == 0
65
+ validate_xml
65
66
  end
66
67
 
67
68
  describe 'Rails' do
@@ -74,10 +75,6 @@ describe Rack::Lilypad do
74
75
  @http.should_receive(:post)
75
76
  get "/pulse" rescue nil
76
77
  end
77
-
78
- it "should re-raise the exception" do
79
- lambda { get "/pulse" }.should raise_error(TestError)
80
- end
81
78
 
82
79
  it "should not do anything if non-production environment" do
83
80
  ENV['RACK_ENV'] = 'development'
data/spec/spec_helper.rb CHANGED
@@ -23,5 +23,16 @@ def debug(object)
23
23
  puts "</pre>"
24
24
  end
25
25
 
26
+ def validate_xml
27
+ xsd = Nokogiri::XML::Schema(File.read(SPEC + '/fixtures/hoptoad_2_0.xsd'))
28
+ doc = Nokogiri::XML(Rack::Lilypad::Hoptoad.last_request)
29
+
30
+ errors = xsd.validate(doc)
31
+ errors.each do |error|
32
+ puts error.message
33
+ end
34
+ errors.length.should == 0
35
+ end
36
+
26
37
  class TestError < RuntimeError
27
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lilypad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-02 00:00:00 -08:00
12
+ date: 2009-12-03 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency