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_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.
19 20 21 22 23 24 |
# File 'lib/teaspoon/suite.rb', line 19 def initialize( = {}) @options = @name = (@options[:suite] || :default).to_s @config = suite_configuration @env = Rails.application.assets end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
15 16 17 |
# File 'lib/teaspoon/suite.rb', line 15 def config @config end |
#name ⇒ Object
Returns the value of attribute name.
15 16 17 |
# File 'lib/teaspoon/suite.rb', line 15 def name @name end |
Class Method Details
.all ⇒ Object
3 4 5 |
# File 'lib/teaspoon/suite.rb', line 3 def self.all @all ||= Teaspoon.configuration.suite_configs.keys.map { |suite| Teaspoon::Suite.new(suite: suite) } end |
.resolve_spec_for(file) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/teaspoon/suite.rb', line 7 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_for?(file) ⇒ Boolean
36 37 38 39 40 41 |
# File 'lib/teaspoon/suite.rb', line 36 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
30 31 32 33 34 |
# File 'lib/teaspoon/suite.rb', line 30 def spec_assets(include_helper = true) assets = specs assets.unshift(helper) if include_helper && helper asset_tree(assets) end |
#spec_files ⇒ Object
26 27 28 |
# File 'lib/teaspoon/suite.rb', line 26 def spec_files glob.map { |file| { path: file, name: asset_from_file(file) } } end |