airbrake 3.0.9 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/CHANGELOG +162 -0
  2. data/Gemfile +1 -0
  3. data/INSTALL +0 -5
  4. data/README.md +60 -35
  5. data/README_FOR_HEROKU_ADDON.md +30 -29
  6. data/Rakefile +47 -15
  7. data/SUPPORTED_RAILS_VERSIONS +11 -0
  8. data/TESTING.md +6 -4
  9. data/airbrake.gemspec +5 -4
  10. data/features/metal.feature +2 -7
  11. data/features/rack.feature +1 -5
  12. data/features/rails.feature +9 -41
  13. data/features/rails_with_js_notifier.feature +20 -1
  14. data/features/rake.feature +2 -2
  15. data/features/sinatra.feature +1 -5
  16. data/features/step_definitions/rack_steps.rb +3 -0
  17. data/features/step_definitions/rails_application_steps.rb +39 -15
  18. data/features/support/airbrake_shim.rb.template +4 -8
  19. data/features/support/rails.rb +20 -3
  20. data/features/user_informer.feature +3 -3
  21. data/generators/airbrake/airbrake_generator.rb +6 -2
  22. data/generators/airbrake/templates/airbrake_tasks.rake +1 -1
  23. data/lib/airbrake.rb +2 -3
  24. data/lib/airbrake/capistrano.rb +3 -2
  25. data/lib/airbrake/configuration.rb +26 -8
  26. data/lib/airbrake/notice.rb +2 -2
  27. data/lib/airbrake/rack.rb +4 -1
  28. data/lib/airbrake/rails.rb +4 -5
  29. data/lib/airbrake/rails/controller_methods.rb +19 -13
  30. data/lib/airbrake/rails/javascript_notifier.rb +1 -1
  31. data/lib/airbrake/rails/middleware/exceptions_catcher.rb +27 -0
  32. data/lib/airbrake/rails3_tasks.rb +4 -1
  33. data/lib/airbrake/railtie.rb +19 -4
  34. data/lib/airbrake/rake_handler.rb +1 -1
  35. data/lib/airbrake/sender.rb +2 -7
  36. data/lib/airbrake/shared_tasks.rb +9 -3
  37. data/lib/airbrake/user_informer.rb +1 -1
  38. data/lib/airbrake/version.rb +1 -1
  39. data/lib/airbrake_tasks.rb +11 -8
  40. data/lib/rails/generators/airbrake/airbrake_generator.rb +6 -2
  41. data/script/integration_test.rb +1 -1
  42. data/test/airbrake_tasks_test.rb +2 -2
  43. data/test/backtrace_test.rb +0 -1
  44. data/test/configuration_test.rb +2 -2
  45. data/test/helper.rb +0 -4
  46. data/test/notice_test.rb +3 -1
  47. data/test/notifier_test.rb +1 -1
  48. data/test/sender_test.rb +18 -18
  49. metadata +151 -233
  50. data/.gitignore +0 -18
  51. data/.yardopts +0 -3
  52. data/features/step_definitions/airbrake_shim.rb.template +0 -15
data/Rakefile CHANGED
@@ -8,8 +8,10 @@ rescue LoadError
8
8
  exit 1
9
9
  end
10
10
 
11
+ FEATURES = ["sinatra","rack","metal","user_informer"]
12
+
11
13
  desc 'Default: run unit tests.'
12
- task :default => [:test, "cucumber:rails:all"]
14
+ task :default => [:test, "cucumber:rails:all"] + FEATURES
13
15
 
14
16
  desc "Clean out the tmp directory"
15
17
  task :clean do
@@ -64,18 +66,19 @@ EOF
64
66
  old = File.read(file)
65
67
  version = Airbrake::VERSION
66
68
  message = "Bumping to version #{version}"
69
+ editor = ENV["EDITOR"] || "vim" # prefer vim if no env variable for editor is set
67
70
 
68
71
  File.open(file, "w") do |f|
69
72
  f.write <<EOF
70
73
  Version #{version} - #{Time.now}
71
74
  ===============================================================================
72
75
 
73
- #{`git log $(git tag | tail -1)..HEAD | git shortlog`}
76
+ #{`git log $(git tag | grep -v rc | tail -1)..HEAD | git shortlog`}
74
77
  #{old}
75
78
  EOF
76
79
  end
77
80
 
78
- exec ["#{ENV["EDITOR"]} #{file}",
81
+ exec ["#{editor} #{file}",
79
82
  "git commit -aqm '#{message}'",
80
83
  "git tag -a -m '#{message}' v#{version}",
81
84
  "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(' && ')
@@ -96,7 +99,7 @@ EOF
96
99
  desc "Push the latest version and tags"
97
100
  task :push do |t|
98
101
  system("git push origin master")
99
- system("git push origin $(git tag | tail -1)")
102
+ system("git push origin $(git tag | grep -v rc | tail -1)")
100
103
  end
101
104
  end
102
105
 
@@ -115,8 +118,19 @@ task :clobber => [:clobber_rdoc, :clobber_package]
115
118
 
116
119
  LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
117
120
  RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
118
- LOCAL_GEMS = [['sham_rack', nil], ['capistrano', nil], ['sqlite3-ruby', nil], ['sinatra', nil], ['rake', '0.8.7']] +
119
- RAILS_VERSIONS.collect { |version| ['rails', version] }
121
+ LOCAL_GEMS =
122
+ [
123
+ ["rack","1.3.2"],
124
+ ] +
125
+ RAILS_VERSIONS.collect { |version| ['rails', version] } +
126
+ [
127
+ ['sham_rack', nil],
128
+ ['capistrano', nil],
129
+ ['sqlite3-ruby', nil],
130
+ ["therubyracer",nil],
131
+ ["sinatra",nil]
132
+ ]
133
+
120
134
 
121
135
  desc "Vendor test gems: Run this once to prepare your test environment"
122
136
  task :vendor_test_gems do
@@ -124,20 +138,26 @@ task :vendor_test_gems do
124
138
  old_gem_home = ENV['GEM_HOME']
125
139
  ENV['GEM_PATH'] = LOCAL_GEM_ROOT
126
140
  ENV['GEM_HOME'] = LOCAL_GEM_ROOT
141
+
127
142
  LOCAL_GEMS.each do |gem_name, version|
128
143
  gem_file_pattern = [gem_name, version || '*'].compact.join('-')
129
144
  version_option = version ? "-v #{version}" : ''
130
145
  pattern = File.join(LOCAL_GEM_ROOT, 'gems', "#{gem_file_pattern}")
131
146
  existing = Dir.glob(pattern).first
132
- unless existing
133
- command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc --backtrace #{version_option} #{gem_name}"
134
- puts "Vendoring #{gem_file_pattern}..."
135
- unless system("#{command} 2>&1")
136
- puts "Command failed: #{command}"
137
- exit(1)
138
- end
147
+ if existing
148
+ puts "\nskipping #{gem_name} since it's already vendored," +
149
+ "remove it from the tmp directory first."
150
+ next
151
+ end
152
+
153
+ command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc --backtrace #{version_option} #{gem_name}"
154
+ puts "Vendoring #{gem_file_pattern}..."
155
+ unless system("#{command} 2>&1")
156
+ puts "Command failed: #{command}"
157
+ exit(1)
139
158
  end
140
159
  end
160
+
141
161
  ENV['GEM_PATH'] = old_gem_path
142
162
  ENV['GEM_HOME'] = old_gem_home
143
163
  end
@@ -149,13 +169,14 @@ end
149
169
 
150
170
  task :cucumber => [:vendor_test_gems]
151
171
 
172
+
152
173
  def run_rails_cucumbr_task(version, additional_cucumber_args)
153
174
  puts "Testing Rails #{version}"
154
175
  if version.empty?
155
176
  raise "No Rails version specified - make sure ENV['RAILS_VERSION'] is set, e.g. with `rake cucumber:rails:all`"
156
177
  end
157
178
  ENV['RAILS_VERSION'] = version
158
- cmd = "cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} #{additional_cucumber_args} features/rails.feature features/rails_with_js_notifier.feature"
179
+ cmd = "cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} #{additional_cucumber_args} features/rails.feature features/rails_with_js_notifier.feature"
159
180
  puts "Running command: #{cmd}"
160
181
  system(cmd)
161
182
  end
@@ -186,5 +207,16 @@ namespace :cucumber do
186
207
  end
187
208
 
188
209
  define_rails_cucumber_tasks
189
- end
190
210
 
211
+ rule /#{"(" + FEATURES.join("|") + ")"}/ do |t|
212
+ framework = t.name
213
+ desc "Test integration of the gem with #{framework}"
214
+ task framework.to_sym do
215
+ puts "Testing #{framework.split(":").last}..."
216
+ cmd = "cucumber --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features/#{framework.split(":").last}.feature"
217
+ puts "Running command: #{cmd}"
218
+ system(cmd)
219
+ end
220
+ end
221
+
222
+ end
@@ -10,3 +10,14 @@
10
10
  3.0.8
11
11
  3.0.9
12
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 CHANGED
@@ -3,23 +3,25 @@ Running the suite
3
3
 
4
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
5
 
6
- First execute the following command:
6
+ You should start by trusting the .rvmrc file. We come in peace.
7
+
8
+ Then execute the following command:
7
9
 
8
10
  rake vendor_test_gems
9
11
  # NOT: bundle exec rake vendor_test_gems
10
12
 
11
- This command will download the various versions of Rails that the notifier must be tested against.
13
+ This command will download the various versions of Rails and other gems that the notifier must be tested against.
12
14
 
13
15
  Then, to start the suite, run
14
16
 
15
17
  rake
18
+ # NOT: bundle exec rake
16
19
 
17
- Note: do NOT use 'bundle exec rake'.
18
20
 
19
21
  For Maintainers
20
22
  ================
21
23
 
22
- When developing the Airbrake Notifier, be sure to use the integration test against an existing project on staging before pushing to master.
24
+ When developing the Airbrake gem, be sure to use the integration test against an existing project on staging before pushing to master.
23
25
 
24
26
  ./script/integration_test.rb <test project's api key> <staging server hostname>
25
27
 
@@ -8,9 +8,10 @@ Gem::Specification.new do |s|
8
8
  s.summary = %q{Send your application errors to our hosted service and reclaim your inbox.}
9
9
 
10
10
  s.require_paths = ["lib"]
11
- s.files = `git ls-files`.split("\n")
12
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
-
11
+ s.files = Dir["{generators/**/*,lib/**/*,rails/**/*,resources/*,script/*}"] +
12
+ %w(airbrake.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
+
14
15
  s.add_runtime_dependency("builder")
15
16
  s.add_runtime_dependency("activesupport")
16
17
 
@@ -26,7 +27,7 @@ Gem::Specification.new do |s|
26
27
  s.add_development_dependency("shoulda", "~> 2.11.3")
27
28
  s.add_development_dependency("capistrano", "~> 2.8.0")
28
29
 
29
- s.authors = ["thoughtbot, inc"]
30
+ s.authors = ["Airbrake"]
30
31
  s.email = %q{support@airbrake.io}
31
32
  s.homepage = "http://www.airbrake.io"
32
33
 
@@ -5,7 +5,7 @@ Feature: Rescue errors in Rails middleware
5
5
  And I generate a new Rails application
6
6
  And I configure the Airbrake shim
7
7
  And I configure my application to require the "airbrake" gem
8
- And I run "script/generate airbrake -k myapikey"
8
+ And I run the airbrake generator with "-k myapikey"
9
9
 
10
10
  Scenario: Rescue an exception in the dispatcher
11
11
  When I define a Metal endpoint called "Exploder":
@@ -15,9 +15,4 @@ Feature: Rescue errors in Rails middleware
15
15
  end
16
16
  """
17
17
  When I perform a request to "http://example.com:123/metal/index?param=value"
18
- Then I should receive the following Airbrake notification:
19
- | error message | RuntimeError: Explode |
20
- | error class | RuntimeError |
21
- | parameters | param: value |
22
- | url | http://example.com:123/metal/index?param=value |
23
-
18
+ Then I should receive a Airbrake notification
@@ -19,9 +19,5 @@ Feature: Use the notifier in a plain Rack app
19
19
  end
20
20
  """
21
21
  When I perform a Rack request to "http://example.com:123/test/index?param=value"
22
- Then I should receive the following Airbrake notification:
23
- | error message | RuntimeError: Rack down |
24
- | error class | RuntimeError |
25
- | parameters | param: value |
26
- | url | http://example.com:123/test/index?param=value |
22
+ Then I should receive a Airbrake notification for rack
27
23
 
@@ -22,7 +22,7 @@ Feature: Install the Gem in a Rails application
22
22
  When I uninstall the "airbrake" gem
23
23
  And I install cached gems
24
24
  And I run "rake airbrake:test"
25
- Then I should see "** [Airbrake] Success: Net::HTTPOK"
25
+ Then I should see "** [Airbrake] Response from Airbrake:"
26
26
  And I should receive two Airbrake notifications
27
27
 
28
28
  Scenario: Configure the notifier by hand
@@ -51,8 +51,7 @@ Feature: Install the Gem in a Rails application
51
51
  """
52
52
  And I route "/test/index" to "test#index"
53
53
  And I perform a request to "http://example.com:123/test/index?param=value"
54
- Then I should receive the following Airbrake notification:
55
- | project-root | argle/bargle |
54
+ Then I should receive a Airbrake notification
56
55
 
57
56
  Scenario: Try to install without an api key
58
57
  When I generate a new Rails application
@@ -66,6 +65,7 @@ Feature: Install the Gem in a Rails application
66
65
  And I configure the Airbrake shim
67
66
  And I configure my application to require the "airbrake" gem
68
67
  And I run the airbrake generator with "-k myapikey"
68
+ And I configure my application to require the "capistrano" gem if necessary
69
69
  And I run "cap -T"
70
70
  Then I should see "airbrake:deploy"
71
71
 
@@ -78,6 +78,7 @@ Feature: Install the Gem in a Rails application
78
78
  And I run the airbrake generator with "-k myapikey"
79
79
  And I uninstall the "airbrake" gem
80
80
  And I install cached gems
81
+ And I configure my application to require the "capistrano" gem if necessary
81
82
  And I run "cap -T"
82
83
  Then I should see "airbrake:deploy"
83
84
 
@@ -102,14 +103,7 @@ Feature: Install the Gem in a Rails application
102
103
  """
103
104
  And I route "/test/index" to "test#index"
104
105
  And I perform a request to "http://example.com:123/test/index?param=value"
105
- Then I should receive the following Airbrake notification:
106
- | component | test |
107
- | action | index |
108
- | error message | RuntimeError: some message |
109
- | error class | RuntimeError |
110
- | session | value: test |
111
- | parameters | param: value |
112
- | url | http://example.com:123/test/index?param=value |
106
+ Then I should receive a Airbrake notification
113
107
 
114
108
  Scenario: The gem should not be considered a framework gem
115
109
  When I generate a new Rails application
@@ -175,13 +169,7 @@ Feature: Install the Gem in a Rails application
175
169
  """
176
170
  And I route "/test/index" to "test#index"
177
171
  And I perform a request to "http://example.com:123/test/index?param=value"
178
- Then I should receive the following Airbrake notification:
179
- | component | test |
180
- | action | index |
181
- | error message | RuntimeError: some message |
182
- | error class | RuntimeError |
183
- | parameters | credit_card_number: [FILTERED] |
184
- | url | http://example.com:123/test/index?param=value |
172
+ Then I should receive a Airbrake notification
185
173
 
186
174
  Scenario: Filtering session in a controller
187
175
  When I generate a new Rails application
@@ -200,13 +188,7 @@ Feature: Install the Gem in a Rails application
200
188
  """
201
189
  And I route "/test/index" to "test#index"
202
190
  And I perform a request to "http://example.com:123/test/index?param=value"
203
- Then I should receive the following Airbrake notification:
204
- | component | test |
205
- | action | index |
206
- | error message | RuntimeError: some message |
207
- | error class | RuntimeError |
208
- | session | secret: [FILTERED] |
209
- | url | http://example.com:123/test/index?param=value |
191
+ Then I should receive a Airbrake notification
210
192
 
211
193
  Scenario: Filtering session and params based on Rails parameter filters
212
194
  When I generate a new Rails application
@@ -222,14 +204,7 @@ Feature: Install the Gem in a Rails application
222
204
  """
223
205
  And I route "/test/index" to "test#index"
224
206
  And I perform a request to "http://example.com:123/test/index?param=value"
225
- Then I should receive the following Airbrake notification:
226
- | component | test |
227
- | action | index |
228
- | error message | RuntimeError: some message |
229
- | error class | RuntimeError |
230
- | params | secret: [FILTERED] |
231
- | session | secret: [FILTERED] |
232
- | url | http://example.com:123/test/index?param=value |
207
+ Then I should receive a Airbrake notification
233
208
 
234
209
  Scenario: Notify airbrake within the controller
235
210
  When I generate a new Rails application
@@ -244,11 +219,4 @@ Feature: Install the Gem in a Rails application
244
219
  """
245
220
  And I route "/test/index" to "test#index"
246
221
  And I perform a request to "http://example.com:123/test/index?param=value"
247
- Then I should receive the following Airbrake notification:
248
- | component | test |
249
- | action | index |
250
- | error message | RuntimeError: some message |
251
- | error class | RuntimeError |
252
- | session | value: test |
253
- | parameters | param: value |
254
- | url | http://example.com:123/test/index?param=value |
222
+ Then I should receive a Airbrake notification
@@ -19,7 +19,7 @@ Feature: Install the Gem in a Rails application and enable the JavaScript notifi
19
19
  And I perform a request to "http://example.com:123/test/index"
20
20
  Then I should see the notifier JavaScript for the following:
21
21
  | api_key | environment | host |
22
- | myapikey | production | airbrake.io |
22
+ | myapikey | production | api.airbrake.io |
23
23
  And the notifier JavaScript should provide the following errorDefaults:
24
24
  | url | component | action |
25
25
  | http://example.com:123/test/index | test | index |
@@ -76,3 +76,22 @@ Feature: Install the Gem in a Rails application and enable the JavaScript notifi
76
76
  And I route "/test/index" to "test#index"
77
77
  And I perform a request to "http://example.com:123/test/index" in the "test" environment
78
78
  Then I should not see notifier JavaScript
79
+
80
+ Scenario: Include the Javascript notifier with a custom api key
81
+ When I generate a new Rails application
82
+ And I configure the Airbrake shim
83
+ And I configure my application to require the "airbrake" gem
84
+ When I configure the notifier to use the following configuration lines:
85
+ """
86
+ config.api_key = "myapikey!"
87
+ config.js_api_key = "myjsapikey!"
88
+ """
89
+ And I define a response for "TestController#index":
90
+ """
91
+ render :inline => '<html><head><%= airbrake_javascript_notifier %></head><body></body></html>'
92
+ """
93
+ And I route "/test/index" to "test#index"
94
+ And I perform a request to "http://example.com:123/test/index"
95
+ Then I should see the notifier JavaScript for the following:
96
+ | api_key | environment | host |
97
+ | myjsapikey! | production | api.airbrake.io |
@@ -17,11 +17,11 @@ Feature: Use the Gem to catch errors in a Rake application
17
17
  Scenario: Autodetect, running from terminal
18
18
  When I run rake with airbrake autodetect from terminal
19
19
  Then Airbrake should not catch the exception
20
-
20
+
21
21
  Scenario: Autodetect, not running from terminal
22
22
  When I run rake with airbrake autodetect not from terminal
23
23
  Then Airbrake should catch the exception
24
24
 
25
- Scenario: Sendind the correct component name
25
+ Scenario: Sending the correct component name
26
26
  When I run rake with airbrake
27
27
  Then Airbrake should send the rake command line as the component name
@@ -25,9 +25,5 @@ Feature: Use the notifier in a Sinatra app
25
25
  app = FontaneApp
26
26
  """
27
27
  When I perform a Rack request to "http://example.com:123/test/index?param=value"
28
- Then I should receive the following Airbrake notification:
29
- | error message | RuntimeError: Sinatra has left the building |
30
- | error class | RuntimeError |
31
- | parameters | param: value |
32
- | url | http://example.com:123/test/index?param=value |
28
+ Then I should receive a Airbrake notification for rack
33
29
 
@@ -18,3 +18,6 @@ When /^I perform a Rack request to "([^\"]*)"$/ do |url|
18
18
  @terminal.run("ruby #{request_file}")
19
19
  end
20
20
 
21
+ Then /^I should receive a Airbrake notification for rack$/ do
22
+ Then %{I should see "You have accessed a deleted account."}
23
+ end
@@ -3,7 +3,6 @@ require 'active_support/core_ext/string/inflections'
3
3
 
4
4
  When /^I generate a new Rails application$/ do
5
5
  @terminal.cd(TEMP_DIR)
6
- version_string = ENV['RAILS_VERSION']
7
6
 
8
7
  rails3 = version_string =~ /^3/
9
8
 
@@ -15,7 +14,7 @@ When /^I generate a new Rails application$/ do
15
14
 
16
15
  load_rails = <<-RUBY
17
16
  gem 'rails', '#{version_string}'; \
18
- load Gem.bin_path('rails', 'rails', '#{version_string}')
17
+ load Gem.bin_path('#{version_string >= "3.2.0" ? "railties" : "rails"}', 'rails', '#{version_string}')
19
18
  RUBY
20
19
 
21
20
  @terminal.run(%{ruby -rrubygems -rthread -e "#{load_rails.strip!}" #{rails_create_command} rails_root})
@@ -25,7 +24,11 @@ When /^I generate a new Rails application$/ do
25
24
  raise "Unable to generate a Rails application:\n#{@terminal.output}"
26
25
  end
27
26
  require_thread
28
- When %{I configure my application to require the "rake" gem with version "0.8.7"}
27
+ if version_string >= "3.1.0"
28
+ When %{I configure my application to require the "therubyracer" gem with version "0.10.1"}
29
+ elsif version_string == "2.3.14"
30
+ monkeypatch_old_version
31
+ end
29
32
  config_gem_dependencies unless rails3
30
33
  end
31
34
 
@@ -49,6 +52,10 @@ Given /^I have built and installed the "([^\"]*)" gem$/ do |gem_name|
49
52
  @terminal.build_and_install_gem(File.join(PROJECT_ROOT, "#{gem_name}.gemspec"))
50
53
  end
51
54
 
55
+ When /^I configure my application to require the "capistrano" gem if necessary$/ do
56
+ When %{I configure my application to require the "capistrano" gem} if version_string >= "3.0.0"
57
+ end
58
+
52
59
  When /^I configure my application to require the "([^\"]*)" gem(?: with version "(.+)")?$/ do |gem_name, version|
53
60
  if rails_manages_gems?
54
61
  config_gem(gem_name, version)
@@ -73,11 +80,13 @@ When /^I run "([^\"]*)"$/ do |command|
73
80
  end
74
81
 
75
82
  Then /^I should receive a Airbrake notification$/ do
76
- Then %{I should see "[Airbrake] Success: Net::HTTPOK"}
83
+ Then %{I should see "** [Airbrake] Response from Airbrake:"}
84
+ And %{I should see "b6817316-9c45-ed26-45eb-780dbb86aadb"}
85
+ And %{I should see "http://airbrake.io/locate/b6817316-9c45-ed26-45eb-780dbb86aadb"}
77
86
  end
78
87
 
79
88
  Then /^I should receive two Airbrake notifications$/ do
80
- @terminal.output.scan(/\[Airbrake\] Success: Net::HTTPOK/).size.should == 2
89
+ @terminal.output.scan(/\[Airbrake\] Response from Airbrake:/).size.should == 2
81
90
  end
82
91
 
83
92
  When /^I configure the Airbrake shim$/ do
@@ -178,7 +187,7 @@ end
178
187
 
179
188
  When /^I install cached gems$/ do
180
189
  if bundler_manages_gems?
181
- When %{I run "bundle install"}
190
+ Then %{I run "bundle install"}
182
191
  end
183
192
  end
184
193
 
@@ -306,18 +315,33 @@ When /^I configure the Heroku gem shim with "([^\"]*)"( and multiple app support
306
315
  heroku_script_bin = File.join(TEMP_DIR, "bin")
307
316
  FileUtils.mkdir_p(heroku_script_bin)
308
317
  heroku_script = File.join(heroku_script_bin, "heroku")
318
+ heroku_env_vars = <<-VARS
319
+ AIRBRAKE_API_KEY => myapikey
320
+ APP_NAME => cold-moon-2929
321
+ BUNDLE_WITHOUT => development:test
322
+ COMMIT_HASH => lj32j42ss9332jfa2
323
+ DATABASE_URL => postgres://fchovwjcyb:QLPVWmBBbf4hCG_YMrtV@ec3-107-28-193-23.compute-1.amazonaws.com/fhcvojwwcyb
324
+ LANG => en_US.UTF-8
325
+ LAST_GIT_BY => kensa
326
+ RACK_ENV => production
327
+ SHARED_DATABASE_URL => postgres://fchovwjcyb:QLPVwMbbbF8Hcg_yMrtV@ec2-94-29-181-224.compute-1.amazonaws.com/fhcvojcwwyb
328
+ STACK => bamboo-mri-1.9.2
329
+ URL => cold-moon-2929.heroku.com
330
+ VARS
309
331
  single_app_script = <<-SINGLE
310
- #!/bin/bash
311
- if [[ $1 == 'console' && $2 == 'puts ENV[%{HOPTOAD_API_KEY}]' ]]; then
312
- echo #{api_key}
313
- fi
332
+ #!/bin/bash
333
+ if [ $1 == 'config' ]
334
+ then
335
+ echo "#{heroku_env_vars}"
336
+ fi
314
337
  SINGLE
315
338
 
316
339
  multi_app_script = <<-MULTI
317
- #!/bin/bash
318
- if [[ $1 == 'console' && $2 == '--app' && $4 == 'puts ENV[%{HOPTOAD_API_KEY}]' ]]; then
319
- echo #{api_key}
320
- fi
340
+ #!/bin/bash
341
+ if [[ $1 == 'config' && $2 == '--app' ]]
342
+ then
343
+ echo "#{heroku_env_vars}"
344
+ fi
321
345
  MULTI
322
346
 
323
347
  File.open(heroku_script, "w") do |f|
@@ -363,7 +387,7 @@ end
363
387
 
364
388
  Then /^I should see the notifier JavaScript for the following:$/ do |table|
365
389
  hash = table.hashes.first
366
- host = hash['host'] || 'airbrake.io'
390
+ host = hash['host'] || 'api.airbrake.io'
367
391
  secure = hash['secure'] || false
368
392
  api_key = hash['api_key']
369
393
  environment = hash['environment'] || 'production'