poisol 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/poisol/domain.rb +13 -11
- data/lib/poisol/server.rb +45 -37
- data/lib/poisol/stub/request/query_builder.rb +3 -1
- data/lib/poisol/stub/request/request_body_builder.rb +89 -87
- data/lib/poisol/stub/request/url_builder.rb +15 -12
- data/lib/poisol/stub/response/array_response_body.rb +75 -0
- data/lib/poisol/stub/response/response_body_builder.rb +49 -116
- data/lib/poisol/stub/response/status_builder.rb +2 -0
- data/lib/poisol/stub/stub.rb +22 -21
- data/lib/poisol/stub/stub_class_builder.rb +24 -23
- data/lib/poisol/stub/stub_instance.rb +62 -44
- data/lib/poisol/stub/webrick_stub_builder.rb +34 -32
- data/lib/poisol/stub_config/stub_config.rb +10 -8
- data/lib/poisol/stub_config/stub_config_builder.rb +91 -89
- data/lib/poisol/stub_factory.rb +39 -38
- data/lib/poisol/stub_mapper/request_matcher.rb +68 -0
- data/lib/poisol/stub_mapper/response_mapper.rb +33 -0
- data/lib/poisol/stub_mapper/stubs.rb +27 -0
- data/spec/functional/key_value/explicit_inclusion_spec.rb +15 -1
- data/spec/functional/key_value/implicit_inclusion_spec.rb +1 -1
- data/spec/functional/multi_domain_spec.rb +1 -1
- data/spec/functional/post_request_spec.rb +1 -2
- data/spec/functional/query/query_explicit_spec.rb +1 -1
- data/spec/functional/query/query_implicit_spec.rb +1 -1
- data/spec/functional/response/array_spec.rb +14 -7
- data/spec/functional/response/dumb_response_spec.rb +1 -1
- data/spec/functional/response/hash_params_spec.rb +1 -1
- data/spec/functional/response/nested_array_spec.rb +2 -2
- data/spec/functional/url_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- metadata +5 -3
- data/lib/poisol/response_mapper.rb +0 -31
- data/lib/poisol/stubs.rb +0 -74
data/lib/poisol/stub/stub.rb
CHANGED
@@ -2,34 +2,35 @@ require_relative "webrick_stub_builder"
|
|
2
2
|
require_relative "stub_class_builder"
|
3
3
|
require_relative "stub_instance"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
module Poisol
|
6
|
+
class Stub
|
7
|
+
include WebrickStubBuilder
|
8
|
+
include StubInstance
|
9
|
+
attr_accessor :request,:response
|
10
|
+
class << self
|
11
|
+
include StubClassBuilder
|
12
|
+
|
13
|
+
def set_stub_config stub_config
|
14
|
+
@stub_config = stub_config
|
15
|
+
define_method("stub_config") do
|
16
|
+
return stub_config
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
20
|
+
|
18
21
|
end
|
19
22
|
|
20
|
-
|
23
|
+
class Request
|
24
|
+
attr_accessor :url,:query,:body,:path,:type
|
21
25
|
|
22
|
-
|
23
|
-
|
26
|
+
def to_s
|
27
|
+
"#{self.type} #{self.url} #{"Query:#{self.query}" if self.query.present?} #{"\nBody: #{self.body}" if self.body.present?} "
|
28
|
+
end
|
24
29
|
|
25
|
-
def to_s
|
26
|
-
"#{self.type} #{self.url} #{"Query:#{self.query}" if self.query.present?} #{"\nBody: #{self.body}" if self.body.present?} "
|
27
30
|
end
|
28
31
|
|
29
|
-
|
32
|
+
class Response
|
33
|
+
attr_accessor :body,:status,:header
|
34
|
+
end
|
30
35
|
|
31
|
-
class Response
|
32
|
-
attr_accessor :body,:status,:header
|
33
36
|
end
|
34
|
-
|
35
|
-
|
@@ -3,34 +3,35 @@ require_relative "request/request_body_builder"
|
|
3
3
|
require_relative "request/url_builder"
|
4
4
|
require_relative "response/response_body_builder"
|
5
5
|
require_relative "response/status_builder"
|
6
|
+
module Poisol
|
7
|
+
module StubClassBuilder
|
8
|
+
include RequestBodyBuilder
|
9
|
+
include ResponseBodyBuilder
|
10
|
+
include UrlBuilder
|
11
|
+
include QueryBuilder
|
6
12
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
include QueryBuilder
|
13
|
+
def generate_methods_to_alter_sutb
|
14
|
+
prepare_request
|
15
|
+
prepare_response
|
16
|
+
end
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
def prepare_request
|
19
|
+
prepare_request_url
|
20
|
+
prepare_request_query
|
21
|
+
prepare_request_body
|
22
|
+
end
|
17
23
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
prepare_request_body
|
22
|
-
end
|
24
|
+
def prepare_request_url
|
25
|
+
generate_methods_to_alter_path_params
|
26
|
+
end
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
def prepare_request_query
|
29
|
+
generate_query_methods if @stub_config.request.query.present?
|
30
|
+
end
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
32
|
+
def prepare_response
|
33
|
+
prepare_response_body
|
34
|
+
end
|
31
35
|
|
32
|
-
def prepare_response
|
33
|
-
prepare_response_body
|
34
36
|
end
|
35
|
-
|
36
37
|
end
|
@@ -1,55 +1,73 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module Poisol
|
2
|
+
module StubInstance
|
3
|
+
def initialize
|
4
|
+
init_request
|
5
|
+
init_response
|
6
|
+
@called_methods = []
|
7
|
+
end
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
def init_request
|
10
|
+
@request = Request.new
|
11
|
+
@request.type = stub_config.request.type
|
12
|
+
@request.path = stub_config.request.url.deep_dup
|
13
|
+
@request.query = stub_config.request.query_explicit ? {} : stub_config.request.query.deep_dup
|
14
|
+
@request.body = stub_config.request.body_explicit ? {} : stub_config.request.body.deep_dup
|
15
|
+
end
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
def init_response
|
18
|
+
@response = Response.new
|
19
|
+
if stub_config.response.is_column_array or stub_config.response.is_row_array
|
20
|
+
@response.body = [stub_config.response.body.deep_dup]
|
21
|
+
else
|
22
|
+
@response.body = stub_config.response.body.deep_dup
|
23
|
+
end
|
24
|
+
@response.status = 200
|
25
|
+
@response.header = {'Content-Type' => 'application/json'}
|
20
26
|
end
|
21
|
-
@response.status = 200
|
22
|
-
@response.header = {'Content-Type' => 'application/json'}
|
23
|
-
end
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
def set_dumb_response response_file
|
29
|
+
@response.body = Parse.json_file_to_hash(response_file)
|
30
|
+
@is_response_dumped = true
|
31
|
+
self
|
32
|
+
end
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
def get_assignment_value actual_field_value,input_value
|
35
|
+
if actual_field_value.class.to_s == "Hash"
|
36
|
+
input_value = {} if input_value.blank?
|
37
|
+
actual_field_value.deep_merge(input_value.stringify_keys)
|
38
|
+
else
|
39
|
+
input_value
|
40
|
+
end
|
37
41
|
end
|
38
|
-
end
|
39
42
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
def by input_hash
|
44
|
+
@request.body.deep_merge! input_hash
|
45
|
+
self
|
46
|
+
end
|
44
47
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
def has input_hash
|
49
|
+
@response.body.deep_merge! input_hash.camelize_keys
|
50
|
+
self
|
51
|
+
end
|
49
52
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
def is_empty
|
54
|
+
@response.body = stub_config.response.is_column_array or stub_config.response.is_row_array ? [] : {}
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
def for input_hash
|
59
|
+
@request.query.deep_merge! input_hash.camelize_keys
|
60
|
+
self
|
61
|
+
end
|
62
|
+
|
63
|
+
def status input
|
64
|
+
@response.status = input
|
65
|
+
self
|
66
|
+
end
|
54
67
|
|
68
|
+
def remove_array_field_calls
|
69
|
+
method_of_array_fileds_of_array = self.methods.select{|method_name|method_name.to_s.start_with?"with_"}
|
70
|
+
@called_methods = @called_methods - method_of_array_fileds_of_array
|
71
|
+
end
|
72
|
+
end
|
55
73
|
end
|
@@ -1,40 +1,42 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module Poisol
|
2
|
+
module WebrickStubBuilder
|
3
|
+
def build
|
4
|
+
build_url
|
5
|
+
build_query
|
6
|
+
build_request_body
|
7
|
+
build_response_body
|
8
|
+
Stubs.add self
|
9
|
+
self
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
private
|
13
|
+
def build_url
|
14
|
+
remove_path_param_name_from_url
|
15
|
+
@request.url = "#{stub_config.request.domain}/#{@request.path}"
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
def build_query
|
19
|
+
return if @request.query.blank?
|
20
|
+
@request.query = @request.query.to_query
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
def build_request_body
|
24
|
+
return if @request.body.blank?
|
25
|
+
@request.body = Parse.hash_to_concatenated_key_value(@request.body) if stub_config.request.is_body_key_value
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
def build_response_body
|
29
|
+
@response.body = Parse.hash_array_to_column_hash(@response.body) if stub_config.response.is_column_array and !@is_response_dumped.present?
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
def remove_path_param_name_from_url
|
33
|
+
@request.path.scan(/{(.+?)}/).each do |path_params|
|
34
|
+
path_param = path_params[0]
|
35
|
+
param_name = path_param.split("|")[0]
|
36
|
+
param_value = path_param.split("|")[1]
|
37
|
+
@request.path.sub!("{#{path_param}}",param_value)
|
38
|
+
end
|
37
39
|
end
|
38
|
-
end
|
39
40
|
|
41
|
+
end
|
40
42
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module Poisol
|
2
|
+
class StubConfig
|
3
|
+
attr_accessor :response,:request,:is_inline,:file
|
4
|
+
end
|
4
5
|
|
5
|
-
class RequestConfig
|
6
|
-
|
7
|
-
end
|
6
|
+
class RequestConfig
|
7
|
+
attr_accessor :domain,:url,:type,:query,:body,:is_body_key_value,:body_explicit,:query_explicit,:is_column_array,:is_row_array
|
8
|
+
end
|
8
9
|
|
9
|
-
class ResponseConfig
|
10
|
-
|
10
|
+
class ResponseConfig
|
11
|
+
attr_accessor :body,:is_column_array,:is_row_array
|
12
|
+
end
|
11
13
|
end
|
@@ -1,112 +1,114 @@
|
|
1
|
-
|
1
|
+
module Poisol
|
2
|
+
class StubConfigBuilder
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
def initialize
|
5
|
+
@stub_config = StubConfig.new
|
6
|
+
@stub_config.request = RequestConfig.new
|
7
|
+
@stub_config.response = ResponseConfig.new
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def with_file file_name
|
11
|
+
@stub_config.file = file_name
|
12
|
+
self
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def with_domain domain
|
16
|
+
@stub_config.request.domain = domain
|
17
|
+
self
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def is_inline
|
21
|
+
@stub_config.is_inline = true
|
22
|
+
self
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def is_exploded
|
26
|
+
@stub_config.is_inline = false
|
27
|
+
self
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
def build
|
31
|
+
@raw_config_hash = Parse.yaml_file @stub_config.file
|
32
|
+
build_request
|
33
|
+
build_response
|
34
|
+
return @stub_config
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
def load_request_body
|
45
|
-
load_request_body_filed_implicit_option
|
46
|
-
@stub_config.is_inline ? load_inline_request_body : load_exploaded_request_body
|
47
|
-
end
|
37
|
+
private
|
38
|
+
def build_request
|
39
|
+
load_url
|
40
|
+
@stub_config.request.type = @raw_config_hash["request"]["type"].downcase
|
41
|
+
load_query
|
42
|
+
load_request_body
|
43
|
+
end
|
48
44
|
|
45
|
+
def load_request_body
|
46
|
+
load_request_body_filed_implicit_option
|
47
|
+
@stub_config.is_inline ? load_inline_request_body : load_exploaded_request_body
|
48
|
+
end
|
49
49
|
|
50
|
-
def load_query
|
51
|
-
@stub_config.request.query = @raw_config_hash["request"]["query"]
|
52
|
-
query_explicit = @raw_config_hash["request"]["query_explicit"]
|
53
|
-
@stub_config.request.query_explicit = query_explicit.blank? ? false : query_explicit
|
54
|
-
end
|
55
50
|
|
51
|
+
def load_query
|
52
|
+
@stub_config.request.query = @raw_config_hash["request"]["query"]
|
53
|
+
query_explicit = @raw_config_hash["request"]["query_explicit"]
|
54
|
+
@stub_config.request.query_explicit = query_explicit.blank? ? false : query_explicit
|
55
|
+
end
|
56
56
|
|
57
|
-
def load_url
|
58
|
-
url = @raw_config_hash["request"]["url"]
|
59
|
-
url.strip!
|
60
|
-
url.sub!("/","") if url[0].eql? "/"
|
61
|
-
@stub_config.request.url = url
|
62
|
-
end
|
63
57
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
def load_url
|
59
|
+
url = @raw_config_hash["request"]["url"]
|
60
|
+
url.strip!
|
61
|
+
url.sub!("/","") if url[0].eql? "/"
|
62
|
+
@stub_config.request.url = url
|
63
|
+
end
|
68
64
|
|
65
|
+
def load_request_body_filed_implicit_option
|
66
|
+
body_explicit = @raw_config_hash["request"]["body_explicit"]
|
67
|
+
@stub_config.request.body_explicit = body_explicit.blank? ? false : body_explicit
|
68
|
+
end
|
69
69
|
|
70
|
-
def build_response
|
71
|
-
@stub_config.is_inline ? load_inline_response_body : load_exploaded_response_body
|
72
|
-
load_resonse_array_type
|
73
|
-
end
|
74
70
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
@stub_config.response.is_column_array = true if array_type.eql? "column"
|
80
|
-
@stub_config.response.is_row_array = true if array_type.eql? "row"
|
81
|
-
end
|
71
|
+
def build_response
|
72
|
+
@stub_config.is_inline ? load_inline_response_body : load_exploaded_response_body
|
73
|
+
load_resonse_array_type
|
74
|
+
end
|
82
75
|
|
76
|
+
def load_resonse_array_type
|
77
|
+
return if @raw_config_hash["response"].blank?
|
78
|
+
array_type = @raw_config_hash["response"]["array_type"]
|
79
|
+
return if array_type.blank?
|
80
|
+
@stub_config.response.is_column_array = true if array_type.eql? "column"
|
81
|
+
@stub_config.response.is_row_array = true if array_type.eql? "row"
|
82
|
+
end
|
83
83
|
|
84
|
-
def load_inline_response_body
|
85
|
-
raw_body = @raw_config_hash["response"]["body"]
|
86
|
-
return if raw_body.blank?
|
87
|
-
@stub_config.response.body = Parse.json_to_hash raw_body
|
88
|
-
end
|
89
84
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
@stub_config.request.body = Parse.json_to_hash raw_body
|
95
|
-
else
|
96
|
-
@stub_config.request.is_body_key_value = true
|
97
|
-
@stub_config.request.body = raw_body
|
85
|
+
def load_inline_response_body
|
86
|
+
raw_body = @raw_config_hash["response"]["body"]
|
87
|
+
return if raw_body.blank?
|
88
|
+
@stub_config.response.body = Parse.json_to_hash raw_body
|
98
89
|
end
|
99
|
-
end
|
100
90
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
91
|
+
def load_inline_request_body
|
92
|
+
raw_body = @raw_config_hash["request"]["body"]
|
93
|
+
return if raw_body.blank?
|
94
|
+
if raw_body.class.name == "String"
|
95
|
+
@stub_config.request.body = Parse.json_to_hash raw_body
|
96
|
+
else
|
97
|
+
@stub_config.request.is_body_key_value = true
|
98
|
+
@stub_config.request.body = raw_body
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def load_exploaded_request_body
|
103
|
+
request_file = "#{File.dirname @stub_config.file}/request.json"
|
104
|
+
return unless File.exists? request_file
|
105
|
+
@stub_config.request.body = Parse.json_file_to_hash(request_file)
|
106
|
+
end
|
106
107
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
108
|
+
def load_exploaded_response_body
|
109
|
+
response_file = "#{File.dirname @stub_config.file}/response.json"
|
110
|
+
return unless File.exists? response_file
|
111
|
+
@stub_config.response.body = Parse.json_file_to_hash(response_file)
|
112
|
+
end
|
111
113
|
end
|
112
114
|
end
|
data/lib/poisol/stub_factory.rb
CHANGED
@@ -1,51 +1,52 @@
|
|
1
1
|
require_relative "stub/stub"
|
2
|
+
module Poisol
|
3
|
+
class StubFactory
|
4
|
+
def build folder
|
5
|
+
@folder = folder.chomp '/'
|
6
|
+
load_domain
|
7
|
+
load_stub_configs
|
8
|
+
end
|
2
9
|
|
3
|
-
|
4
|
-
def build folder
|
5
|
-
@folder = folder.chomp '/'
|
6
|
-
load_domain
|
7
|
-
load_stub_configs
|
8
|
-
end
|
10
|
+
private
|
9
11
|
|
10
|
-
|
12
|
+
def load_domain
|
13
|
+
domain_config_file = Dir["#{@folder}/domain.yml"].first
|
14
|
+
@domain = Domain.new domain_config_file
|
15
|
+
end
|
11
16
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
def load_stub_configs
|
18
|
+
explolded_configs = Dir["#{@folder}/**/config.yml"]
|
19
|
+
inline_configs = Dir["#{@folder}/**/*.yml"] - ( (explolded_configs.nil?) ? [] : explolded_configs) - [@domain.file]
|
20
|
+
generate_exploded_config explolded_configs unless explolded_configs.nil?
|
21
|
+
generate_inline_config inline_configs unless inline_configs.nil?
|
22
|
+
end
|
16
23
|
|
17
|
-
def load_stub_configs
|
18
|
-
explolded_configs = Dir["#{@folder}/**/config.yml"]
|
19
|
-
inline_configs = Dir["#{@folder}/**/*.yml"] - ( (explolded_configs.nil?) ? [] : explolded_configs) - [@domain.file]
|
20
|
-
generate_exploded_config explolded_configs unless explolded_configs.nil?
|
21
|
-
generate_inline_config inline_configs unless inline_configs.nil?
|
22
|
-
end
|
23
24
|
|
25
|
+
def generate_exploded_config explolded_configs
|
26
|
+
explolded_configs.each do |config_file|
|
27
|
+
PoisolLog.info "Processing #{config_file}"
|
28
|
+
dynamic_name = (FileName.get_dir_name config_file).camelize
|
29
|
+
config = StubConfigBuilder.new.is_exploded.with_file(config_file).with_domain(@domain.full_url).build
|
30
|
+
create_class dynamic_name,config
|
31
|
+
end
|
32
|
+
end
|
24
33
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
34
|
+
def generate_inline_config inline_configs
|
35
|
+
inline_configs.each do |config_file|
|
36
|
+
PoisolLog.debug "Processing #{config_file}"
|
37
|
+
dynamic_name = (FileName.get_file_name config_file).camelize
|
38
|
+
stub_config = StubConfigBuilder.new.is_inline.with_file(config_file).with_domain(@domain.full_url).build
|
39
|
+
create_class dynamic_name,stub_config
|
40
|
+
end
|
31
41
|
end
|
32
|
-
end
|
33
42
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
43
|
+
def create_class class_name,stub_config
|
44
|
+
dynamic_stub_class = Object.const_set class_name,Class.new(Stub)
|
45
|
+
dynamic_stub_class.set_stub_config stub_config
|
46
|
+
dynamic_stub_class.generate_methods_to_alter_sutb
|
47
|
+
PoisolLog.info "Generated #{class_name}"
|
48
|
+
PoisolLog.debug "with methods #{dynamic_stub_class.instance_methods - Object.methods}"
|
40
49
|
end
|
41
|
-
end
|
42
50
|
|
43
|
-
def create_class class_name,stub_config
|
44
|
-
dynamic_stub_class = Object.const_set class_name,Class.new(Stub)
|
45
|
-
dynamic_stub_class.set_stub_config stub_config
|
46
|
-
dynamic_stub_class.generate_methods_to_alter_sutb
|
47
|
-
PoisolLog.info "Generated #{class_name}"
|
48
|
-
PoisolLog.debug "with methods #{dynamic_stub_class.instance_methods - Object.methods}"
|
49
51
|
end
|
50
|
-
|
51
52
|
end
|