transferred Code Ocean from original repository to GitHub

This commit is contained in:
Hauke Klement
2015-01-22 09:51:49 +01:00
commit 4cbf9970b1
683 changed files with 11979 additions and 0 deletions

View File

@ -0,0 +1,39 @@
require 'rails/generators'
require 'generators/testing_framework_adapter_generator'
require 'rails_helper'
describe TestingFrameworkAdapterGenerator do
describe '#create_testing_framework_adapter' do
let(:name) { 'TestUnit' }
let(:path) { Rails.root.join('lib', "#{name.underscore}_adapter.rb") }
let(:spec_path) { Rails.root.join('spec', 'lib', "#{name.underscore}_adapter_spec.rb") }
before(:each) do
Rails::Generators.invoke('testing_framework_adapter', [name])
end
after(:each) do
File.delete(path)
File.delete(spec_path)
end
it 'generates a correctly named file' do
expect(File.exist?(path)).to be true
end
it 'builds a correct class skeleton' do
file_content = File.new(path, 'r').read
expect(file_content).to start_with("class #{name}Adapter < TestingFrameworkAdapter")
end
it 'generates a corresponding test' do
expect(File.exist?(spec_path)).to be true
end
it 'builds a correct test skeleton' do
file_content = File.new(spec_path, 'r').read
expect(file_content).to include("describe #{name}Adapter")
expect(file_content).to include("describe '#parse_output'")
end
end
end