toadhopper-sinatra 0.10.1 → 1.0.0

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.
Files changed (3) hide show
  1. data/lib/sinatra/toadhopper.rb +2 -2
  2. data/test_example.rb +38 -49
  3. metadata +3 -3
@@ -4,7 +4,7 @@ require 'toadhopper'
4
4
  module Sinatra
5
5
  # The Toadhopper helper methods
6
6
  module ToadHopper
7
- VERSION = "0.10.1"
7
+ VERSION = "1.0.0"
8
8
  # Reports the current sinatra error to Hoptoad
9
9
  def post_error_to_hoptoad!
10
10
  unless options.toadhopper && options.toadhopper[:api_key]
@@ -17,7 +17,7 @@ module Sinatra
17
17
  env['sinatra.error'],
18
18
  {
19
19
  :url => request.url,
20
- :request => request,
20
+ :params => request.params,
21
21
  :session => session.to_hash,
22
22
  :environment => ENV.to_hash,
23
23
  :framework_env => options.environment.to_s,
data/test_example.rb CHANGED
@@ -1,12 +1,3 @@
1
- require 'test/unit'
2
-
3
- require 'rr'
4
- class Test::Unit::TestCase
5
- include RR::Adapters::TestUnit
6
- end
7
-
8
- require 'rack/test'
9
-
10
1
  toadhopper_dir = "#{File.dirname(__FILE__)}/../toadhopper"
11
2
  raise "#{toadhopper_dir} does not exist" unless File.directory?(toadhopper_dir)
12
3
  $:.unshift "#{toadhopper_dir}/lib"
@@ -14,54 +5,52 @@ $:.unshift "#{toadhopper_dir}/lib"
14
5
  $:.unshift "#{File.dirname(__FILE__)}/lib"
15
6
 
16
7
  require "#{File.dirname(__FILE__)}/example"
17
-
18
8
  Sinatra::Application.set :environment, :production
19
9
 
20
- class Sinatra::ToadHopper::TestExample < Test::Unit::TestCase
21
-
22
- include Rack::Test::Methods
23
-
24
- def app; Sinatra::Application end
10
+ require 'exemplor'
25
11
 
26
- def setup
27
- app.set :environment, :production
28
-
29
- @toadhopper = ::ToadHopper.new("")
30
- stub(::ToadHopper).new do |api_key|
31
- @api_key = api_key
32
- @toadhopper
33
- end
34
- stub(@toadhopper).post! do |*args|
35
- @error, @options, @header = *args
36
- end
37
-
38
- post "/register", :name => "Billy", :password => "Bob"
39
- end
12
+ require 'rack/test'
13
+ require 'rr'
40
14
 
41
- def test_api_key_set
42
- assert_equal "apikey", @api_key
43
- end
44
- def test_filter_set
45
- assert_equal [/password/], @toadhopper.filters
46
- end
47
- def test_reported_error
48
- assert_equal RuntimeError, @error.class
49
- assert_equal "Kaboom!", @error.message
15
+ eg.helpers do
16
+ include Rack::Test::Methods
17
+ include RR::Adapters::RRMethods
18
+ def app
19
+ Sinatra::Application
50
20
  end
21
+ end
51
22
 
52
- def test_options
53
- assert_equal ENV.to_hash, @options[:environment]
54
- assert_equal "http://example.org/register", @options[:url]
55
- assert @options[:request]
56
- assert @options[:request].respond_to?(:params)
57
- assert @options[:framework_env] = "production"
58
- assert @options[:project_root] = app.root
59
- assert @options[:session] = {:user_id => 42}
60
- assert @options[:notifier_name] = "toadhopper-sinatra"
23
+ eg.setup do
24
+ RR.reset
25
+
26
+ @toadhopper = ::ToadHopper.new("")
27
+ stub(::ToadHopper).new do |api_key|
28
+ @api_key = api_key
29
+ @toadhopper
61
30
  end
62
31
 
63
- def test_header_options
64
- assert_equal "toadhopper-sinatra", @header['X-Hoptoad-Client-Name']
32
+ stub(@toadhopper).post! do |*args|
33
+ @error, @options, @header = *args
65
34
  end
35
+ end
36
+
37
+ eg "Posting" do
38
+ post "/register", :name => "Billy", :password => "Bob"
66
39
 
40
+ Check(@api_key).is("apikey")
41
+
42
+ Check(@toadhopper.filters).is([/password/])
43
+
44
+ Check(@error.class).is(RuntimeError)
45
+ Check(@error.message).is("Kaboom!")
46
+
47
+ Check(@options[:environment]).is(ENV.to_hash)
48
+ Check(@options[:url]).is("http://example.org/register")
49
+ Check(@options[:params]).is({"name"=>"Billy", "password"=>"Bob"})
50
+ Check(@options[:framework_env]).is("production")
51
+ Check(@options[:project_root]).is(app.root)
52
+ Check(@options[:session]).is({:user_id => 42})
53
+ Check(@options[:notifier_name]).is("toadhopper-sinatra")
54
+
55
+ Check(@header['X-Hoptoad-Client-Name']).is("toadhopper-sinatra")
67
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toadhopper-sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Lucas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-21 00:00:00 +11:00
12
+ date: 2010-02-23 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.4
23
+ version: 0.9.8
24
24
  version:
25
25
  description: Post Hoptoad notifications from Sinatra
26
26
  email: t.lucas@toolmantim.com