From 7f49d0820dbcc016ad719e6494890d1bd7f4f3af Mon Sep 17 00:00:00 2001 From: Nathan Kleyn Date: Tue, 20 Jan 2015 22:42:54 +0000 Subject: [PATCH] Add nocov surrounds to fixtures, add notes to some tests. There are some tests that need some serious attention before moving too far forward from here. --- spec/lib/shanty/discoverer_spec.rb | 8 ++++---- spec/lib/shanty/graph_spec.rb | 5 +++++ spec/lib/shanty/shanty_file_discoverer_spec.rb | 12 ++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/spec/lib/shanty/discoverer_spec.rb b/spec/lib/shanty/discoverer_spec.rb index 74540fc..1adc40d 100644 --- a/spec/lib/shanty/discoverer_spec.rb +++ b/spec/lib/shanty/discoverer_spec.rb @@ -5,12 +5,12 @@ # All classes referenced belong to the shanty project module Shanty RSpec.describe Shanty::Discoverer do - let(:discoverers) do - Discoverer.discoverers - end + let(:discoverers) { Discoverer.discoverers } - describe '#discoervers' do + describe '#discoverers' do it 'finds all discoverers' do + # FIXME: This is not a good test. This could break any time anything requires in another discoverer. + # We should instead inspect that it contains a discoverer that we create and require within this test. expect(discoverers).to contain_exactly(Shanty::ShantyfileDiscoverer) expect(discoverers.size).to be == 1 end diff --git a/spec/lib/shanty/graph_spec.rb b/spec/lib/shanty/graph_spec.rb index d8dd726..f068879 100644 --- a/spec/lib/shanty/graph_spec.rb +++ b/spec/lib/shanty/graph_spec.rb @@ -16,7 +16,12 @@ module Shanty File.join(root, 'examples', 'test-static-project') ] end + + # We don't want the creation of the project templates to affect coverage here. + # :nocov: let(:project_templates) { project_paths.map { |project_path| ProjectTemplate.new(root, project_path) } } + # :nocov: + let(:graph) { Graph.new(project_templates) } describe 'enumerable methods' do diff --git a/spec/lib/shanty/shanty_file_discoverer_spec.rb b/spec/lib/shanty/shanty_file_discoverer_spec.rb index e03e111..4babc58 100644 --- a/spec/lib/shanty/shanty_file_discoverer_spec.rb +++ b/spec/lib/shanty/shanty_file_discoverer_spec.rb @@ -4,12 +4,7 @@ # All classes referenced belong to the shanty project module Shanty - RSpec.describe Shanty::ShantyfileDiscoverer do - let(:project_templates) do - Dir.chdir('examples') do - ShantyfileDiscoverer.new.discover - end - end + RSpec.describe(Shanty::ShantyfileDiscoverer) do let(:project1) { 'test-static-project' } let(:project2) { 'test-static-project-2' } let(:project3) { 'test-static-project-3' } @@ -22,6 +17,11 @@ module Shanty File.join(Dir.pwd, 'examples', project2, project3) ] end + let(:project_templates) do + Dir.chdir('examples') do + ShantyfileDiscoverer.new.discover + end + end describe '#discovered' do it 'finds example projects' do