27
27
28
28
def setup_env ( options )
29
29
options . each do |k , v |
30
- ENV [ "DYNAMO_DB_SESSION_ #{ k . to_s . upcase } " ] = v . to_s
30
+ ENV [ "AWS_DYNAMO_DB_SESSION_ #{ k . to_s . upcase } " ] = v . to_s
31
31
end
32
32
end
33
33
34
34
def teardown_env ( options )
35
- options . each_key { |k | ENV . delete ( "DYNAMO_DB_SESSION_ #{ k . to_s . upcase } " ) }
35
+ options . each_key { |k | ENV . delete ( "AWS_DYNAMO_DB_SESSION_ #{ k . to_s . upcase } " ) }
36
36
end
37
37
38
38
let ( :client ) { Aws ::DynamoDB ::Client . new ( stub_responses : true ) }
@@ -47,7 +47,7 @@ def teardown_env(options)
47
47
end
48
48
49
49
it 'configures with YAML with precedence over defaults' do
50
- Tempfile . create ( 'dynamo_db_session_store .yml' ) do |f |
50
+ Tempfile . create ( 'aws_dynamo_db_session_store .yml' ) do |f |
51
51
f << options . transform_keys ( &:to_s ) . to_yaml
52
52
f . rewind
53
53
cfg = Aws ::SessionStore ::DynamoDB ::Configuration . new ( config_file : f . path )
@@ -57,7 +57,7 @@ def teardown_env(options)
57
57
58
58
it 'configures with ENV with precedence over YAML' do
59
59
setup_env ( options )
60
- Tempfile . create ( 'dynamo_db_session_store .yml' ) do |f |
60
+ Tempfile . create ( 'aws_dynamo_db_session_store .yml' ) do |f |
61
61
f << { table_name : 'OldTable' , table_key : 'OldKey' } . transform_keys ( &:to_s ) . to_yaml
62
62
f . rewind
63
63
cfg = Aws ::SessionStore ::DynamoDB ::Configuration . new ( config_file : f . path )
@@ -70,7 +70,7 @@ def teardown_env(options)
70
70
it 'configures in code with full precedence' do
71
71
old = { table_name : 'OldTable' , table_key : 'OldKey' }
72
72
setup_env ( options . merge ( old ) )
73
- Tempfile . create ( 'dynamo_db_session_store .yml' ) do |f |
73
+ Tempfile . create ( 'aws_dynamo_db_session_store .yml' ) do |f |
74
74
f << old . transform_keys ( &:to_s ) . to_yaml
75
75
f . rewind
76
76
cfg = Aws ::SessionStore ::DynamoDB ::Configuration . new ( options . merge ( config_file : f . path ) )
@@ -81,29 +81,29 @@ def teardown_env(options)
81
81
end
82
82
83
83
it 'allows for config file to be configured with ENV' do
84
- Tempfile . create ( 'dynamo_db_session_store .yml' ) do |f |
84
+ Tempfile . create ( 'aws_dynamo_db_session_store .yml' ) do |f |
85
85
f << options . transform_keys ( &:to_s ) . to_yaml
86
86
f . rewind
87
- ENV [ 'DYNAMO_DB_SESSION_CONFIG_FILE ' ] = f . path
87
+ ENV [ 'AWS_DYNAMO_DB_SESSION_CONFIG_FILE ' ] = f . path
88
88
cfg = Aws ::SessionStore ::DynamoDB ::Configuration . new
89
89
expect ( cfg . to_hash ) . to include ( options )
90
90
ensure
91
- ENV . delete ( 'DYNAMO_DB_SESSION_CONFIG_FILE ' )
91
+ ENV . delete ( 'AWS_DYNAMO_DB_SESSION_CONFIG_FILE ' )
92
92
end
93
93
end
94
94
95
95
it 'ignores unsupported keys in ENV' do
96
- ENV [ 'DYNAMO_DB_SESSION_DYNAMO_DB_CLIENT ' ] = 'Client'
97
- ENV [ 'DYNAMO_DB_SESSION_ERROR_HANDLER ' ] = 'Handler'
96
+ ENV [ 'AWS_DYNAMO_DB_SESSION_DYNAMO_DB_CLIENT ' ] = 'Client'
97
+ ENV [ 'AWS_DYNAMO_DB_SESSION_ERROR_HANDLER ' ] = 'Handler'
98
98
cfg = Aws ::SessionStore ::DynamoDB ::Configuration . new
99
99
expect ( cfg . to_hash ) . to include ( defaults )
100
100
ensure
101
- ENV . delete ( 'DYNAMO_DB_SESSION_DYNAMO_DB_CLIENT ' )
102
- ENV . delete ( 'DYNAMO_DB_SESSION_ERROR_HANDLER ' )
101
+ ENV . delete ( 'AWS_DYNAMO_DB_SESSION_DYNAMO_DB_CLIENT ' )
102
+ ENV . delete ( 'AWS_DYNAMO_DB_SESSION_ERROR_HANDLER ' )
103
103
end
104
104
105
105
it 'ignores unsupported keys in YAML' do
106
- Tempfile . create ( 'dynamo_db_session_store .yml' ) do |f |
106
+ Tempfile . create ( 'aws_dynamo_db_session_store .yml' ) do |f |
107
107
options = { dynamo_db_client : 'Client' , error_handler : 'Handler' , config_file : 'File' }
108
108
f << options . transform_keys ( &:to_s ) . to_yaml
109
109
f . rewind
0 commit comments