cloudtrapper 0.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/CHANGELOG +823 -0
  2. data/Gemfile +12 -0
  3. data/Guardfile +6 -0
  4. data/INSTALL +20 -0
  5. data/MIT-LICENSE +22 -0
  6. data/README.md +465 -0
  7. data/README_FOR_HEROKU_ADDON.md +94 -0
  8. data/Rakefile +223 -0
  9. data/SUPPORTED_RAILS_VERSIONS +23 -0
  10. data/TESTING.md +33 -0
  11. data/cloudtrapper.gemspec +35 -0
  12. data/features/metal.feature +18 -0
  13. data/features/rack.feature +56 -0
  14. data/features/rails.feature +211 -0
  15. data/features/rails_with_js_notifier.feature +97 -0
  16. data/features/rake.feature +27 -0
  17. data/features/sinatra.feature +29 -0
  18. data/features/step_definitions/file_steps.rb +10 -0
  19. data/features/step_definitions/metal_steps.rb +23 -0
  20. data/features/step_definitions/rack_steps.rb +23 -0
  21. data/features/step_definitions/rails_application_steps.rb +433 -0
  22. data/features/step_definitions/rake_steps.rb +17 -0
  23. data/features/support/airbrake_shim.rb.template +11 -0
  24. data/features/support/env.rb +18 -0
  25. data/features/support/matchers.rb +35 -0
  26. data/features/support/rails.rb +201 -0
  27. data/features/support/rake/Rakefile +68 -0
  28. data/features/support/terminal.rb +107 -0
  29. data/features/user_informer.feature +63 -0
  30. data/generators/cloudtrapper/airbrake_generator.rb +94 -0
  31. data/generators/cloudtrapper/lib/insert_commands.rb +34 -0
  32. data/generators/cloudtrapper/lib/rake_commands.rb +24 -0
  33. data/generators/cloudtrapper/templates/capistrano_hook.rb +6 -0
  34. data/generators/cloudtrapper/templates/cloudtrapper_tasks.rake +25 -0
  35. data/generators/cloudtrapper/templates/initializer.rb +6 -0
  36. data/install.rb +1 -0
  37. data/lib/cloudtrapper/backtrace.rb +100 -0
  38. data/lib/cloudtrapper/capistrano.rb +44 -0
  39. data/lib/cloudtrapper/configuration.rb +281 -0
  40. data/lib/cloudtrapper/notice.rb +348 -0
  41. data/lib/cloudtrapper/rack.rb +55 -0
  42. data/lib/cloudtrapper/rails/action_controller_catcher.rb +30 -0
  43. data/lib/cloudtrapper/rails/controller_methods.rb +74 -0
  44. data/lib/cloudtrapper/rails/error_lookup.rb +33 -0
  45. data/lib/cloudtrapper/rails/javascript_notifier.rb +48 -0
  46. data/lib/cloudtrapper/rails/middleware/exceptions_catcher.rb +29 -0
  47. data/lib/cloudtrapper/rails.rb +40 -0
  48. data/lib/cloudtrapper/rails3_tasks.rb +85 -0
  49. data/lib/cloudtrapper/railtie.rb +48 -0
  50. data/lib/cloudtrapper/rake_handler.rb +66 -0
  51. data/lib/cloudtrapper/sender.rb +116 -0
  52. data/lib/cloudtrapper/shared_tasks.rb +36 -0
  53. data/lib/cloudtrapper/tasks.rb +83 -0
  54. data/lib/cloudtrapper/user_informer.rb +27 -0
  55. data/lib/cloudtrapper/version.rb +3 -0
  56. data/lib/cloudtrapper.rb +155 -0
  57. data/lib/cloudtrapper_tasks.rb +65 -0
  58. data/lib/rails/generators/cloudtrapper/cloudtrapper_generator.rb +100 -0
  59. data/lib/templates/javascript_notifier.erb +15 -0
  60. data/lib/templates/rescue.erb +91 -0
  61. data/rails/init.rb +1 -0
  62. data/resources/README.md +34 -0
  63. data/resources/ca-bundle.crt +3376 -0
  64. data/script/integration_test.rb +38 -0
  65. data/test/backtrace_test.rb +162 -0
  66. data/test/capistrano_test.rb +34 -0
  67. data/test/catcher_test.rb +333 -0
  68. data/test/cloudtrapper_2_2.xsd +78 -0
  69. data/test/cloudtrapper_tasks_test.rb +170 -0
  70. data/test/configuration_test.rb +221 -0
  71. data/test/helper.rb +263 -0
  72. data/test/javascript_notifier_test.rb +52 -0
  73. data/test/logger_test.rb +73 -0
  74. data/test/notice_test.rb +468 -0
  75. data/test/notifier_test.rb +246 -0
  76. data/test/rack_test.rb +58 -0
  77. data/test/rails_initializer_test.rb +36 -0
  78. data/test/recursion_test.rb +10 -0
  79. data/test/sender_test.rb +261 -0
  80. data/test/user_informer_test.rb +29 -0
  81. metadata +301 -0
data/Rakefile ADDED
@@ -0,0 +1,223 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rubygems/package_task'
4
+ begin
5
+ require 'cucumber/rake/task'
6
+ rescue LoadError
7
+ $stderr.puts "Please install cucumber: `gem install cucumber`"
8
+ exit 1
9
+ end
10
+ require './lib/cloudtrapper/version'
11
+
12
+ FEATURES = ["sinatra","rack","metal","user_informer"]
13
+
14
+ desc 'Default: run unit tests.'
15
+ task :default => [:test, "cucumber:rails:all"] + FEATURES
16
+
17
+ desc "Clean out the tmp directory"
18
+ task :clean do
19
+ exec "rm -rf tmp"
20
+ end
21
+
22
+ desc 'Test the cloudtrapper gem.'
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.libs << 'lib'
25
+ t.pattern = 'test/**/*_test.rb'
26
+ t.verbose = true
27
+ end
28
+
29
+ namespace :changeling do
30
+ desc "Bumps the version by a minor or patch version, depending on what was passed in."
31
+ task :bump, :part do |t, args|
32
+ # Thanks, Jeweler!
33
+ if Cloudtrapper::VERSION =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/
34
+ major = $1.to_i
35
+ minor = $2.to_i
36
+ patch = $3.to_i
37
+ build = $4
38
+ else
39
+ abort
40
+ end
41
+
42
+ case args[:part]
43
+ when /minor/
44
+ minor += 1
45
+ patch = 0
46
+ when /patch/
47
+ patch += 1
48
+ else
49
+ abort
50
+ end
51
+
52
+ version = [major, minor, patch, build].compact.join('.')
53
+
54
+ File.open(File.join("lib", "cloudtrapper", "version.rb"), "w") do |f|
55
+ f.write <<EOF
56
+ module Cloudtrapper
57
+ VERSION = "#{version}".freeze
58
+ end
59
+ EOF
60
+ end
61
+ end
62
+
63
+ desc "Writes out the new CHANGELOG and prepares the release"
64
+ task :change do
65
+ load 'lib/cloudtrapper/version.rb'
66
+ file = "CHANGELOG"
67
+ old = File.read(file)
68
+ version = Cloudtrapper::VERSION
69
+ message = "Bumping to version #{version}"
70
+ editor = ENV["EDITOR"] || "vim" # prefer vim if no env variable for editor is set
71
+
72
+ File.open(file, "w") do |f|
73
+ f.write <<EOF
74
+ Version #{version} - #{Time.now}
75
+ ===============================================================================
76
+
77
+ #{`git log $(git tag | grep -v rc | tail -1)..HEAD | git shortlog`}
78
+ #{old}
79
+ EOF
80
+ end
81
+
82
+ exec ["#{editor} #{file}",
83
+ "git commit -aqm '#{message}'",
84
+ "git tag -a -m '#{message}' v#{version}",
85
+ "echo '\n\n\033[32mMarked v#{version} /' `git show-ref -s refs/heads/master` 'for release. Run: rake changeling:push\033[0m\n\n'"].join(' && ')
86
+ end
87
+
88
+ desc "Bump by a minor version (1.2.3 => 1.3.0)"
89
+ task :minor do |t|
90
+ Rake::Task['changeling:bump'].invoke(t.name)
91
+ Rake::Task['changeling:change'].invoke
92
+ end
93
+
94
+ desc "Bump by a patch version, (1.2.3 => 1.2.4)"
95
+ task :patch do |t|
96
+ Rake::Task['changeling:bump'].invoke(t.name)
97
+ Rake::Task['changeling:change'].invoke
98
+ end
99
+
100
+ desc "Push the latest version and tags"
101
+ task :push do |t|
102
+ system("git push origin master")
103
+ system("git push origin $(git tag | grep -v rc | tail -1)")
104
+ end
105
+ end
106
+
107
+ begin
108
+ require 'yard'
109
+ YARD::Rake::YardocTask.new do |t|
110
+ t.files = ['lib/**/*.rb', 'TESTING.rdoc']
111
+ end
112
+ rescue LoadError
113
+ end
114
+
115
+ GEM_ROOT = File.dirname(__FILE__).freeze
116
+
117
+ desc "Clean files generated by rake tasks"
118
+ task :clobber => [:clobber_rdoc, :clobber_package]
119
+
120
+ LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
121
+ RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
122
+ LOCAL_GEMS =
123
+ [
124
+ ["rack","1.3.2"],
125
+ ] +
126
+ RAILS_VERSIONS.collect { |version| ['rails', version] } +
127
+ [
128
+ ['sham_rack', nil],
129
+ ['capistrano', nil],
130
+ ['sqlite3-ruby', nil],
131
+ ["therubyracer",nil],
132
+ ["sinatra",nil]
133
+ ]
134
+
135
+
136
+ desc "Vendor test gems: Run this once to prepare your test environment"
137
+ task :vendor_test_gems do
138
+ old_gem_path = ENV['GEM_PATH']
139
+ old_gem_home = ENV['GEM_HOME']
140
+ ENV['GEM_PATH'] = LOCAL_GEM_ROOT
141
+ ENV['GEM_HOME'] = LOCAL_GEM_ROOT
142
+
143
+ LOCAL_GEMS.each do |gem_name, version|
144
+ gem_file_pattern = [gem_name, version || '*'].compact.join('-')
145
+ version_option = version ? "-v #{version}" : ''
146
+ pattern = File.join(LOCAL_GEM_ROOT, 'gems', "#{gem_file_pattern}")
147
+ existing = Dir.glob(pattern).first
148
+ if existing
149
+ puts "\nskipping #{gem_name} since it's already vendored," +
150
+ "remove it from the tmp directory first."
151
+ next
152
+ end
153
+
154
+ command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc --backtrace #{version_option} #{gem_name}"
155
+ puts "Vendoring #{gem_file_pattern}..."
156
+ unless system("#{command} 2>&1")
157
+ puts "Command failed: #{command}"
158
+ exit(1)
159
+ end
160
+ end
161
+
162
+ ENV['GEM_PATH'] = old_gem_path
163
+ ENV['GEM_HOME'] = old_gem_home
164
+ end
165
+
166
+ Cucumber::Rake::Task.new(:cucumber) do |t|
167
+ t.fork = true
168
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
169
+ end
170
+
171
+ task :cucumber => [:vendor_test_gems]
172
+
173
+
174
+ def run_rails_cucumber_task(version, additional_cucumber_args)
175
+ puts "Testing Rails #{version}"
176
+ if version.empty?
177
+ raise "No Rails version specified - make sure ENV['RAILS_VERSION'] is set, e.g. with `rake cucumber:rails:all`"
178
+ end
179
+ ENV['RAILS_VERSION'] = version
180
+ cmd = "cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} #{additional_cucumber_args} features/rails.feature features/rails_with_js_notifier.feature"
181
+ puts "Running command: #{cmd}"
182
+ system(cmd)
183
+ end
184
+
185
+ def define_rails_cucumber_tasks(additional_cucumber_args = '')
186
+ namespace :rails do
187
+ RAILS_VERSIONS.each do |version|
188
+ desc "Test integration of the gem with Rails #{version}"
189
+ task version => [:vendor_test_gems] do
190
+ exit 1 unless run_rails_cucumber_task(version, additional_cucumber_args)
191
+ end
192
+ end
193
+
194
+ desc "Test integration of the gem with all Rails versions"
195
+ task :all do
196
+ results = RAILS_VERSIONS.map do |version|
197
+ run_rails_cucumber_task(version, additional_cucumber_args)
198
+ end
199
+
200
+ exit 1 unless results.all?
201
+ end
202
+ end
203
+ end
204
+
205
+ namespace :cucumber do
206
+ namespace :wip do
207
+ define_rails_cucumber_tasks('--tags @wip')
208
+ end
209
+
210
+ define_rails_cucumber_tasks
211
+
212
+ rule /#{"(" + FEATURES.join("|") + ")"}/ do |t|
213
+ framework = t.name
214
+ desc "Test integration of the gem with #{framework}"
215
+ task framework.to_sym do
216
+ puts "Testing #{framework.split(":").last}..."
217
+ cmd = "cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features/#{framework.split(":").last}.feature"
218
+ puts "Running command: #{cmd}"
219
+ system(cmd)
220
+ end
221
+ end
222
+
223
+ end
@@ -0,0 +1,23 @@
1
+ 2.3.14
2
+ 3.0.0
3
+ 3.0.1
4
+ 3.0.2
5
+ 3.0.3
6
+ 3.0.4
7
+ 3.0.5
8
+ 3.0.6
9
+ 3.0.7
10
+ 3.0.8
11
+ 3.0.9
12
+ 3.0.10
13
+ 3.0.11
14
+ 3.0.12
15
+ 3.1.0
16
+ 3.1.1
17
+ 3.1.2
18
+ 3.1.3
19
+ 3.1.4
20
+ 3.2.0
21
+ 3.2.1
22
+ 3.2.2
23
+ 3.2.3
data/TESTING.md ADDED
@@ -0,0 +1,33 @@
1
+ Running the suite
2
+ =================
3
+
4
+ Since the notifier must run on many versions of Rails, running its test suite is slightly different than you may be used to.
5
+
6
+ You should start by trusting the .rvmrc file. We come in peace.
7
+
8
+ Then execute the following command:
9
+
10
+ rake vendor_test_gems
11
+ # NOT: bundle exec rake vendor_test_gems
12
+
13
+ This command will download the various versions of Rails and other gems that the notifier must be tested against.
14
+
15
+ Then, to start the suite, run
16
+
17
+ rake
18
+ # NOT: bundle exec rake
19
+
20
+ Finally, this test suite runs against many rails versions. If you
21
+ prefer to run it against specific version hit
22
+
23
+ rake cucumber:rails:<VERSION>
24
+
25
+
26
+ For Maintainers
27
+ ================
28
+
29
+ When developing the Cloudtrapper gem, be sure to use the integration test against an existing project on staging before pushing to master.
30
+
31
+ ./script/integration_test.rb <test project's api key> <staging server hostname>
32
+
33
+ ./script/integration_test.rb <test project's api key> <staging server hostname> secure
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "cloudtrapper/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{cloudtrapper}
7
+ s.version = Cloudtrapper::VERSION.dup
8
+ s.summary = %q{Just testing gem}
9
+
10
+ s.require_paths = ["lib"]
11
+ s.files = Dir["{generators/**/*,lib/**/*,rails/**/*,resources/*,script/*}"] +
12
+ %w(cloudtrapper.gemspec CHANGELOG Gemfile Guardfile INSTALL MIT-LICENSE Rakefile README_FOR_HEROKU_ADDON.md README.md TESTING.md SUPPORTED_RAILS_VERSIONS install.rb)
13
+ s.test_files = Dir.glob("{test,spec,features}/**/*")
14
+
15
+ s.add_runtime_dependency("builder")
16
+ s.add_runtime_dependency("activesupport")
17
+
18
+ s.add_development_dependency("actionpack", "~> 2.3.8")
19
+ s.add_development_dependency("activerecord", "~> 2.3.8")
20
+ s.add_development_dependency("activesupport", "~> 2.3.8")
21
+ s.add_development_dependency("bourne", ">= 1.0")
22
+ s.add_development_dependency("cucumber", "~> 0.10.6")
23
+ s.add_development_dependency("fakeweb", "~> 1.3.0")
24
+ s.add_development_dependency("nokogiri", "~> 1.4.3.1")
25
+ s.add_development_dependency("rspec", "~> 2.6.0")
26
+ s.add_development_dependency("sham_rack", "~> 1.3.0")
27
+ s.add_development_dependency("shoulda", "~> 2.11.3")
28
+ s.add_development_dependency("capistrano", "~> 2.8.0")
29
+
30
+ s.authors = ["Cloudtrapper"]
31
+ s.email = %q{noma4i@gmail.com}
32
+ s.homepage = "http://www.noma4i.com"
33
+
34
+ s.platform = Gem::Platform::RUBY
35
+ end
@@ -0,0 +1,18 @@
1
+ Feature: Rescue errors in Rails middleware
2
+
3
+ Background:
4
+ Given I have built and installed the "cloudtrapper" gem
5
+ And I generate a new Rails application
6
+ And I configure the Cloudtrapper shim
7
+ And I configure my application to require the "cloudtrapper" gem
8
+ And I run the cloudtrapper generator with "-k myapikey"
9
+
10
+ Scenario: Rescue an exception in the dispatcher
11
+ When I define a Metal endpoint called "Exploder":
12
+ """
13
+ def self.call(env)
14
+ raise "Explode"
15
+ end
16
+ """
17
+ When I perform a request to "http://example.com:123/metal/index?param=value"
18
+ Then I should receive a Cloudtrapper notification
@@ -0,0 +1,56 @@
1
+ Feature: Use the notifier in a plain Rack app
2
+
3
+ Background:
4
+ Given I have built and installed the "cloudtrapper" gem
5
+
6
+ Scenario: Rescue and exception in a Rack app
7
+ Given the following Rack app:
8
+ """
9
+ require 'rack'
10
+ require 'cloudtrapper'
11
+
12
+ Cloudtrapper.configure do |config|
13
+ config.api_key = 'my_api_key'
14
+ end
15
+
16
+ app = Rack::Builder.app do
17
+ use Cloudtrapper::Rack
18
+ run lambda { |env| raise "Rack down" }
19
+ end
20
+ """
21
+ When I perform a Rack request to "http://example.com:123/test/index?param=value"
22
+ Then I should receive a Cloudtrapper notification
23
+
24
+ Scenario: Ignore user agents
25
+ Given the following Rack app:
26
+ """
27
+ require 'rack'
28
+ require 'cloudtrapper'
29
+
30
+ Cloudtrapper.configure do |config|
31
+ config.api_key = 'my_api_key'
32
+ config.ignore_user_agent << /ignore/
33
+ end
34
+
35
+ class Mock
36
+ class AppendUserAgent
37
+ def initialize(app)
38
+ @app = app
39
+ end
40
+
41
+ def call(env)
42
+ env["HTTP_USER_AGENT"] = "ignore"
43
+ @app.call(env)
44
+ end
45
+ end
46
+ end
47
+
48
+ app = Rack::Builder.app do
49
+ use Cloudtrapper::Rack
50
+ use Mock::AppendUserAgent
51
+ run lambda { |env| raise "Rack down" }
52
+ end
53
+ """
54
+ When I perform a Rack request to "http://example.com:123/test/index?param=value"
55
+ Then I should not see "** [Cloudtrapper] Response from Cloudtrapper:"
56
+
@@ -0,0 +1,211 @@
1
+ Feature: Install the Gem in a Rails application
2
+
3
+ Background:
4
+ Given I have built and installed the "cloudtrapper" gem
5
+ And I generate a new Rails application
6
+
7
+ Scenario: Use the gem without vendoring the gem in a Rails application
8
+ When I configure the Cloudtrapper shim
9
+ And I configure my application to require the "cloudtrapper" gem
10
+ And I run the cloudtrapper generator with "-k myapikey"
11
+ Then the command should have run successfully
12
+ And I should receive a Cloudtrapper notification
13
+ And I should see the Rails version
14
+
15
+ Scenario: vendor the gem and uninstall
16
+ When I configure the Cloudtrapper shim
17
+ And I configure my application to require the "cloudtrapper" gem
18
+ And I unpack the "cloudtrapper" gem
19
+ And I run the cloudtrapper generator with "-k myapikey"
20
+ Then the command should have run successfully
21
+ When I uninstall the "cloudtrapper" gem
22
+ And I install cached gems
23
+ And I run "rake cloudtrapper:test"
24
+ Then I should see "** [Cloudtrapper] Response from Cloudtrapper:"
25
+ And I should receive two Cloudtrapper notifications
26
+
27
+ Scenario: Configure the notifier by hand
28
+ When I configure the Cloudtrapper shim
29
+ And I configure the notifier to use "myapikey" as an API key
30
+ And I configure my application to require the "cloudtrapper" gem
31
+ And I run the cloudtrapper generator with ""
32
+ Then I should receive a Cloudtrapper notification
33
+
34
+ Scenario: Configuration within initializer isn't overridden by Railtie
35
+ When I configure the Cloudtrapper shim
36
+ And I configure usage of Cloudtrapper
37
+ Then the command should have run successfully
38
+ When I configure the notifier to use the following configuration lines:
39
+ """
40
+ config.api_key = "myapikey"
41
+ config.project_root = "argle/bargle"
42
+ """
43
+ And I define a response for "TestController#index":
44
+ """
45
+ session[:value] = "test"
46
+ raise RuntimeError, "some message"
47
+ """
48
+ And I route "/test/index" to "test#index"
49
+ And I perform a request to "http://example.com:123/test/index?param=value"
50
+ Then I should receive a Cloudtrapper notification
51
+
52
+ Scenario: Try to install without an api key
53
+ When I configure my application to require the "cloudtrapper" gem
54
+ And I run the cloudtrapper generator with ""
55
+ Then I should see "Must pass --api-key or --heroku or create config/initializers/cloudtrapper.rb"
56
+
57
+ Scenario: Configure and deploy using only installed gem
58
+ When I run "capify ."
59
+ And I configure the Cloudtrapper shim
60
+ And I configure my application to require the "cloudtrapper" gem
61
+ And I run the cloudtrapper generator with "-k myapikey"
62
+ And I configure my application to require the "capistrano" gem if necessary
63
+ And I run "cap -T"
64
+ Then I should see "cloudtrapper:deploy"
65
+
66
+ Scenario: Configure and deploy using only vendored gem
67
+ When I run "capify ."
68
+ And I configure the Cloudtrapper shim
69
+ And I configure my application to require the "cloudtrapper" gem
70
+ And I unpack the "cloudtrapper" gem
71
+ And I run the cloudtrapper generator with "-k myapikey"
72
+ And I uninstall the "cloudtrapper" gem
73
+ And I install cached gems
74
+ And I configure my application to require the "capistrano" gem if necessary
75
+ And I run "cap -T"
76
+ Then I should see "cloudtrapper:deploy"
77
+
78
+ Scenario: Try to install when the cloudtrapper plugin still exists
79
+ When I install the "cloudtrapper" plugin
80
+ And I configure the Cloudtrapper shim
81
+ And I configure the notifier to use "myapikey" as an API key
82
+ And I configure my application to require the "cloudtrapper" gem
83
+ And I run the cloudtrapper generator with ""
84
+ Then I should see "You must first remove the cloudtrapper plugin. Please run: script/plugin remove cloudtrapper"
85
+
86
+ Scenario: Rescue an exception in a controller
87
+ When I configure the Cloudtrapper shim
88
+ And I configure usage of Cloudtrapper
89
+ And I define a response for "TestController#index":
90
+ """
91
+ session[:value] = "test"
92
+ raise RuntimeError, "some message"
93
+ """
94
+ And I route "/test/index" to "test#index"
95
+ And I perform a request to "http://example.com:123/test/index?param=value"
96
+ Then I should receive a Cloudtrapper notification
97
+
98
+ Scenario: The gem should not be considered a framework gem
99
+ When I configure the Cloudtrapper shim
100
+ And I configure my application to require the "cloudtrapper" gem
101
+ And I run the cloudtrapper generator with "-k myapikey"
102
+ And I run "rake gems"
103
+ Then I should see that "cloudtrapper" is not considered a framework gem
104
+
105
+ Scenario: The app uses Vlad instead of Capistrano
106
+ When I configure the Cloudtrapper shim
107
+ And I configure my application to require the "cloudtrapper" gem
108
+ And I run "touch config/deploy.rb"
109
+ And I run "rm Capfile"
110
+ And I run the cloudtrapper generator with "-k myapikey"
111
+ Then "config/deploy.rb" should not contain "capistrano"
112
+
113
+ Scenario: Support the Heroku addon in the generator
114
+ When I configure the Cloudtrapper shim
115
+ And I configure the Heroku rake shim
116
+ And I configure the Heroku gem shim with "myapikey"
117
+ And I configure my application to require the "cloudtrapper" gem
118
+ And I run the cloudtrapper generator with "--heroku"
119
+ Then the command should have run successfully
120
+ And I should receive a Cloudtrapper notification
121
+ And I should see the Rails version
122
+ And my Cloudtrapper configuration should contain the following line:
123
+ """
124
+ config.api_key = ENV['HOPTOAD_API_KEY']
125
+ """
126
+
127
+ Scenario: Support the --app option for the Heroku addon in the generator
128
+ When I configure the Cloudtrapper shim
129
+ And I configure the Heroku rake shim
130
+ And I configure the Heroku gem shim with "myapikey" and multiple app support
131
+ And I configure my application to require the "cloudtrapper" gem
132
+ And I run the cloudtrapper generator with "--heroku -a myapp"
133
+ Then the command should have run successfully
134
+ And I should receive a Cloudtrapper notification
135
+ And I should see the Rails version
136
+ And my Cloudtrapper configuration should contain the following line:
137
+ """
138
+ config.api_key = ENV['HOPTOAD_API_KEY']
139
+ """
140
+
141
+ Scenario: Filtering parameters in a controller
142
+ When I configure the Cloudtrapper shim
143
+ And I configure usage of Cloudtrapper
144
+ When I configure the notifier to use the following configuration lines:
145
+ """
146
+ config.api_key = "myapikey"
147
+ config.params_filters << "credit_card_number"
148
+ """
149
+ And I define a response for "TestController#index":
150
+ """
151
+ params[:credit_card_number] = "red23"
152
+ raise RuntimeError, "some message"
153
+ """
154
+ And I route "/test/index" to "test#index"
155
+ And I perform a request to "http://example.com:123/test/index?param=value"
156
+ Then I should receive a Cloudtrapper notification
157
+
158
+ Scenario: Filtering session in a controller
159
+ When I configure the Cloudtrapper shim
160
+ And I configure usage of Cloudtrapper
161
+ When I configure the notifier to use the following configuration lines:
162
+ """
163
+ config.api_key = "myapikey"
164
+ config.params_filters << "secret"
165
+ """
166
+ And I define a response for "TestController#index":
167
+ """
168
+ session["secret"] = "blue42"
169
+ raise RuntimeError, "some message"
170
+ """
171
+ And I route "/test/index" to "test#index"
172
+ And I perform a request to "http://example.com:123/test/index?param=value"
173
+ Then I should receive a Cloudtrapper notification
174
+
175
+ Scenario: Filtering session and params based on Rails parameter filters
176
+ When I configure the Cloudtrapper shim
177
+ And I configure usage of Cloudtrapper
178
+ And I configure the application to filter parameter "secret"
179
+ And I define a response for "TestController#index":
180
+ """
181
+ params["secret"] = "red23"
182
+ session["secret"] = "blue42"
183
+ raise RuntimeError, "some message"
184
+ """
185
+ And I route "/test/index" to "test#index"
186
+ And I perform a request to "http://example.com:123/test/index?param=value"
187
+ Then I should receive a Cloudtrapper notification
188
+
189
+ Scenario: Notify cloudtrapper within the controller
190
+ When I configure the Cloudtrapper shim
191
+ And I configure usage of Cloudtrapper
192
+ And I define a response for "TestController#index":
193
+ """
194
+ session[:value] = "test"
195
+ notify_cloudtrapper(RuntimeError.new("some message"))
196
+ render :nothing => true
197
+ """
198
+ And I route "/test/index" to "test#index"
199
+ And I perform a request to "http://example.com:123/test/index?param=value"
200
+ Then I should receive a Cloudtrapper notification
201
+
202
+ Scenario: Reporting 404s
203
+ When I configure the Cloudtrapper shim
204
+ And I configure usage of Cloudtrapper
205
+ And I configure the notifier to use the following configuration lines:
206
+ """
207
+ config.ignore_only = []
208
+ """
209
+ And I perform a request to "http://example.com:123/this/route/does/not/exist"
210
+ Then I should see "The page you were looking for doesn't exist."
211
+ And I should receive a Cloudtrapper notification