projectlocker_errata 0.0.1
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.
- data/CHANGELOG +908 -0
- data/Gemfile +3 -0
- data/Guardfile +6 -0
- data/INSTALL +20 -0
- data/MIT-LICENSE +23 -0
- data/README.md +460 -0
- data/README_FOR_HEROKU_ADDON.md +94 -0
- data/Rakefile +223 -0
- data/SUPPORTED_RAILS_VERSIONS +38 -0
- data/TESTING.md +41 -0
- data/features/metal.feature +18 -0
- data/features/rack.feature +60 -0
- data/features/rails.feature +272 -0
- data/features/rails_with_js_notifier.feature +97 -0
- data/features/rake.feature +27 -0
- data/features/sinatra.feature +29 -0
- data/features/step_definitions/file_steps.rb +10 -0
- data/features/step_definitions/metal_steps.rb +23 -0
- data/features/step_definitions/rack_steps.rb +23 -0
- data/features/step_definitions/rails_application_steps.rb +478 -0
- data/features/step_definitions/rake_steps.rb +17 -0
- data/features/support/env.rb +18 -0
- data/features/support/matchers.rb +35 -0
- data/features/support/projectlocker_errata_shim.rb.template +16 -0
- data/features/support/rails.rb +201 -0
- data/features/support/rake/Rakefile +68 -0
- data/features/support/terminal.rb +107 -0
- data/features/user_informer.feature +63 -0
- data/generators/projectlocker_errata/lib/insert_commands.rb +34 -0
- data/generators/projectlocker_errata/lib/rake_commands.rb +24 -0
- data/generators/projectlocker_errata/projectlocker_errata_generator.rb +94 -0
- data/generators/projectlocker_errata/templates/capistrano_hook.rb +6 -0
- data/generators/projectlocker_errata/templates/initializer.rb +6 -0
- data/generators/projectlocker_errata/templates/projectlocker_errata_tasks.rake +25 -0
- data/install.rb +1 -0
- data/lib/projectlocker_errata/backtrace.rb +108 -0
- data/lib/projectlocker_errata/capistrano.rb +43 -0
- data/lib/projectlocker_errata/configuration.rb +305 -0
- data/lib/projectlocker_errata/notice.rb +390 -0
- data/lib/projectlocker_errata/rack.rb +54 -0
- data/lib/projectlocker_errata/rails/action_controller_catcher.rb +30 -0
- data/lib/projectlocker_errata/rails/controller_methods.rb +85 -0
- data/lib/projectlocker_errata/rails/error_lookup.rb +33 -0
- data/lib/projectlocker_errata/rails/javascript_notifier.rb +47 -0
- data/lib/projectlocker_errata/rails/middleware/exceptions_catcher.rb +33 -0
- data/lib/projectlocker_errata/rails.rb +40 -0
- data/lib/projectlocker_errata/rails3_tasks.rb +98 -0
- data/lib/projectlocker_errata/railtie.rb +48 -0
- data/lib/projectlocker_errata/rake_handler.rb +65 -0
- data/lib/projectlocker_errata/sender.rb +128 -0
- data/lib/projectlocker_errata/shared_tasks.rb +47 -0
- data/lib/projectlocker_errata/tasks.rb +83 -0
- data/lib/projectlocker_errata/user_informer.rb +27 -0
- data/lib/projectlocker_errata/utils/blank.rb +53 -0
- data/lib/projectlocker_errata/version.rb +3 -0
- data/lib/projectlocker_errata.rb +159 -0
- data/lib/projectlocker_errata_tasks.rb +64 -0
- data/lib/rails/generators/projectlocker_errata/projectlocker_errata_generator.rb +100 -0
- data/lib/templates/javascript_notifier.erb +15 -0
- data/lib/templates/rescue.erb +91 -0
- data/projectlocker_errata.gemspec +39 -0
- data/rails/init.rb +1 -0
- data/resources/README.md +34 -0
- data/resources/ca-bundle.crt +3376 -0
- data/script/integration_test.rb +38 -0
- data/test/airbrake_2_3.xsd +88 -0
- data/test/backtrace_test.rb +162 -0
- data/test/capistrano_test.rb +34 -0
- data/test/catcher_test.rb +333 -0
- data/test/configuration_test.rb +236 -0
- data/test/helper.rb +263 -0
- data/test/javascript_notifier_test.rb +51 -0
- data/test/logger_test.rb +79 -0
- data/test/notice_test.rb +490 -0
- data/test/notifier_test.rb +276 -0
- data/test/projectlocker_errata_tasks_test.rb +170 -0
- data/test/rack_test.rb +58 -0
- data/test/rails_initializer_test.rb +36 -0
- data/test/recursion_test.rb +10 -0
- data/test/sender_test.rb +288 -0
- data/test/user_informer_test.rb +29 -0
- metadata +440 -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/projectlocker_errata/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 projectlocker_errata 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 ProjectlockerErrata::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", "projectlocker_errata", "version.rb"), "w") do |f|
|
55
|
+
f.write <<EOF
|
56
|
+
module ProjectlockerErrata
|
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/projectlocker_errata/version.rb'
|
66
|
+
file = "CHANGELOG"
|
67
|
+
old = File.read(file)
|
68
|
+
version = ProjectlockerErrata::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,38 @@
|
|
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.0.13
|
16
|
+
3.0.14
|
17
|
+
3.0.15
|
18
|
+
3.0.16
|
19
|
+
3.0.17
|
20
|
+
3.1.0
|
21
|
+
3.1.1
|
22
|
+
3.1.2
|
23
|
+
3.1.3
|
24
|
+
3.1.4
|
25
|
+
3.1.5
|
26
|
+
3.1.6
|
27
|
+
3.1.7
|
28
|
+
3.1.8
|
29
|
+
3.1.4
|
30
|
+
3.2.0
|
31
|
+
3.2.1
|
32
|
+
3.2.2
|
33
|
+
3.2.3
|
34
|
+
3.2.4
|
35
|
+
3.2.5
|
36
|
+
3.2.6
|
37
|
+
3.2.7
|
38
|
+
3.2.8
|
data/TESTING.md
ADDED
@@ -0,0 +1,41 @@
|
|
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
|
+
You can also specify to test only against the certain frameworks we
|
26
|
+
support (rack, rake and sinatra) by executing
|
27
|
+
|
28
|
+
rake cucumber:<FRAMEWORK>
|
29
|
+
|
30
|
+
This tasks are not printed out with `rake -T` since they're added
|
31
|
+
dynamically in the Rakefile.
|
32
|
+
|
33
|
+
|
34
|
+
For Maintainers
|
35
|
+
================
|
36
|
+
|
37
|
+
When developing the Airbrake gem, be sure to use the integration test against an existing project on staging before pushing to master.
|
38
|
+
|
39
|
+
./script/integration_test.rb <test project's api key> <staging server hostname>
|
40
|
+
|
41
|
+
./script/integration_test.rb <test project's api key> <staging server hostname> secure
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Rescue errors in Rails middleware
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I have built and installed the "projectlocker_errata" gem
|
5
|
+
And I generate a new Rails application
|
6
|
+
And I configure the ProjectlockerErrata shim
|
7
|
+
And I configure my application to require the "projectlocker_errata" gem
|
8
|
+
And I run the projectlocker_errata 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 ProjectlockerErrata notification
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Feature: Use the notifier in a plain Rack app
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I have built and installed the "projectlocker_errata" gem
|
5
|
+
|
6
|
+
Scenario: Rescue and exception in a Rack app
|
7
|
+
Given the following Rack app:
|
8
|
+
"""
|
9
|
+
require 'logger'
|
10
|
+
require 'rack'
|
11
|
+
require 'projectlocker_errata'
|
12
|
+
|
13
|
+
ProjectlockerErrata.configure do |config|
|
14
|
+
config.api_key = 'my_api_key'
|
15
|
+
config.logger = Logger.new STDOUT
|
16
|
+
end
|
17
|
+
|
18
|
+
app = Rack::Builder.app do
|
19
|
+
use ProjectlockerErrata::Rack
|
20
|
+
run lambda { |env| raise "Rack down" }
|
21
|
+
end
|
22
|
+
"""
|
23
|
+
When I perform a Rack request to "http://example.com:123/test/index?param=value"
|
24
|
+
Then I should receive a ProjectlockerErrata notification
|
25
|
+
|
26
|
+
Scenario: Ignore user agents
|
27
|
+
Given the following Rack app:
|
28
|
+
"""
|
29
|
+
require 'logger'
|
30
|
+
require 'rack'
|
31
|
+
require 'projectlocker_errata'
|
32
|
+
|
33
|
+
ProjectlockerErrata.configure do |config|
|
34
|
+
config.api_key = 'my_api_key'
|
35
|
+
config.ignore_user_agent << /ignore/
|
36
|
+
config.logger = Logger.new STDOUT
|
37
|
+
end
|
38
|
+
|
39
|
+
class Mock
|
40
|
+
class AppendUserAgent
|
41
|
+
def initialize(app)
|
42
|
+
@app = app
|
43
|
+
end
|
44
|
+
|
45
|
+
def call(env)
|
46
|
+
env["HTTP_USER_AGENT"] = "ignore"
|
47
|
+
@app.call(env)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
app = Rack::Builder.app do
|
53
|
+
use ProjectlockerErrata::Rack
|
54
|
+
use Mock::AppendUserAgent
|
55
|
+
run lambda { |env| raise "Rack down" }
|
56
|
+
end
|
57
|
+
"""
|
58
|
+
When I perform a Rack request to "http://example.com:123/test/index?param=value"
|
59
|
+
Then I should not see "** [ProjectlockerErrata] Response from ProjectlockerErrata:"
|
60
|
+
|
@@ -0,0 +1,272 @@
|
|
1
|
+
Feature: Install the Gem in a Rails application
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I have built and installed the "projectlocker_errata" 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 ProjectlockerErrata shim
|
9
|
+
And I configure my application to require the "projectlocker_errata" gem
|
10
|
+
And I run the projectlocker_errata generator with "-k myapikey"
|
11
|
+
Then the command should have run successfully
|
12
|
+
And I should receive a ProjectlockerErrata notification
|
13
|
+
And I should see the Rails version
|
14
|
+
|
15
|
+
Scenario: vendor the gem and uninstall
|
16
|
+
When I configure the ProjectlockerErrata shim
|
17
|
+
And I configure my application to require the "projectlocker_errata" gem
|
18
|
+
And I unpack the "projectlocker_errata" gem
|
19
|
+
And I run the projectlocker_errata generator with "-k myapikey"
|
20
|
+
Then the command should have run successfully
|
21
|
+
When I uninstall the "projectlocker_errata" gem
|
22
|
+
And I install cached gems
|
23
|
+
And I run "rake projectlocker_errata:test"
|
24
|
+
Then I should see "** [ProjectlockerErrata] Response from ProjectlockerErrata:"
|
25
|
+
And I should receive two ProjectlockerErrata notifications
|
26
|
+
|
27
|
+
Scenario: Configure the notifier by hand
|
28
|
+
When I configure the ProjectlockerErrata shim
|
29
|
+
And I configure the notifier to use "myapikey" as an API key
|
30
|
+
And I configure my application to require the "projectlocker_errata" gem
|
31
|
+
And I run the projectlocker_errata generator with ""
|
32
|
+
Then I should receive a ProjectlockerErrata notification
|
33
|
+
|
34
|
+
Scenario: Configuration within initializer isn't overridden by Railtie
|
35
|
+
When I configure the ProjectlockerErrata shim
|
36
|
+
And I configure usage of ProjectlockerErrata
|
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 ProjectlockerErrata notification
|
51
|
+
|
52
|
+
Scenario: Try to install without an api key
|
53
|
+
When I configure my application to require the "projectlocker_errata" gem
|
54
|
+
And I run the projectlocker_errata generator with ""
|
55
|
+
Then I should see "Must pass --api-key or --heroku or create config/initializers/projectlocker_errata.rb"
|
56
|
+
|
57
|
+
Scenario: Configure and deploy using only installed gem
|
58
|
+
When I run "capify ."
|
59
|
+
And I configure the ProjectlockerErrata shim
|
60
|
+
And I configure my application to require the "projectlocker_errata" gem
|
61
|
+
And I run the projectlocker_errata 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 "projectlocker_errata:deploy"
|
65
|
+
|
66
|
+
Scenario: Configure and deploy using only vendored gem
|
67
|
+
When I run "capify ."
|
68
|
+
And I configure the ProjectlockerErrata shim
|
69
|
+
And I configure my application to require the "projectlocker_errata" gem
|
70
|
+
And I unpack the "projectlocker_errata" gem
|
71
|
+
And I run the projectlocker_errata generator with "-k myapikey"
|
72
|
+
And I uninstall the "projectlocker_errata" 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 "projectlocker_errata:deploy"
|
77
|
+
|
78
|
+
Scenario: Try to install when the projectlocker_errata plugin still exists
|
79
|
+
When I install the "projectlocker_errata" plugin
|
80
|
+
And I configure the ProjectlockerErrata shim
|
81
|
+
And I configure the notifier to use "myapikey" as an API key
|
82
|
+
And I configure my application to require the "projectlocker_errata" gem
|
83
|
+
And I run the projectlocker_errata generator with ""
|
84
|
+
Then I should see "You must first remove the projectlocker_errata plugin. Please run: script/plugin remove projectlocker_errata"
|
85
|
+
|
86
|
+
Scenario: Rescue an exception in a controller
|
87
|
+
When I configure the ProjectlockerErrata shim
|
88
|
+
And I configure usage of ProjectlockerErrata
|
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 ProjectlockerErrata notification
|
97
|
+
Then I should see "test"
|
98
|
+
|
99
|
+
Scenario: The gem should not be considered a framework gem
|
100
|
+
When I configure the ProjectlockerErrata shim
|
101
|
+
And I configure my application to require the "projectlocker_errata" gem
|
102
|
+
And I run the projectlocker_errata generator with "-k myapikey"
|
103
|
+
And I run "rake gems"
|
104
|
+
Then I should see that "projectlocker_errata" is not considered a framework gem
|
105
|
+
|
106
|
+
Scenario: The app uses Vlad instead of Capistrano
|
107
|
+
When I configure the ProjectlockerErrata shim
|
108
|
+
And I configure my application to require the "projectlocker_errata" gem
|
109
|
+
And I run "touch config/deploy.rb"
|
110
|
+
And I run "rm Capfile"
|
111
|
+
And I run the projectlocker_errata generator with "-k myapikey"
|
112
|
+
Then "config/deploy.rb" should not contain "capistrano"
|
113
|
+
|
114
|
+
Scenario: Support the Heroku addon in the generator
|
115
|
+
When I configure the ProjectlockerErrata shim
|
116
|
+
And I configure the Heroku rake shim
|
117
|
+
And I configure the Heroku gem shim with "myapikey"
|
118
|
+
And I configure my application to require the "projectlocker_errata" gem
|
119
|
+
And I run the projectlocker_errata generator with "--heroku"
|
120
|
+
Then the command should have run successfully
|
121
|
+
And I should receive a ProjectlockerErrata notification
|
122
|
+
And I should see the Rails version
|
123
|
+
And my ProjectlockerErrata configuration should contain the following line:
|
124
|
+
"""
|
125
|
+
config.api_key = ENV['HOPTOAD_API_KEY']
|
126
|
+
"""
|
127
|
+
|
128
|
+
Scenario: Support the --app option for the Heroku addon in the generator
|
129
|
+
When I configure the ProjectlockerErrata shim
|
130
|
+
And I configure the Heroku rake shim
|
131
|
+
And I configure the Heroku gem shim with "myapikey" and multiple app support
|
132
|
+
And I configure my application to require the "projectlocker_errata" gem
|
133
|
+
And I run the projectlocker_errata generator with "--heroku -a myapp"
|
134
|
+
Then the command should have run successfully
|
135
|
+
And I should receive a ProjectlockerErrata notification
|
136
|
+
And I should see the Rails version
|
137
|
+
And my ProjectlockerErrata configuration should contain the following line:
|
138
|
+
"""
|
139
|
+
config.api_key = ENV['HOPTOAD_API_KEY']
|
140
|
+
"""
|
141
|
+
|
142
|
+
Scenario: Filtering parameters in a controller
|
143
|
+
When I configure the ProjectlockerErrata shim
|
144
|
+
And I configure usage of ProjectlockerErrata
|
145
|
+
When I configure the notifier to use the following configuration lines:
|
146
|
+
"""
|
147
|
+
config.api_key = "myapikey"
|
148
|
+
config.params_filters << "credit_card_number"
|
149
|
+
"""
|
150
|
+
And I define a response for "TestController#index":
|
151
|
+
"""
|
152
|
+
params[:credit_card_number] = "red23"
|
153
|
+
raise RuntimeError, "some message"
|
154
|
+
"""
|
155
|
+
And I route "/test/index" to "test#index"
|
156
|
+
And I perform a request to "http://example.com:123/test/index?param=value"
|
157
|
+
Then I should receive a ProjectlockerErrata notification
|
158
|
+
Then I should not see "red23"
|
159
|
+
And I should see "FILTERED"
|
160
|
+
|
161
|
+
Scenario: Filtering session in a controller
|
162
|
+
When I configure the ProjectlockerErrata shim
|
163
|
+
And I configure usage of ProjectlockerErrata
|
164
|
+
When I configure the notifier to use the following configuration lines:
|
165
|
+
"""
|
166
|
+
config.api_key = "myapikey"
|
167
|
+
config.params_filters << "secret"
|
168
|
+
"""
|
169
|
+
And I define a response for "TestController#index":
|
170
|
+
"""
|
171
|
+
session["secret"] = "blue42"
|
172
|
+
raise RuntimeError, "some message"
|
173
|
+
"""
|
174
|
+
And I route "/test/index" to "test#index"
|
175
|
+
And I perform a request to "http://example.com:123/test/index?param=value"
|
176
|
+
Then I should receive a ProjectlockerErrata notification
|
177
|
+
Then I should not see "blue42"
|
178
|
+
And I should see "FILTERED"
|
179
|
+
|
180
|
+
Scenario: Filtering session and params based on Rails parameter filters
|
181
|
+
When I configure the ProjectlockerErrata shim
|
182
|
+
And I configure usage of ProjectlockerErrata
|
183
|
+
And I configure the application to filter parameter "secret"
|
184
|
+
And I define a response for "TestController#index":
|
185
|
+
"""
|
186
|
+
params["secret"] = "red23"
|
187
|
+
session["secret"] = "blue42"
|
188
|
+
raise RuntimeError, "some message"
|
189
|
+
"""
|
190
|
+
And I route "/test/index" to "test#index"
|
191
|
+
And I perform a request to "http://example.com:123/test/index?param=value"
|
192
|
+
Then I should receive a ProjectlockerErrata notification
|
193
|
+
And I should not see "red23"
|
194
|
+
And I should not see "blue42"
|
195
|
+
And I should see "FILTERED"
|
196
|
+
|
197
|
+
Scenario: Notify projectlocker_errata within the controller
|
198
|
+
When I configure the ProjectlockerErrata shim
|
199
|
+
And I configure usage of ProjectlockerErrata
|
200
|
+
And I define a response for "TestController#index":
|
201
|
+
"""
|
202
|
+
session[:value] = "test"
|
203
|
+
notify_projectlocker_errata(RuntimeError.new("some message"))
|
204
|
+
render :nothing => true
|
205
|
+
"""
|
206
|
+
And I route "/test/index" to "test#index"
|
207
|
+
And I perform a request to "http://example.com:123/test/index?param=value"
|
208
|
+
Then I should receive a ProjectlockerErrata notification
|
209
|
+
And I should see "test"
|
210
|
+
|
211
|
+
Scenario: Reporting 404s should be disabled by default
|
212
|
+
When I configure the ProjectlockerErrata shim
|
213
|
+
And I configure usage of ProjectlockerErrata
|
214
|
+
And I perform a request to "http://example.com:123/this/route/does/not/exist"
|
215
|
+
Then I should see "The page you were looking for doesn't exist."
|
216
|
+
And I should not receive a ProjectlockerErrata notification
|
217
|
+
|
218
|
+
Scenario: Reporting 404s should work when configured properly
|
219
|
+
When I configure the ProjectlockerErrata shim
|
220
|
+
And I configure usage of ProjectlockerErrata
|
221
|
+
When I configure the notifier to use the following configuration lines:
|
222
|
+
"""
|
223
|
+
config.ignore_only = []
|
224
|
+
"""
|
225
|
+
And I perform a request to "http://example.com:123/this/route/does/not/exist"
|
226
|
+
Then I should see "The page you were looking for doesn't exist."
|
227
|
+
And I should receive a ProjectlockerErrata notification
|
228
|
+
|
229
|
+
Scenario: reporting over SSL with utf8 check should work
|
230
|
+
Given PENDING I fix this one
|
231
|
+
When I configure the ProjectlockerErrata shim
|
232
|
+
And I configure usage of ProjectlockerErrata
|
233
|
+
When I configure the notifier to use the following configuration lines:
|
234
|
+
"""
|
235
|
+
config.secure = true
|
236
|
+
"""
|
237
|
+
And I define a response for "TestController#index":
|
238
|
+
"""
|
239
|
+
raise RuntimeError, "some message"
|
240
|
+
"""
|
241
|
+
And I route "/test/index" to "test#index"
|
242
|
+
And I perform a request to "http://example.com:123/test/index?utf8=✓"
|
243
|
+
Then I should receive a ProjectlockerErrata notification
|
244
|
+
|
245
|
+
Scenario: It should also send the user details
|
246
|
+
When I configure the ProjectlockerErrata shim
|
247
|
+
And I configure usage of ProjectlockerErrata
|
248
|
+
And I define a response for "TestController#index":
|
249
|
+
"""
|
250
|
+
raise RuntimeError, "some message"
|
251
|
+
"""
|
252
|
+
And I route "/test/index" to "test#index"
|
253
|
+
And I have set up authentication system in my app that uses "current_user"
|
254
|
+
And I perform a request to "http://example.com:123/test/index"
|
255
|
+
Then I should receive a ProjectlockerErrata notification
|
256
|
+
And the ProjectlockerErrata notification should contain user details
|
257
|
+
When I have set up authentication system in my app that uses "current_member"
|
258
|
+
And I perform a request to "http://example.com:123/test/index"
|
259
|
+
Then I should receive a ProjectlockerErrata notification
|
260
|
+
And the ProjectlockerErrata notification should contain user details
|
261
|
+
|
262
|
+
Scenario: It should log the notice when failure happens
|
263
|
+
When ProjectlockerErrata server is not responding
|
264
|
+
And I configure usage of ProjectlockerErrata
|
265
|
+
And I define a response for "TestController#index":
|
266
|
+
"""
|
267
|
+
raise RuntimeError, "some message"
|
268
|
+
"""
|
269
|
+
And I route "/test/index" to "test#index"
|
270
|
+
And I perform a request to "http://example.com:123/test/index?param=value"
|
271
|
+
Then I should see "Notice details:"
|
272
|
+
And I should see "some message"
|