Class: Assert::RakeTasks::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/assert/rake_tasks/scope.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Scope

Returns a new instance of Scope.



13
14
15
16
17
18
19
20
# File 'lib/assert/rake_tasks/scope.rb', line 13

def initialize(path)
  @path = path

  @nested_files = get_nested_files
  @path_file_list = build_path_file_list
  @test_tasks = build_test_tasks
  @scopes = build_scopes
end

Instance Attribute Details

#nested_filesObject (readonly)

Returns the value of attribute nested_files.



11
12
13
# File 'lib/assert/rake_tasks/scope.rb', line 11

def nested_files
  @nested_files
end

#pathObject (readonly)

Returns the value of attribute path.



11
12
13
# File 'lib/assert/rake_tasks/scope.rb', line 11

def path
  @path
end

#path_file_listObject (readonly)

Returns the value of attribute path_file_list.



11
12
13
# File 'lib/assert/rake_tasks/scope.rb', line 11

def path_file_list
  @path_file_list
end

#scopesObject (readonly)

Returns the value of attribute scopes.



11
12
13
# File 'lib/assert/rake_tasks/scope.rb', line 11

def scopes
  @scopes
end

#test_tasksObject (readonly)

Returns the value of attribute test_tasks.



11
12
13
# File 'lib/assert/rake_tasks/scope.rb', line 11

def test_tasks
  @test_tasks
end

Class Method Details

.test_file_suffixesObject



7
8
9
# File 'lib/assert/rake_tasks/scope.rb', line 7

def self.test_file_suffixes
  ['_test.rb', '_tests.rb']
end

Instance Method Details

#namespaceObject



22
23
24
# File 'lib/assert/rake_tasks/scope.rb', line 22

def namespace
  File.basename(@path).to_sym
end

#to_test_taskObject

return a test task covering the scopes nested files plus path file but only if there are nested files



28
29
30
31
32
33
34
# File 'lib/assert/rake_tasks/scope.rb', line 28

def to_test_task
  if !self.nested_files.empty?
    TestTask.new(@path) do |tt|
      tt.files = self.path_file_list + self.nested_files
    end
  end
end