README.textile in combustion-0.3.0 vs README.textile in combustion-0.3.1

- old
+ new

@@ -7,30 +7,38 @@ h2. Usage Get the gem into either your gemspec or your Gemfile, depending on how you manage your engine's dependencies: <pre><code># gemspec -gem.add_development_dependency 'combustion', '~> 0.2.0' +gem.add_development_dependency 'combustion', '~> 0.3.1' # Gemfile -gem 'combustion', '~> 0.2.0`, :group => :development</code></pre> +gem 'combustion', '~> 0.3.1`, :group => :development</code></pre> 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: <pre><code>require 'rubygems' require 'bundler' Bundler.require :default, :development +require 'capybara/rspec' + Combustion.initialize! require 'rspec/rails' -require 'capybara/rspec' +require 'capybara/rails' RSpec.configure do |config| config.use_transactional_fixtures = true end</code></pre> +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: + +<pre><code>combust +# or, if bundling with the git repo: +bundle exec combust</code></pre> + 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. h3. Configuring which Rails modules should be loaded. By default, Combustion assumes you want the full Rails stack. You can customise this though - just pass in what you'd like loaded to the @Combustion.initialize!@ call: @@ -40,11 +48,11 @@ ActiveSupport is always loaded, as it's an integral part of Rails. h3. Using Models and ActiveRecord -If you're using ActiveRecord, then there's two critical files within your internal Rails app at @spec/internal@ that you'll need to create: +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: * config/database.yml * db/schema.rb Both follow the same structure as in any normal Rails application - and the schema file lets you avoid migrations, as it gets run whenever the test suite starts. Here's a quick sample (note that tables are overwritten if they already exist - this is necessary): @@ -61,11 +69,11 @@ h3. Using ActionController and ActionView 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. -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 create a standard routes file at @spec/internal/config/routes.rb@: +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: <pre><code>Rails.application.routes.draw do resources :pages end</code></pre> @@ -75,20 +83,12 @@ Your tests will execute within the test environment for the internal Rails app - and so logs are available at @spec/internal/log/test.log@. You should probably create that log directory so Rails doesn't complain. h3. Rack it up -Once you've got this set up, you can fire up your test environment quite easily with Rack - here's an example @config.ru@ file that could live in the root of your engine folder: +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. -<pre><code>require 'rubygems' -require 'bundler' - -Bundler.require :default, :development - -Combustion.initialize! -run Combustion::Application</code></pre> - h3. Get your test on! 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. <pre><code>require 'spec_helper' @@ -107,12 +107,10 @@ h2. Limitations and Known Issues 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. -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. - 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! h2. Contributing Contributions are very much welcome - but keep in mind the following: @@ -122,6 +120,6 @@ There are no tests - partly because Combustion was extracted out from the tests of HyperTiny's Dobro, and partly because there's not much code. Still, if you can find a clean way of testing this, that'd be fantastic. h2. Credits -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. +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.