Module: Bones::Rspec::RspecVersion1
- Extended by:
- RspecVersion1
- Includes:
- Helpers
- Included in:
- RspecVersion1
- Defined in:
- lib/bones/rspec/rspec_version1.rb
Instance Method Summary collapse
Instance Method Details
#define_tasks ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/bones/rspec/rspec_version1.rb', line 42 def define_tasks config = ::Bones.config namespace :spec do desc 'Run all specs with basic output' Spec::Rake::SpecTask.new(:run) do |t| t.ruby_opts = config.ruby_opts t.spec_opts = config.spec.opts unless config.spec.opts.empty? t.spec_files = config.spec.files t.libs += config.libs end if have? :rcov require 'spec/rake/verify_rcov' desc 'Run all specs with Rcov' Spec::Rake::SpecTask.new(:rcov) do |t| t.ruby_opts = config.ruby_opts t.spec_opts = config.spec.opts unless config.spec.opts.empty? t.spec_files = config.spec.files t.libs += config.libs t.rcov = true t.rcov_dir = config.rcov.dir t.rcov_opts.concat(config.rcov.opts) end RCov::VerifyTask.new(:verify) do |t| t.threshold = config.rcov.threshold t.index_html = File.join(config.rcov.dir, 'index.html') t.require_exact_threshold = config.rcov.threshold_exact end task :verify => :rcov remove_desc_for_task %w(spec:clobber_rcov) end end # namespace :spec desc 'Alias to spec:run' task :spec => 'spec:run' task :clobber => 'spec:clobber_rcov' if have? :rcov end |
#initialize_rspec ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bones/rspec/rspec_version1.rb', line 8 def initialize_rspec require 'spec/rake/spectask' ::Bones.config { desc 'Configuration settings for the RSpec test framework.' spec { files FileList['spec/**/*_spec.rb'], :desc => <<-__ The list of spec files to run. This defaults to all the ruby fines in the 'spec' directory that end with '_spec.rb' as their filename. __ opts [], :desc => <<-__ An array of command line options that will be passed to the rspec command when running your tests. See the RSpec help documentation either online or from the command line by running 'spec --help'. Options can also be defined in the "spec/spec.opts" file. Please leave this opts array empty if you prefer to use the spec.opts file instead. However, both can be used in conjunction; watch out for options colliions. __ } } return true rescue LoadError return false end |
#post_load ⇒ Object
37 38 39 40 |
# File 'lib/bones/rspec/rspec_version1.rb', line 37 def post_load config = ::Bones.config have?(:rspec) { !config.spec.files.to_a.empty? } end |