Class: Teaspoon::Suite
- Inherits:
-
Object
- Object
- Teaspoon::Suite
- Defined in:
- lib/teaspoon/suite.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #include_spec?(file) ⇒ Boolean
- #include_spec_for?(file) ⇒ Boolean
-
#initialize(options = {}) ⇒ Suite
constructor
A new instance of Suite.
- #spec_assets(include_helper = true) ⇒ Object
- #spec_files ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Suite
Returns a new instance of Suite.
20 21 22 23 24 25 |
# File 'lib/teaspoon/suite.rb', line 20 def initialize( = {}) = @name = ([:suite] || :default).to_s @config = suite_configuration @env = Rails.application.assets end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
16 17 18 |
# File 'lib/teaspoon/suite.rb', line 16 def config @config end |
#name ⇒ Object
Returns the value of attribute name.
16 17 18 |
# File 'lib/teaspoon/suite.rb', line 16 def name @name end |
Class Method Details
.all ⇒ Object
4 5 6 |
# File 'lib/teaspoon/suite.rb', line 4 def self.all @all ||= Teaspoon.configuration.suite_configs.keys.map { |suite| Teaspoon::Suite.new(suite: suite) } end |
.resolve_spec_for(file) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/teaspoon/suite.rb', line 8 def self.resolve_spec_for(file) all.each do |suite| spec = suite.include_spec_for?(file) return {suite: suite.name, path: spec} if spec end false end |
Instance Method Details
#include_spec?(file) ⇒ Boolean
37 38 39 |
# File 'lib/teaspoon/suite.rb', line 37 def include_spec?(file) glob.include?(file) end |
#include_spec_for?(file) ⇒ Boolean
41 42 43 44 45 46 |
# File 'lib/teaspoon/suite.rb', line 41 def include_spec_for?(file) return file if glob.include?(file) paths = glob.select { |path| path.include?(file) } return paths unless paths.empty? false end |
#spec_assets(include_helper = true) ⇒ Object
31 32 33 34 35 |
# File 'lib/teaspoon/suite.rb', line 31 def spec_assets(include_helper = true) assets = specs assets.unshift(helper) if include_helper && helper asset_tree(assets) end |
#spec_files ⇒ Object
27 28 29 |
# File 'lib/teaspoon/suite.rb', line 27 def spec_files glob.map { |file| {path: file, name: asset_from_file(file)} } end |