Class: Eastrails::Components::Rspec

Inherits:
Base
  • Object
show all
Defined in:
lib/eastrails/components/rspec.rb

Instance Method Summary collapse

Methods inherited from Base

#component_installed?, #dir_html_to_haml, #do_if_installed, #file_html_to_haml, #gems, #html_to_haml, #parse_gemfile

Methods inherited from Generator

#initialize

Constructor Details

This class inherits a constructor from Eastrails::Generator

Instance Method Details

#addObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/eastrails/components/rspec.rb', line 4

def add
  gem 'rspec-rails', '>= 2.11.4', :group => [:development, :test]
  gem 'database_cleaner', :group => :test
  system 'bundle install'
  system 'rails g rspec:install -f'
  inject_into_file 'spec/spec_helper.rb', :after => "RSpec.configure do |config|\n" do <<-RUBY
  config.before(:suite) do
    DatabaseCleaner.strategy = :truncation
  end
  config.before(:each) do
    DatabaseCleaner.start
  end
  config.after(:each) do
    DatabaseCleaner.clean
  end 
  RUBY
  end
end