README.md in auto_data-0.1.1 vs README.md in auto_data-0.1.2

- old
+ new

@@ -31,10 +31,23 @@ if not use using cucumber, place to the variable the project root path in your ruby class ```ruby ENV["AUTO_DATA_PATH"] = <<YML path files>> ``` ### Sample +YML's [sample data](https://github.com/alekxaguilar/auto_data/tree/master/config/data) + +Optional YML file structure: + +```yml +default_key: user_role2 #optional + +user_role1: + userid: userid1 +user_role2: + userid: userid2 +``` +Code using custom key and sub-key words ```ruby require 'auto_data' #Set configuration file path (Assumming that class is under root folder) @@ -50,9 +63,35 @@ puts test.users('mananger.username') #=> Batman #Environment file puts test.environment('testing.base_url') #=> http://testing.sample.com + +``` +Using custom default_key option +```ruby + + #Create AutoData object + autodata = AutoData::Parse.new + + #users.yml file must has default_key, i.e. 'default_key: manager' + puts test.users('login') #=> manager_id + puts test.users('password') #=> zaq12wsx1 + puts test.users('username') #=> Batman + + + +``` +Changing default_key from code + +```ruby + + test.change_scope('users','customer') + + #print again + puts test.users('login') #=> customer_id + puts test.users('password') #=> zaq12wsx2 + puts test.users('username') #=> Robin ``` ## Contributing