Class: Embryo::Rspec
- Inherits:
-
Object
- Object
- Embryo::Rspec
- Defined in:
- lib/embryo/rspec.rb
Instance Method Summary collapse
-
#initialize(filesystem) ⇒ Rspec
constructor
A new instance of Rspec.
- #install ⇒ Object
- #rails_helper_data ⇒ Object
- #spec_helper_data ⇒ Object
Constructor Details
#initialize(filesystem) ⇒ Rspec
Returns a new instance of Rspec.
3 4 5 |
# File 'lib/embryo/rspec.rb', line 3 def initialize(filesystem) @filesystem = filesystem end |
Instance Method Details
#install ⇒ Object
7 8 9 10 11 |
# File 'lib/embryo/rspec.rb', line 7 def install @filesystem.require_gem "rspec-rails", "~> 3.0", group: :test @filesystem.write "spec/spec_helper.rb", spec_helper_data @filesystem.write "spec/rails_helper.rb", rails_helper_data end |
#rails_helper_data ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/embryo/rspec.rb', line 24 def rails_helper_data 'ENV["RAILS_ENV"] ||= "test" require "spec_helper" require File.expand_path("../../config/environment", __FILE__) require "rspec/rails" Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| config.use_transactional_fixtures = true config.infer_spec_type_from_file_location! end ' end |
#spec_helper_data ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/embryo/rspec.rb', line 13 def spec_helper_data 'RSpec.configure do |config| config.color = true config.order = :random config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end end ' end |