combustion 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/HISTORY +6 -0
- data/README.md +16 -2
- data/combustion.gemspec +1 -1
- data/lib/combustion.rb +4 -1
- data/lib/combustion/application.rb +10 -5
- data/lib/combustion/database.rb +6 -1
- metadata +13 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 487efa718a0c0a0dc7bccb6199ab9aa22330fd54
|
4
|
+
data.tar.gz: 67f17279b60d5e1ea508b5638ef61b50ba32fcd4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b44177fef4256791333fc3d0674c242f932242f5428dc4cd26a1d309508e5c41466d7c143d80f7e9eb88de1c2cb7aaea147e4621232c06fd2b4641cb947e477d
|
7
|
+
data.tar.gz: c260e84e10d0082e5c86983a0c0be5e3b1f8e2831467313cd0f343daddacdca1ec49b33cf48f0bd6ebbb110a159e833489af7df8be515a55ce67d46bed633b3c
|
data/HISTORY
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
0.5.1 - July 25th 2013
|
2
|
+
* Mass assignment errors raise exceptions instead of just being logged (Pat Allan).
|
3
|
+
* whilelist_attributes is only set for Rails 3.2 apps (Philip Arndt).
|
4
|
+
* Support ActiveRecord 3.0.x (Philip Arndt).
|
5
|
+
* Allow custom application configuration (Pablo Herrero).
|
6
|
+
|
1
7
|
0.5.0 - May 1st 2013
|
2
8
|
* whitelist_attributes is now set within configure_for_combustion, as it depends on which Railties are loaded.
|
3
9
|
* Make sure Rails gems are loaded before the engine's gem (Pablo Herrero).
|
data/README.md
CHANGED
@@ -10,10 +10,10 @@ Get the gem into either your gemspec or your Gemfile, depending on how you manag
|
|
10
10
|
|
11
11
|
```ruby
|
12
12
|
# gemspec
|
13
|
-
gem.add_development_dependency 'combustion', '~> 0.
|
13
|
+
gem.add_development_dependency 'combustion', '~> 0.5.1'
|
14
14
|
|
15
15
|
# Gemfile
|
16
|
-
gem 'combustion', '~> 0.
|
16
|
+
gem 'combustion', '~> 0.5.1', :group => :test
|
17
17
|
```
|
18
18
|
|
19
19
|
In your `spec_helper.rb`, get Combustion to set itself up - which has to happen before you introduce `rspec/rails` and - if being used - `capybara/rails`. Here's an example within context:
|
@@ -127,6 +127,20 @@ end
|
|
127
127
|
|
128
128
|
Just like in a standard Rails app, if you have a mounted engine, then its routes are accessible through whatever it has been loaded as.
|
129
129
|
|
130
|
+
### Customizing Rails application settings
|
131
|
+
|
132
|
+
If you would like to specify any Rails configuration parameter, you can do it without creating any environment file, simply passing a block to Combustion.initialize! like this:
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
Combustion.initialize! :all do
|
136
|
+
config.active_record.whitelist_attributes = false
|
137
|
+
end
|
138
|
+
```
|
139
|
+
|
140
|
+
Values given through the initialize! block will be set during Rails initialization proccess, exactly before the corresponding environment file inside `spec/internals/config/enviroments` is loaded (when that file exists), overriding Combustion's defaults.
|
141
|
+
|
142
|
+
Parameters defined in, for instance, `spec/internals/config/environments/test.rb`, would override Combustion's defaults and also config settings passed to initialize!.
|
143
|
+
|
130
144
|
### Using other Rails-focused libraries
|
131
145
|
|
132
146
|
Be aware that other gems may require parts of Rails when they're loaded, and this could cause some issues with Combustion's own setup. You may need to manage the loading yourself by setting `:require` to false in your Gemfile for the gem in question, and then requiring it manually in your spec_helper. View [issue #33](https://github.com/pat/combustion/issues/33) for an example with FactoryGirl.
|
data/combustion.gemspec
CHANGED
data/lib/combustion.rb
CHANGED
@@ -3,6 +3,7 @@ require 'active_support/dependencies'
|
|
3
3
|
|
4
4
|
module Combustion
|
5
5
|
mattr_accessor :path, :schema_format
|
6
|
+
mattr_reader :setup_environment
|
6
7
|
|
7
8
|
self.path = '/spec/internal'
|
8
9
|
self.schema_format = :ruby
|
@@ -14,7 +15,9 @@ module Combustion
|
|
14
15
|
Modules = %w( active_record action_controller action_view action_mailer )
|
15
16
|
end
|
16
17
|
|
17
|
-
def self.initialize!(*modules)
|
18
|
+
def self.initialize!(*modules, &block)
|
19
|
+
@@setup_environment = block if block_given?
|
20
|
+
|
18
21
|
modules = Modules if modules == [:all]
|
19
22
|
modules.each { |mod| require "#{mod}/railtie" }
|
20
23
|
|
@@ -20,26 +20,31 @@ module Combustion
|
|
20
20
|
def self.configure_for_combustion
|
21
21
|
config.root = File.expand_path File.join(Dir.pwd, Combustion.path)
|
22
22
|
|
23
|
-
if defined?
|
23
|
+
if defined?(ActiveRecord::Railtie) && ::ActiveRecord.constants.include?(:MassAssignmentSecurity)
|
24
24
|
# Turn on ActiveRecord attribute whitelisting
|
25
25
|
# This way the dummy app matches new rails apps re: this setting
|
26
|
-
config.active_record.whitelist_attributes
|
26
|
+
config.active_record.whitelist_attributes = true
|
27
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
27
28
|
end
|
28
29
|
|
29
|
-
if defined?
|
30
|
+
if defined?(ActionController::Railtie)
|
30
31
|
config.action_dispatch.show_exceptions = false
|
31
32
|
config.action_controller.perform_caching = false
|
32
33
|
config.action_controller.allow_forgery_protection = false
|
33
34
|
end
|
34
35
|
|
35
|
-
if defined?
|
36
|
+
if defined?(ActionMailer::Railtie)
|
36
37
|
config.action_mailer.delivery_method = :test
|
37
38
|
config.action_mailer.default_url_options = {:host => 'www.example.com'}
|
38
39
|
end
|
39
40
|
|
40
|
-
if defined?
|
41
|
+
if defined?(Sprockets)
|
41
42
|
config.assets.enabled = true
|
42
43
|
end
|
43
44
|
end
|
45
|
+
|
46
|
+
initializer :load_customized_environment_for_combustion, :before => :load_environment_config, :group => :all do
|
47
|
+
Combustion::Application.class_eval(&Combustion.setup_environment) if Combustion.setup_environment
|
48
|
+
end
|
44
49
|
end
|
45
50
|
end
|
data/lib/combustion/database.rb
CHANGED
@@ -64,7 +64,12 @@ module Combustion
|
|
64
64
|
end
|
65
65
|
# Append the migrations inside the internal app's db/migrate directory
|
66
66
|
paths << File.join(Rails.root, 'db/migrate')
|
67
|
-
|
67
|
+
|
68
|
+
if ActiveRecord::VERSION::STRING >= '3.1.0'
|
69
|
+
migrator.migrate paths, nil
|
70
|
+
else
|
71
|
+
paths.each { |path| migrator.migrate path, nil }
|
72
|
+
end
|
68
73
|
end
|
69
74
|
|
70
75
|
private
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: combustion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Pat Allan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.0.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: railties
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 3.0.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 3.0.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: thor
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 0.14.6
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 0.14.6
|
62
55
|
description: Test your Rails Engines without needing a full Rails app
|
@@ -85,27 +78,25 @@ files:
|
|
85
78
|
- templates/schema.rb
|
86
79
|
homepage: https://github.com/pat/combustion
|
87
80
|
licenses: []
|
81
|
+
metadata: {}
|
88
82
|
post_install_message:
|
89
83
|
rdoc_options: []
|
90
84
|
require_paths:
|
91
85
|
- lib
|
92
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
87
|
requirements:
|
95
|
-
- -
|
88
|
+
- - '>='
|
96
89
|
- !ruby/object:Gem::Version
|
97
90
|
version: '0'
|
98
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
92
|
requirements:
|
101
|
-
- -
|
93
|
+
- - '>='
|
102
94
|
- !ruby/object:Gem::Version
|
103
95
|
version: '0'
|
104
96
|
requirements: []
|
105
97
|
rubyforge_project: combustion
|
106
|
-
rubygems_version:
|
98
|
+
rubygems_version: 2.0.2
|
107
99
|
signing_key:
|
108
|
-
specification_version:
|
100
|
+
specification_version: 4
|
109
101
|
summary: Elegant Rails Engine Testing
|
110
102
|
test_files: []
|
111
|
-
has_rdoc:
|