raygun 0.0.7 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/raygun/app_builder.rb +37 -6
- data/lib/raygun/version.rb +1 -1
- data/raygun.gemspec +1 -1
- data/templates/Gemfile_customized +2 -2
- data/templates/_lib/tasks/coverage.rake +1 -3
- data/templates/_lib/tasks/spec.rake +26 -12
- data/templates/_lib/templates/rspec/scaffold/controller_spec.rb +17 -15
- data/templates/_spec/{requests → features}/user_sessions_spec.rb +0 -1
- data/templates/_spec/support/{user_sessions_request_helper.rb → user_sessions_feature_helper.rb} +2 -2
- metadata +8 -9
- data/templates/_spec/support/simplecov.rb +0 -25
data/lib/raygun/app_builder.rb
CHANGED
@@ -235,11 +235,11 @@ RUBY
|
|
235
235
|
copy_file '_app/views/user_sessions/new.html.slim',
|
236
236
|
'app/views/user_sessions/new.html.slim'
|
237
237
|
|
238
|
-
copy_file '_spec/support/
|
239
|
-
'spec/support/
|
238
|
+
copy_file '_spec/support/user_sessions_feature_helper.rb',
|
239
|
+
'spec/support/user_sessions_feature_helper.rb'
|
240
240
|
|
241
|
-
copy_file '_spec/
|
242
|
-
'spec/
|
241
|
+
copy_file '_spec/features/user_sessions_spec.rb',
|
242
|
+
'spec/features/user_sessions_spec.rb'
|
243
243
|
|
244
244
|
copy_file '_app/controllers/registrations_controller.rb',
|
245
245
|
'app/controllers/registrations_controller.rb'
|
@@ -270,12 +270,43 @@ RUBY
|
|
270
270
|
|
271
271
|
def setup_simplecov
|
272
272
|
copy_file '_lib/tasks/coverage.rake', 'lib/tasks/coverage.rake'
|
273
|
-
|
273
|
+
|
274
|
+
coverage = <<-RUBY
|
275
|
+
# Coverage must be enabled before the application is loaded.
|
276
|
+
if ENV['COVERAGE']
|
277
|
+
require 'simplecov'
|
278
|
+
|
279
|
+
# Writes the coverage stat to a file to be used by Cane.
|
280
|
+
class SimpleCov::Formatter::QualityFormatter
|
281
|
+
def format(result)
|
282
|
+
SimpleCov::Formatter::HTMLFormatter.new.format(result)
|
283
|
+
File.open('coverage/covered_percent', 'w') do |f|
|
284
|
+
f.puts result.source_files.covered_percent.to_f
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
SimpleCov.formatter = SimpleCov::Formatter::QualityFormatter
|
289
|
+
|
290
|
+
SimpleCov.start do
|
291
|
+
add_filter '/spec/'
|
292
|
+
add_filter '/config/'
|
293
|
+
add_filter '/vendor/'
|
294
|
+
add_group 'Models', 'app/models'
|
295
|
+
add_group 'Controllers', 'app/controllers'
|
296
|
+
add_group 'Helpers', 'app/helpers'
|
297
|
+
add_group 'Views', 'app/views'
|
298
|
+
add_group 'Mailers', 'app/mailers'
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
RUBY
|
303
|
+
|
304
|
+
prepend_to_file 'spec/spec_helper.rb', coverage
|
274
305
|
end
|
275
306
|
|
276
307
|
def setup_default_rake_task
|
277
308
|
append_file 'Rakefile' do
|
278
|
-
"\ntask(:default).clear\ntask default:
|
309
|
+
"\ntask(:default).clear\ntask default: 'spec'"
|
279
310
|
end
|
280
311
|
end
|
281
312
|
|
data/lib/raygun/version.rb
CHANGED
data/raygun.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency 'rails', '3.2.
|
21
|
+
gem.add_dependency 'rails', '~> 3.2.9'
|
22
22
|
gem.add_dependency 'bundler', '>= 1.2'
|
23
23
|
gem.add_dependency 'rvm', '>= 1.11.3.5'
|
24
24
|
gem.add_dependency 'hash_syntax', '>= 1.0'
|
@@ -21,8 +21,8 @@ group :assets do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
group :test, :development do
|
24
|
-
gem 'rspec-rails'
|
25
|
-
gem 'capybara',
|
24
|
+
gem 'rspec-rails', '~> 2.12.0'
|
25
|
+
gem 'capybara', '2.0.0' # waiting for https://github.com/jnicklas/capybara/issues/882
|
26
26
|
gem 'factory_girl_rails'
|
27
27
|
gem 'jasminerice'
|
28
28
|
gem 'timecop'
|
@@ -3,10 +3,8 @@ namespace :spec do
|
|
3
3
|
ENV['COVERAGE'] = '1'
|
4
4
|
end
|
5
5
|
|
6
|
-
desc
|
6
|
+
desc "Executes specs with code coverage reports"
|
7
7
|
task coverage: :enable_coverage do
|
8
8
|
Rake::Task[:spec].invoke
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
12
|
-
Rake::Task['spec'].enhance ['spec:enable_coverage']
|
@@ -1,18 +1,32 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'guard/jasmine/task'
|
2
3
|
|
3
|
-
namespace :spec do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
namespace :spec do
|
5
|
+
desc "Run all javascript specs"
|
6
|
+
task :javascripts do
|
7
|
+
begin
|
8
|
+
::Guard::Jasmine::CLI.start([])
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
rescue SystemExit => e
|
11
|
+
case e.status
|
12
|
+
when 1
|
13
|
+
fail "Some specs have failed."
|
14
|
+
when 2
|
15
|
+
fail "The spec couldn't be run: #{e.message}."
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
20
|
+
|
21
|
+
Rake::Task['spec'].enhance do
|
22
|
+
Rake::Task['spec:javascripts'].invoke
|
23
|
+
end
|
24
|
+
|
25
|
+
rescue LoadError
|
26
|
+
namespace :spec do
|
27
|
+
task :javascripts do
|
28
|
+
puts "Guard is not available in this environment: #{Rails.env}."
|
29
|
+
end
|
30
|
+
end
|
18
31
|
end
|
32
|
+
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
<% module_namespacing do -%>
|
3
4
|
describe <%= controller_class_name %>Controller do
|
4
5
|
|
5
6
|
# This should return the minimal set of attributes required to create a valid
|
@@ -33,7 +34,7 @@ describe <%= controller_class_name %>Controller do
|
|
33
34
|
describe "GET show" do
|
34
35
|
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
35
36
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
36
|
-
get :show, {:id => <%= file_name %>.to_param}, valid_session
|
37
|
+
get :show, { :id => <%= file_name %>.to_param }, valid_session
|
37
38
|
assigns(:<%= ns_file_name %>).should eq(<%= file_name %>)
|
38
39
|
end
|
39
40
|
end
|
@@ -48,7 +49,7 @@ describe <%= controller_class_name %>Controller do
|
|
48
49
|
describe "GET edit" do
|
49
50
|
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
50
51
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
51
|
-
get :edit, {:id => <%= file_name %>.to_param}, valid_session
|
52
|
+
get :edit, { :id => <%= file_name %>.to_param }, valid_session
|
52
53
|
assigns(:<%= ns_file_name %>).should eq(<%= file_name %>)
|
53
54
|
end
|
54
55
|
end
|
@@ -57,18 +58,18 @@ describe <%= controller_class_name %>Controller do
|
|
57
58
|
describe "with valid params" do
|
58
59
|
it "creates a new <%= class_name %>" do
|
59
60
|
expect {
|
60
|
-
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
|
61
|
+
post :create, { :<%= ns_file_name %> => valid_attributes }, valid_session
|
61
62
|
}.to change(<%= class_name %>, :count).by(1)
|
62
63
|
end
|
63
64
|
|
64
65
|
it "assigns a newly created <%= ns_file_name %> as @<%= ns_file_name %>" do
|
65
|
-
post :create,
|
66
|
+
post :create, {:<%= ns_file_name %> => valid_attributes }, valid_session
|
66
67
|
assigns(:<%= ns_file_name %>).should be_a(<%= class_name %>)
|
67
68
|
assigns(:<%= ns_file_name %>).should be_persisted
|
68
69
|
end
|
69
70
|
|
70
71
|
it "redirects to the created <%= ns_file_name %>" do
|
71
|
-
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
|
72
|
+
post :create, { :<%= ns_file_name %> => valid_attributes }, valid_session
|
72
73
|
response.should redirect_to(<%= class_name %>.last)
|
73
74
|
end
|
74
75
|
end
|
@@ -77,14 +78,14 @@ describe <%= controller_class_name %>Controller do
|
|
77
78
|
it "assigns a newly created but unsaved <%= ns_file_name %> as @<%= ns_file_name %>" do
|
78
79
|
# Trigger the behavior that occurs when invalid params are submitted
|
79
80
|
<%= class_name %>.any_instance.stub(:save).and_return(false)
|
80
|
-
post :create, {:<%= ns_file_name %> =>
|
81
|
+
post :create, { :<%= ns_file_name %> => <%= formatted_hash(example_invalid_attributes) %> }, valid_session
|
81
82
|
assigns(:<%= ns_file_name %>).should be_a_new(<%= class_name %>)
|
82
83
|
end
|
83
84
|
|
84
85
|
it "re-renders the 'new' template" do
|
85
86
|
# Trigger the behavior that occurs when invalid params are submitted
|
86
87
|
<%= class_name %>.any_instance.stub(:save).and_return(false)
|
87
|
-
post :create, {:<%= ns_file_name %> =>
|
88
|
+
post :create, { :<%= ns_file_name %> => <%= formatted_hash(example_invalid_attributes) %> }, valid_session
|
88
89
|
response.should render_template("new")
|
89
90
|
end
|
90
91
|
end
|
@@ -98,19 +99,19 @@ describe <%= controller_class_name %>Controller do
|
|
98
99
|
# specifies that the <%= class_name %> created on the previous line
|
99
100
|
# receives the :update_attributes message with whatever params are
|
100
101
|
# submitted in the request.
|
101
|
-
<%= class_name %>.any_instance.should_receive(:update_attributes).with(<%=
|
102
|
-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => <%=
|
102
|
+
<%= class_name %>.any_instance.should_receive(:update_attributes).with(<%= formatted_hash(example_params_for_update) %>)
|
103
|
+
put :update, { :id => <%= file_name %>.to_param, :<%= ns_file_name %> => <%= formatted_hash(example_params_for_update) %> }, valid_session
|
103
104
|
end
|
104
105
|
|
105
106
|
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
106
107
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
107
|
-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
|
108
|
+
put :update, { :id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes }, valid_session
|
108
109
|
assigns(:<%= ns_file_name %>).should eq(<%= file_name %>)
|
109
110
|
end
|
110
111
|
|
111
112
|
it "redirects to the <%= ns_file_name %>" do
|
112
113
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
113
|
-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
|
114
|
+
put :update, { :id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes }, valid_session
|
114
115
|
response.should redirect_to(<%= file_name %>)
|
115
116
|
end
|
116
117
|
end
|
@@ -120,7 +121,7 @@ describe <%= controller_class_name %>Controller do
|
|
120
121
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
121
122
|
# Trigger the behavior that occurs when invalid params are submitted
|
122
123
|
<%= class_name %>.any_instance.stub(:save).and_return(false)
|
123
|
-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> =>
|
124
|
+
put :update, { :id => <%= file_name %>.to_param, :<%= ns_file_name %> => <%= formatted_hash(example_invalid_attributes) %> }, valid_session
|
124
125
|
assigns(:<%= ns_file_name %>).should eq(<%= file_name %>)
|
125
126
|
end
|
126
127
|
|
@@ -128,7 +129,7 @@ describe <%= controller_class_name %>Controller do
|
|
128
129
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
129
130
|
# Trigger the behavior that occurs when invalid params are submitted
|
130
131
|
<%= class_name %>.any_instance.stub(:save).and_return(false)
|
131
|
-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> =>
|
132
|
+
put :update, { :id => <%= file_name %>.to_param, :<%= ns_file_name %> => <%= formatted_hash(example_invalid_attributes) %> }, valid_session
|
132
133
|
response.should render_template("edit")
|
133
134
|
end
|
134
135
|
end
|
@@ -138,15 +139,16 @@ describe <%= controller_class_name %>Controller do
|
|
138
139
|
it "destroys the requested <%= ns_file_name %>" do
|
139
140
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
140
141
|
expect {
|
141
|
-
delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
|
142
|
+
delete :destroy, { :id => <%= file_name %>.to_param }, valid_session
|
142
143
|
}.to change(<%= class_name %>, :count).by(-1)
|
143
144
|
end
|
144
145
|
|
145
146
|
it "redirects to the <%= table_name %> list" do
|
146
147
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
147
|
-
delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
|
148
|
+
delete :destroy, { :id => <%= file_name %>.to_param }, valid_session
|
148
149
|
response.should redirect_to(<%= index_helper %>_url)
|
149
150
|
end
|
150
151
|
end
|
151
152
|
|
152
153
|
end
|
154
|
+
<% end -%>
|
data/templates/_spec/support/{user_sessions_request_helper.rb → user_sessions_feature_helper.rb}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module UserSessionsFeatureHelper
|
2
2
|
|
3
3
|
def sign_in(email, password)
|
4
4
|
visit sign_in_path
|
@@ -17,5 +17,5 @@ module UserSessionsRequestHelper
|
|
17
17
|
end
|
18
18
|
|
19
19
|
RSpec.configure do |config|
|
20
|
-
config.include
|
20
|
+
config.include UserSessionsFeatureHelper, type: :feature
|
21
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.
|
21
|
+
version: 3.2.9
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.
|
29
|
+
version: 3.2.9
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bundler
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,18 +140,17 @@ files:
|
|
140
140
|
- templates/_lib/templates/slim/scaffold/show.html.slim
|
141
141
|
- templates/_public/index.html.erb
|
142
142
|
- templates/_spec/factories/users.rb
|
143
|
+
- templates/_spec/features/user_sessions_spec.rb
|
143
144
|
- templates/_spec/javascripts/example_spec.js.coffee
|
144
145
|
- templates/_spec/javascripts/spec.css
|
145
146
|
- templates/_spec/javascripts/spec.js.coffee
|
146
147
|
- templates/_spec/mailers/user_mailer_spec.rb
|
147
148
|
- templates/_spec/models/ability_spec.rb
|
148
149
|
- templates/_spec/models/user_spec.rb
|
149
|
-
- templates/_spec/requests/user_sessions_spec.rb
|
150
150
|
- templates/_spec/support/accept_values.rb
|
151
151
|
- templates/_spec/support/factory_girl.rb
|
152
|
-
- templates/_spec/support/simplecov.rb
|
153
152
|
- templates/_spec/support/sorcery.rb
|
154
|
-
- templates/_spec/support/
|
153
|
+
- templates/_spec/support/user_sessions_feature_helper.rb
|
155
154
|
- templates/rbenv-version.erb
|
156
155
|
- templates/rvmrc.erb
|
157
156
|
homepage: https://github.com/carbonfive/raygun
|
@@ -1,25 +0,0 @@
|
|
1
|
-
if ENV['COVERAGE']
|
2
|
-
require 'simplecov'
|
3
|
-
|
4
|
-
# Writes the coverage stat to a file to be used by Cane.
|
5
|
-
class SimpleCov::Formatter::QualityFormatter
|
6
|
-
def format(result)
|
7
|
-
SimpleCov::Formatter::HTMLFormatter.new.format(result)
|
8
|
-
File.open("coverage/covered_percent", "w") do |f|
|
9
|
-
f.puts result.source_files.covered_percent.to_f
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
SimpleCov.formatter = SimpleCov::Formatter::QualityFormatter
|
14
|
-
|
15
|
-
SimpleCov.start do
|
16
|
-
add_filter '/spec/'
|
17
|
-
add_filter '/config/'
|
18
|
-
add_filter '/vendor/'
|
19
|
-
add_group 'Models', 'app/models'
|
20
|
-
add_group 'Controllers', 'app/controllers'
|
21
|
-
add_group 'Helpers', 'app/helpers'
|
22
|
-
add_group 'Views', 'app/views'
|
23
|
-
add_group 'Mailers', 'app/mailers'
|
24
|
-
end
|
25
|
-
end
|