Class: JsTestDriver::HtmlFixture
- Inherits:
-
Object
- Object
- JsTestDriver::HtmlFixture
- Defined in:
- lib/js_test_driver/html_fixture.rb
Overview
This is a class that given a directory name, puts all its *.html children into a javascript file, so that they can later be used in the tests
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
-
#initialize(directory_name, name = nil, namespace = nil) ⇒ HtmlFixture
constructor
A new instance of HtmlFixture.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(directory_name, name = nil, namespace = nil) ⇒ HtmlFixture
Returns a new instance of HtmlFixture.
8 9 10 11 12 13 14 |
# File 'lib/js_test_driver/html_fixture.rb', line 8 def initialize(directory_name, name = nil, namespace = nil) @name = name || "all" @namespace = namespace || "htmlFixtures" @data = {} load_data(directory_name) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/js_test_driver/html_fixture.rb', line 6 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
6 7 8 |
# File 'lib/js_test_driver/html_fixture.rb', line 6 def namespace @namespace end |
Instance Method Details
#to_h ⇒ Object
16 17 18 |
# File 'lib/js_test_driver/html_fixture.rb', line 16 def to_h @data end |
#to_s ⇒ Object
20 21 22 23 24 25 |
# File 'lib/js_test_driver/html_fixture.rb', line 20 def to_s <<JS if (typeof(#{namespace}) === 'undefined') { #{namespace} = {}; } #{namespace}.#{name} = #{self.to_h.to_json}; JS end |