combustion 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +6 -0
- data/README.textile +15 -17
- data/combustion.gemspec +1 -1
- data/lib/combustion.rb +12 -1
- data/lib/combustion/version.rb +1 -1
- data/templates/database.yml +1 -1
- metadata +7 -7
data/HISTORY
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
0.3.1 - September 12th 2011
|
2
|
+
* Allow for different versions of Capybara (Leo Liang).
|
3
|
+
* Including Capybara::DSL instead of Capybara.
|
4
|
+
* Require 3.1.0 or better.
|
5
|
+
* Allow for JRuby in the database.yml template (Philip Arndt).
|
6
|
+
|
1
7
|
0.3.0 - September 2nd 2011
|
2
8
|
* Simple generator to create a pretty minimal internal Rails app.
|
3
9
|
|
data/README.textile
CHANGED
@@ -9,9 +9,9 @@ h2. Usage
|
|
9
9
|
Get the gem into either your gemspec or your Gemfile, depending on how you manage your engine's dependencies:
|
10
10
|
|
11
11
|
<pre><code># gemspec
|
12
|
-
gem.add_development_dependency 'combustion', '~> 0.
|
12
|
+
gem.add_development_dependency 'combustion', '~> 0.3.1'
|
13
13
|
# Gemfile
|
14
|
-
gem 'combustion', '~> 0.
|
14
|
+
gem 'combustion', '~> 0.3.1`, :group => :development</code></pre>
|
15
15
|
|
16
16
|
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/rspec@. Here's an example within context:
|
17
17
|
|
@@ -20,15 +20,23 @@ require 'bundler'
|
|
20
20
|
|
21
21
|
Bundler.require :default, :development
|
22
22
|
|
23
|
+
require 'capybara/rspec'
|
24
|
+
|
23
25
|
Combustion.initialize!
|
24
26
|
|
25
27
|
require 'rspec/rails'
|
26
|
-
require 'capybara/
|
28
|
+
require 'capybara/rails'
|
27
29
|
|
28
30
|
RSpec.configure do |config|
|
29
31
|
config.use_transactional_fixtures = true
|
30
32
|
end</code></pre>
|
31
33
|
|
34
|
+
You'll also want to run the generator that creates a minimal set of files expected by Rails - run this in the directory of your engine:
|
35
|
+
|
36
|
+
<pre><code>combust
|
37
|
+
# or, if bundling with the git repo:
|
38
|
+
bundle exec combust</code></pre>
|
39
|
+
|
32
40
|
What Combustion is doing is setting up a Rails application at @spec/internal@ - but you only need to add the files within that directory that you're going to use. Read on for some detail about what that involves.
|
33
41
|
|
34
42
|
h3. Configuring which Rails modules should be loaded.
|
@@ -42,7 +50,7 @@ ActiveSupport is always loaded, as it's an integral part of Rails.
|
|
42
50
|
|
43
51
|
h3. Using Models and ActiveRecord
|
44
52
|
|
45
|
-
If you're using ActiveRecord, then there's two critical files within your internal Rails app at @spec/internal@ that you'll need to
|
53
|
+
If you're using ActiveRecord, then there's two critical files within your internal Rails app at @spec/internal@ that you'll need to modify:
|
46
54
|
|
47
55
|
* config/database.yml
|
48
56
|
* db/schema.rb
|
@@ -63,7 +71,7 @@ h3. Using ActionController and ActionView
|
|
63
71
|
|
64
72
|
You'll only need to add controllers and views to your internal Rails app for whatever you're testing that your engine doesn't provide - this may be nothing at all, so perhaps you don't even need @spec/internal/app/views@ or @spec/internal/app/controllers@ directories.
|
65
73
|
|
66
|
-
However, if you're doing any testing of your engine's controllers or views, then you're going to need routes set up for them - so
|
74
|
+
However, if you're doing any testing of your engine's controllers or views, then you're going to need routes set up for them - so modify @spec/internal/config/routes.rb@ accordingly:
|
67
75
|
|
68
76
|
<pre><code>Rails.application.routes.draw do
|
69
77
|
resources :pages
|
@@ -77,15 +85,7 @@ Your tests will execute within the test environment for the internal Rails app -
|
|
77
85
|
|
78
86
|
h3. Rack it up
|
79
87
|
|
80
|
-
Once you've got this set up, you can fire up your test environment quite easily with Rack -
|
81
|
-
|
82
|
-
<pre><code>require 'rubygems'
|
83
|
-
require 'bundler'
|
84
|
-
|
85
|
-
Bundler.require :default, :development
|
86
|
-
|
87
|
-
Combustion.initialize!
|
88
|
-
run Combustion::Application</code></pre>
|
88
|
+
Once you've got this set up, you can fire up your test environment quite easily with Rack - a @config.ru@ file is provided by the generator. Just run @rackup@ and visit "http://localhost:9292":http://localhost:9292.
|
89
89
|
|
90
90
|
h3. Get your test on!
|
91
91
|
|
@@ -109,8 +109,6 @@ h2. Limitations and Known Issues
|
|
109
109
|
|
110
110
|
Combustion is currently written with the expectation it'll be used with RSpec. I'd love to make this more flexible - if you want to give it a shot before I get around to it, patches are very much welcome.
|
111
111
|
|
112
|
-
I'm also keen to have a generator that adds the standard set of files and folders (@config/database.yml@, @config/routes.rb@, @db/schema.rb@, @log@) into @spec/internal@, just to make it even easier to get going. Again, patches are welcome for this, but I'll likely get to it pretty soon.
|
113
|
-
|
114
112
|
I've not tried using this with Cucumber, but it should work in theory without too much hassle. Let me know if I'm wrong!
|
115
113
|
|
116
114
|
h2. Contributing
|
@@ -124,4 +122,4 @@ There are no tests - partly because Combustion was extracted out from the tests
|
|
124
122
|
|
125
123
|
h2. Credits
|
126
124
|
|
127
|
-
Copyright (c) 2011, Combustion is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to HyperTiny for encouraging its development.
|
125
|
+
Copyright (c) 2011, Combustion is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to HyperTiny for encouraging its development, and "all who have contributed patches":https://github.com/freelancing-god/combustion/contributors.
|
data/combustion.gemspec
CHANGED
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ['lib']
|
20
20
|
|
21
|
-
s.add_runtime_dependency 'rails', '>= 3.1.0
|
21
|
+
s.add_runtime_dependency 'rails', '>= 3.1.0'
|
22
22
|
s.add_runtime_dependency 'thor', '>= 0.14.6'
|
23
23
|
end
|
data/lib/combustion.rb
CHANGED
@@ -17,12 +17,23 @@ module Combustion
|
|
17
17
|
end
|
18
18
|
|
19
19
|
RSpec.configure do |config|
|
20
|
-
config
|
20
|
+
include_capybara_into config
|
21
21
|
|
22
22
|
config.include(Combustion::Application.routes.url_helpers)
|
23
23
|
config.include(Combustion::Application.routes.mounted_helpers)
|
24
24
|
end if defined?(RSpec) && RSpec.respond_to?(:configure)
|
25
25
|
end
|
26
|
+
|
27
|
+
def self.include_capybara_into(config)
|
28
|
+
return unless defined?(Capybara)
|
29
|
+
|
30
|
+
config.include Capybara::RSpecMatchers if defined?(Capybara::RSpecMatchers)
|
31
|
+
config.include Capybara::DSL if defined?(Capybara::DSL)
|
32
|
+
|
33
|
+
unless defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL)
|
34
|
+
config.include Capybara
|
35
|
+
end
|
36
|
+
end
|
26
37
|
end
|
27
38
|
|
28
39
|
require 'combustion/application'
|
data/lib/combustion/version.rb
CHANGED
data/templates/database.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: combustion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152618140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.1.0
|
21
|
+
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152618140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152617480 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.14.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152617480
|
36
36
|
description: Test your Rails Engines without needing a full Rails app
|
37
37
|
email:
|
38
38
|
- pat@freelancing-gods.com
|