spec/rake/funnel/support/specs_remover_spec.rb in rake-funnel-0.18.0 vs spec/rake/funnel/support/specs_remover_spec.rb in rake-funnel-0.19.0
- old
+ new
@@ -1,95 +1,91 @@
describe Rake::Funnel::Support::SpecsRemover do
- before {
+ before do
allow(Rake::Funnel::Support::Trace).to receive(:message)
- }
+ end
describe 'removal' do
let(:projects) {}
let(:references) {}
let(:specs) {}
let(:packages) {}
- before {
+ before do
allow(File).to receive(:open)
allow(File).to receive(:write)
allow(RakeFileUtils).to receive(:rm)
- }
+ end
describe 'arguments' do
- before {
+ before do
described_class.remove(projects: projects,
references: references,
specs: specs,
packages: packages)
- }
+ end
context 'string projects' do
let(:projects) { '**/*.??proj' }
it 'should succeed' do
- expect(true).to be(true)
end
end
context 'string references' do
let(:projects) { '**/*.??proj' }
let(:references) { 'Reference' }
it 'should succeed' do
- expect(true).to be(true)
end
end
context 'string specs' do
let(:projects) { '**/*.??proj' }
let(:specs) { '*Specs.cs' }
it 'should succeed' do
- expect(true).to be(true)
end
end
context 'string packages' do
let(:packages) { 'SomePackage' }
it 'should succeed' do
- expect(true).to be(true)
end
end
end
describe 'unchanged files' do
describe Rake::Funnel::Support::SpecsRemover::ProjectFiles do
let(:projects) { '**/*.??proj' }
- before {
+ before do
allow(Dir).to receive(:[]).and_return([:some])
allow(File).to receive(:read).and_return('<root></root>')
- }
+ end
- before {
+ before do
described_class.remove_specs_and_references(projects, [], [])
- }
+ end
it 'should not write the project file' do
expect(File).not_to have_received(:open)
end
end
describe Rake::Funnel::Support::SpecsRemover::PaketReferences do
let(:projects) { %w(project.proj) }
- before {
+ before do
allow(Dir).to receive(:[]).and_return([:some])
allow(File).to receive(:exist?).and_return(true)
allow(File).to receive(:read).and_return('SomePackage')
- }
+ end
- before {
+ before do
described_class.remove_packages(projects, [])
- }
+ end
it 'should not write the project file' do
expect(File).not_to have_received(:write)
end
end
@@ -110,33 +106,33 @@
let(:specs) { %w(*Specs.cs) }
let(:packages) { %w(Explicitly-Removed-Package) }
let(:temp_dir) { Dir.mktmpdir }
- before {
+ before do
allow($stderr).to receive(:puts)
- }
+ end
- before {
+ before do
FileUtils.cp_r(File.join(example_dir(example), '.'), temp_dir)
- }
+ end
- after {
+ after do
FileUtils.rm_rf(temp_dir)
- }
+ end
context 'project' do
let(:example) { 'project' }
- before {
+ before do
Dir.chdir(temp_dir) do
described_class.remove(projects: projects,
references: references,
specs: specs,
packages: packages)
end
- }
+ end
describe 'code files' do
describe 'production code' do
it 'should be kept' do
expect(File).to exist(File.join(temp_dir, 'FooCode.cs'))
@@ -163,11 +159,13 @@
it 'should remove references' do
expect(content('Sample.csproj')).not_to include(*references)
end
it 'should remove compiled specs' do
- expect(content('Sample.csproj')).not_to include(*%w(Specs.cs SampleSpecs.cs DoesNotExistSpecs.cs))
+ expect(content('Sample.csproj')).not_to include('Specs.cs')
+ expect(content('Sample.csproj')).not_to include('SampleSpecs.cs')
+ expect(content('Sample.csproj')).not_to include('DoesNotExistSpecs.cs')
end
end
describe 'paket.references' do
describe 'for projects' do
@@ -192,18 +190,18 @@
end
context 'project-specific paket.references' do
let(:example) { 'project-specific paket.references' }
- before {
+ before do
Dir.chdir(temp_dir) do
described_class.remove(projects: projects,
references: references,
specs: specs,
packages: packages)
end
- }
+ end
describe 'paket.references' do
describe 'for project' do
it 'should remove packages' do
expect(content('Sample.csproj.paket.references')).not_to include(*(packages + references))
@@ -226,27 +224,27 @@
end
context 'multiple projects' do
let(:example) { 'multiple projects' }
- before {
+ before do
Dir.chdir(temp_dir) do
described_class.remove(projects: projects,
references: references,
specs: specs,
packages: packages)
end
- }
+ end
describe 'projects' do
it 'should remove references' do
expect(content('Sample1.csproj')).not_to include(*references)
expect(content('Sample2.csproj')).not_to include(*references)
end
it 'should remove compiled specs' do
- expect(content('Sample1.csproj')).not_to include(*%w(Specs.cs))
- expect(content('Sample2.csproj')).not_to include(*%w(Specs.cs))
+ expect(content('Sample1.csproj')).not_to include('Specs.cs')
+ expect(content('Sample2.csproj')).not_to include('Specs.cs')
end
end
end
end
end