Skip to content

Commit

Permalink
Cleanup mspec/ospec runner to use a single array of files
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 25, 2013
1 parent 1ffe037 commit 966c655
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
13 changes: 1 addition & 12 deletions spec/ospec/main.rb.erb
@@ -1,19 +1,8 @@
<% require_asset 'spec_helper' %>

# Load all opal filters
<% Dir.glob('spec/filters/**/*.rb').each do |s| %>
<% require_asset s.sub(/^spec\//, '').sub(/\.rb$/, '') %>
<% end %>

# This file just greps for all spec files in spec/ and requires them
<% ENV['OPAL_SPEC'].split(',').each do |s| %>
<% if File.directory?(s) %>
<% Dir.glob(s + "/**/*_spec.{rb, opal}").each do |file| %>
<% require_asset file %>
<% end %>
<% else %>
<% require_asset s %>
<% end %>
<% require_asset s %>
<% end %>

# All specs have been run, so we notify mspec that we are done
Expand Down
9 changes: 7 additions & 2 deletions tasks/mspec.rake
Expand Up @@ -79,13 +79,18 @@ class RunSpec
end

def specs_to_run(file=nil)
specs = []

# add any filters in spec/filters of specs we dont want to run
specs << Dir.glob('spec/filters/**/*.rb').map { |s| s.sub(/^spec\//, '').sub(/\.rb$/, '') }

# add custom opal specs from spec/
specs = file.nil? ? ["#{Dir.pwd}/spec/"] : file
specs << (file.nil? ? Dir.glob("#{Dir.pwd}/spec/**/*_spec.{rb,opal}") : file)

# add any rubyspecs we want to run (defined in spec/rubyspecs)
specs.push File.read('spec/rubyspecs').split("\n").reject(&:empty?)

specs
specs.flatten
end

def build_specs
Expand Down

0 comments on commit 966c655

Please sign in to comment.