Class: Teaspoon::Configuration::Suite
- Inherits:
-
Object
- Object
- Teaspoon::Configuration::Suite
- Defined in:
- lib/teaspoon/deprecated.rb,
lib/teaspoon/configuration.rb
Constant Summary collapse
- FRAMEWORKS =
{ jasmine: ["1.3.1", "2.0.0"], mocha: ["1.10.0", "1.17.1"], qunit: ["1.12.0", "1.14.0"], angular: ["1.0.5"], }
Instance Attribute Summary collapse
-
#body_partial ⇒ Object
Returns the value of attribute body_partial.
-
#boot_partial ⇒ Object
Returns the value of attribute boot_partial.
-
#helper ⇒ Object
Returns the value of attribute helper.
-
#hooks ⇒ Object
Returns the value of attribute hooks.
-
#javascripts ⇒ Object
Returns the value of attribute javascripts.
-
#matcher ⇒ Object
Returns the value of attribute matcher.
-
#no_coverage ⇒ Object
Returns the value of attribute no_coverage.
-
#stylesheets ⇒ Object
Returns the value of attribute stylesheets.
Instance Method Summary collapse
- #hook(group = :default, &block) ⇒ Object
-
#initialize {|_self| ... } ⇒ Suite
constructor
A new instance of Suite.
- #js_config=(*args) ⇒ Object
- #normalize_asset_path=(*args) ⇒ Object
- #use_framework(name, version = nil) ⇒ Object (also: #use_framework=)
Constructor Details
#initialize {|_self| ... } ⇒ Suite
Returns a new instance of Suite.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/teaspoon/configuration.rb', line 76 def initialize @matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}" @helper = "spec_helper" @javascripts = ["jasmine/1.3.1", "teaspoon-jasmine"] @stylesheets = ["teaspoon"] @boot_partial = "boot" @body_partial = "body" @no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}] @hooks = Hash.new{ |h, k| h[k] = [] } default = Teaspoon.configuration.suite_configs["default"] self.instance_eval(&default[:block]) if default yield self if block_given? end |
Instance Attribute Details
#body_partial ⇒ Object
Returns the value of attribute body_partial.
71 72 73 |
# File 'lib/teaspoon/configuration.rb', line 71 def body_partial @body_partial end |
#boot_partial ⇒ Object
Returns the value of attribute boot_partial.
71 72 73 |
# File 'lib/teaspoon/configuration.rb', line 71 def boot_partial @boot_partial end |
#helper ⇒ Object
Returns the value of attribute helper.
71 72 73 |
# File 'lib/teaspoon/configuration.rb', line 71 def helper @helper end |
#hooks ⇒ Object
Returns the value of attribute hooks.
71 72 73 |
# File 'lib/teaspoon/configuration.rb', line 71 def hooks @hooks end |
#javascripts ⇒ Object
Returns the value of attribute javascripts.
71 72 73 |
# File 'lib/teaspoon/configuration.rb', line 71 def javascripts @javascripts end |
#matcher ⇒ Object
Returns the value of attribute matcher.
71 72 73 |
# File 'lib/teaspoon/configuration.rb', line 71 def matcher @matcher end |
#no_coverage ⇒ Object
Returns the value of attribute no_coverage.
71 72 73 |
# File 'lib/teaspoon/configuration.rb', line 71 def no_coverage @no_coverage end |
#stylesheets ⇒ Object
Returns the value of attribute stylesheets.
71 72 73 |
# File 'lib/teaspoon/configuration.rb', line 71 def stylesheets @stylesheets end |
Instance Method Details
#hook(group = :default, &block) ⇒ Object
113 114 115 |
# File 'lib/teaspoon/configuration.rb', line 113 def hook(group = :default, &block) @hooks[group.to_s] << block end |
#js_config=(*args) ⇒ Object
56 57 58 |
# File 'lib/teaspoon/deprecated.rb', line 56 def js_config=(*args) Teaspoon.dep("the teaspoon suite js_config directive is no longer used, use the install generator to install the boot partial and customize it instead.", :js_config) end |
#normalize_asset_path=(*args) ⇒ Object
60 61 62 |
# File 'lib/teaspoon/deprecated.rb', line 60 def normalize_asset_path=(*args) Teaspoon.dep("the teaspoon suite normalize_asset_path directive is no longer used, reopen Teaspoon::Suite and define a normalize_js_extension method instead.", :normalize_asset_path) end |
#use_framework(name, version = nil) ⇒ Object Also known as: use_framework=
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/teaspoon/configuration.rb', line 94 def use_framework(name, version = nil) name = name.to_sym version ||= FRAMEWORKS[name].last if FRAMEWORKS[name] unless FRAMEWORKS[name] && FRAMEWORKS[name].include?(version) = "Unknown framework \"#{name}\"" += " with version #{version} -- available versions #{FRAMEWORKS[name].join(", ")}" if FRAMEWORKS[name] && version raise Teaspoon::UnknownFramework, end @javascripts = [[name, version].join("/"), "teaspoon-#{name}"] case name.to_sym when :qunit @matcher = "{test/javascripts,app/assets}/**/*_test.{js,js.coffee,coffee}" @helper = "test_helper" else end end |