Class: CucumberHelper::Commons::TestDataHelper
- Inherits:
-
Object
- Object
- CucumberHelper::Commons::TestDataHelper
- Defined in:
- lib/cucumber_helper/commons/test_data_helper.rb
Overview
This class help when you have test data for specific environment: the YAML can be like: sample.yaml
sample_note_id:
staging: 15
production: 21
then you can call with: testdata = TestDataHelper.new(sample.yml, environment) note_id = testdata
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(yml, environment) ⇒ TestDataHelper
constructor
A new instance of TestDataHelper.
Constructor Details
#initialize(yml, environment) ⇒ TestDataHelper
Returns a new instance of TestDataHelper.
17 18 19 20 |
# File 'lib/cucumber_helper/commons/test_data_helper.rb', line 17 def initialize(yml, environment) @db = YAML.load_file yml @env = environment end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
15 16 17 |
# File 'lib/cucumber_helper/commons/test_data_helper.rb', line 15 def env @env end |
Instance Method Details
#[](key) ⇒ Object
22 23 24 |
# File 'lib/cucumber_helper/commons/test_data_helper.rb', line 22 def [](key) @db[key][@env] end |