Skip to content

Instantly share code, notes, and snippets.

@yltsrc
Created November 24, 2015 14:58
Show Gist options
  • Save yltsrc/216b376c972154e0ef4d to your computer and use it in GitHub Desktop.
Save yltsrc/216b376c972154e0ef4d to your computer and use it in GitHub Desktop.
require 'spec_helper'
require 'active_support/core_ext/string/inflections'
RSpec.describe 'TestSuite' do
Dir['{app,lib}/**/*.rb'].each do |filename|
context filename do
subject { filename }
let(:testfile) do
filename
.sub('app', 'spec')
.sub('lib', 'spec/lib')
.sub('.rb', '_spec.rb')
end
it 'should have tests' do
expect(File.exist?(testfile)).to be_truthy
class_name = File.basename(filename, '.rb').classify
File.open(testfile, encoding: 'utf-8') do |file|
expect(file.read).to match(class_name)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment