combustion 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .rvmrc
data/HISTORY CHANGED
@@ -1,3 +1,12 @@
1
+ 0.3.3 - December 23rd 2012
2
+ * Removing version file - version number can just live in the gemspec.
3
+ * Load ActionController and ActionMailer via their Railties, not non-existent Engines (Chris Beer).
4
+ * SQL Schema support (Geoff Hodgson).
5
+ * Documentation fixes (Philip Arndt, Inge Jørgensen, Erkan Yilmaz).
6
+ * Include migrations from the internal app when migrating the database (Warren Seen).
7
+ * Correctly drop the test database when using SQLite (Warren Seen).
8
+ * Don't attempt to load sprockets for Rails 3.0.x (Alex Rozumey).
9
+
1
10
  0.3.2 - March 3rd 2011
2
11
  * Tentative Rails 3.0 and migrations support.
3
12
  * Allow for different internal app directory.
@@ -11,9 +11,9 @@ Get the gem into either your gemspec or your Gemfile, depending on how you manag
11
11
  <pre><code># gemspec
12
12
  gem.add_development_dependency 'combustion', '~> 0.3.1'
13
13
  # Gemfile
14
- gem 'combustion', '~> 0.3.1`, :group => :development</code></pre>
14
+ gem 'combustion', '~> 0.3.1', :group => :development</code></pre>
15
15
 
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:
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/rails@. Here's an example within context:
17
17
 
18
18
  <pre><code>require 'rubygems'
19
19
  require 'bundler'
@@ -39,6 +39,8 @@ bundle exec combust</code></pre>
39
39
 
40
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.
41
41
 
42
+ If you want to use Cucumber, I recommend starting with "these notes":https://github.com/pat/combustion/issues/16 from Niklas Cathor.
43
+
42
44
  h3. Configuring a different test app directory
43
45
 
44
46
  If you want your app to be located somewhere other than @spec/internal@, then make sure you configure it before you call @Combustion.initialize!@:
@@ -57,7 +59,7 @@ ActiveSupport is always loaded, as it's an integral part of Rails.
57
59
 
58
60
  h3. Using Models and ActiveRecord
59
61
 
60
- 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:
62
+ If you're using ActiveRecord, then there are two critical files within your internal Rails app at @spec/internal@ that you'll need to modify:
61
63
 
62
64
  * config/database.yml
63
65
  * db/schema.rb
@@ -72,6 +74,13 @@ Both follow the same structure as in any normal Rails application - and the sche
72
74
  end
73
75
  end</code></pre>
74
76
 
77
+ h3. Configuring Combustion to initialise the test db from a .sql file instead of schema.rb
78
+
79
+ Name the file structure.sql and configure Combustion to use it before initialising:
80
+
81
+ <pre><code>Combustion.schema_format = :sql
82
+ Combustion.initialize!</code></pre>
83
+
75
84
  Any models that aren't provided by your engine should be located at @spec/internal/app/models@.
76
85
 
77
86
  h3. Using ActionController and ActionView
@@ -96,7 +105,7 @@ Once you've got this set up, you can fire up your test environment quite easily
96
105
 
97
106
  h3. Get your test on!
98
107
 
99
- Now you're good to go - you can write specs within your engine's spec directory just like you were testing a full Rails application - models in @spec/models@, controllers in @spec/controllers@. If you bring Capybara into the mix, then the standard helpers helpers from that will be loaded as well.
108
+ Now you're good to go - you can write specs within your engine's spec directory just like you were testing a full Rails application - models in @spec/models@, controllers in @spec/controllers@. If you bring Capybara into the mix, then the standard helpers from that will be loaded as well.
100
109
 
101
110
  <pre><code>require 'spec_helper'
102
111
 
@@ -129,4 +138,4 @@ There are no tests - partly because Combustion was extracted out from the tests
129
138
 
130
139
  h2. Credits
131
140
 
132
- 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.
141
+ 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/pat/combustion/contributors.
@@ -1,10 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
3
- require 'combustion/version'
4
-
5
2
  Gem::Specification.new do |s|
6
3
  s.name = 'combustion'
7
- s.version = Combustion::VERSION
4
+ s.version = '0.3.3'
8
5
  s.authors = ['Pat Allan']
9
6
  s.email = ['pat@freelancing-gods.com']
10
7
  s.homepage = ''
@@ -1,9 +1,18 @@
1
1
  require 'rails'
2
2
  require 'active_support/dependencies'
3
3
 
4
- module Combustion
5
- Modules = %w( active_record action_controller action_view action_mailer
6
- sprockets )
4
+ module Combustion
5
+ mattr_accessor :path, :schema_format
6
+
7
+ self.path = '/spec/internal'
8
+ self.schema_format = :ruby
9
+
10
+ if Rails.version > '3.1'
11
+ Modules = %w( active_record action_controller action_view action_mailer
12
+ sprockets )
13
+ else
14
+ Modules = %w( active_record action_controller action_view action_mailer )
15
+ end
7
16
 
8
17
  def self.initialize!(*modules)
9
18
  modules = Modules if modules.empty? || modules == [:all]
@@ -26,14 +35,6 @@ module Combustion
26
35
  end if defined?(RSpec) && RSpec.respond_to?(:configure)
27
36
  end
28
37
 
29
- def self.path
30
- @path ||= 'spec/internal'
31
- end
32
-
33
- def self.path=(path)
34
- @path = path
35
- end
36
-
37
38
  def self.include_capybara_into(config)
38
39
  return unless defined?(Capybara)
39
40
 
@@ -48,4 +49,3 @@ end
48
49
 
49
50
  require 'combustion/application'
50
51
  require 'combustion/database'
51
- require 'combustion/version'
@@ -16,13 +16,13 @@ class Combustion::Application < Rails::Application
16
16
  def self.configure_for_combustion
17
17
  config.root = File.expand_path File.join(Dir.pwd, Combustion.path)
18
18
 
19
- if defined?(ActionController) && defined?(ActionController::Engine)
19
+ if defined?(ActionController) && defined?(ActionController::Railtie)
20
20
  config.action_dispatch.show_exceptions = false
21
21
  config.action_controller.perform_caching = false
22
22
  config.action_controller.allow_forgery_protection = false
23
23
  end
24
24
 
25
- if defined?(ActionMailer) && defined?(ActionMailer::Engine)
25
+ if defined?(ActionMailer) && defined?(ActionMailer::Railtie)
26
26
  config.action_mailer.delivery_method = :test
27
27
  config.action_mailer.default_url_options = {:host => 'www.example.com'}
28
28
  end
@@ -20,8 +20,8 @@ class Combustion::Database
20
20
  drop_database(abcs['test'])
21
21
  create_database(abcs['test'])
22
22
  when /sqlite/
23
- dbfile = abcs['test']['database'] || abcs['test']['dbfile']
24
- File.delete(dbfile) if File.exist?(dbfile)
23
+ drop_database(abcs['test'])
24
+ create_database(abcs['test'])
25
25
  when 'sqlserver'
26
26
  test = abcs.deep_dup['test']
27
27
  test_database = test['database']
@@ -42,17 +42,27 @@ class Combustion::Database
42
42
  end
43
43
 
44
44
  def self.load_schema
45
- load "#{Rails.root}/db/schema.rb"
45
+ case Combustion.schema_format
46
+ when :ruby
47
+ load Rails.root.join('db', 'schema.rb')
48
+ when :sql
49
+ ActiveRecord::Base.connection.execute(
50
+ File.read(Rails.root.join('db', 'structure.sql'))
51
+ )
52
+ else
53
+ raise "Unknown schema format: #{Combustion.schema_format}"
54
+ end
46
55
  end
47
56
 
48
57
  def self.migrate
49
58
  migrator = ActiveRecord::Migrator
50
- paths = 'db/migrate/'
59
+ paths = Array('db/migrate/')
51
60
 
52
61
  if migrator.respond_to?(:migrations_paths)
53
- paths = migrator.migrations_paths
62
+ paths = migrator.migrations_paths
54
63
  end
55
-
64
+ # Append the migrations inside the internal app's db/migrate directory
65
+ paths << File.join(Rails.root, 'db/migrate')
56
66
  migrator.migrate paths, nil
57
67
  end
58
68
 
metadata CHANGED
@@ -1,64 +1,56 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: combustion
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Pat Allan
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-03-03 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- type: :runtime
22
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-12-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 7
28
- segments:
29
- - 3
30
- - 0
31
- - 0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
32
21
  version: 3.0.0
33
- version_requirements: *id001
34
- prerelease: false
35
- name: rails
36
- - !ruby/object:Gem::Dependency
37
22
  type: :runtime
38
- requirement: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 43
44
- segments:
45
- - 0
46
- - 14
47
- - 6
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
48
37
  version: 0.14.6
49
- version_requirements: *id002
38
+ type: :runtime
50
39
  prerelease: false
51
- name: thor
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.14.6
52
46
  description: Test your Rails Engines without needing a full Rails app
53
- email:
47
+ email:
54
48
  - pat@freelancing-gods.com
55
- executables:
49
+ executables:
56
50
  - combust
57
51
  extensions: []
58
-
59
52
  extra_rdoc_files: []
60
-
61
- files:
53
+ files:
62
54
  - .gitignore
63
55
  - Gemfile
64
56
  - HISTORY
@@ -71,43 +63,33 @@ files:
71
63
  - lib/combustion/application.rb
72
64
  - lib/combustion/database.rb
73
65
  - lib/combustion/generator.rb
74
- - lib/combustion/version.rb
75
66
  - templates/config.ru
76
67
  - templates/database.yml
77
68
  - templates/routes.rb
78
69
  - templates/schema.rb
79
- homepage: ""
70
+ homepage: ''
80
71
  licenses: []
81
-
82
72
  post_install_message:
83
73
  rdoc_options: []
84
-
85
- require_paths:
74
+ require_paths:
86
75
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
76
+ required_ruby_version: !ruby/object:Gem::Requirement
88
77
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
96
- required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
83
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
105
88
  requirements: []
106
-
107
89
  rubyforge_project: combustion
108
- rubygems_version: 1.8.16
90
+ rubygems_version: 1.8.23
109
91
  signing_key:
110
92
  specification_version: 3
111
93
  summary: Elegant Rails Engine Testing
112
94
  test_files: []
113
-
95
+ has_rdoc:
@@ -1,3 +0,0 @@
1
- module Combustion
2
- VERSION = '0.3.2'
3
- end