Module: Tng

Defined in:
lib/tng.rb,
lib/tng/utils.rb,
lib/tng/railtie.rb,
lib/tng/version.rb,
lib/tng/ui/theme.rb,
lib/tng/analyzers/model.rb,
lib/tng/analyzers/other.rb,
lib/tng/api/http_client.rb,
lib/tng/analyzers/service.rb,
lib/tng/analyzers/controller.rb,
lib/tng/services/test_generator.rb,
lib/tng/services/extract_methods.rb,
lib/tng/services/user_app_config.rb,
lib/tng/services/direct_generation.rb,
lib/tng/services/file_type_detector.rb,
lib/generators/tng/install_generator.rb

Defined Under Namespace

Modules: Analyzers, Generators, Services, UI, Utils Classes: Error, HttpClient, Railtie

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.after_styleObject



225
226
227
# File 'lib/tng.rb', line 225

def self.after_style
  @config[:after_style]
end

.after_style=(value) ⇒ Object



221
222
223
# File 'lib/tng.rb', line 221

def self.after_style=(value)
  @config[:after_style] = value
end

.api_keyObject



80
81
82
# File 'lib/tng.rb', line 80

def self.api_key
  @config[:api_key]
end

.api_key=(value) ⇒ Object



76
77
78
# File 'lib/tng.rb', line 76

def self.api_key=(value)
  @config[:api_key] = value
end

.assertion_styleObject



177
178
179
# File 'lib/tng.rb', line 177

def self.assertion_style
  @config[:assertion_style]
end

.assertion_style=(value) ⇒ Object



173
174
175
# File 'lib/tng.rb', line 173

def self.assertion_style=(value)
  @config[:assertion_style] = value
end

.authentication_configured?Boolean

Returns:

  • (Boolean)


261
262
263
264
265
266
267
268
269
270
271
# File 'lib/tng.rb', line 261

def self.authentication_configured?
  return false unless authentication_enabled
  return false if authentication_methods.nil? || authentication_methods.empty?

  authentication_methods.all? do |method|
    method.is_a?(Hash) &&
      method.key?(:method) && !method[:method].to_s.strip.empty? &&
      method.key?(:file_location) && !method[:file_location].to_s.strip.empty? &&
      method.key?(:auth_type) && !method[:auth_type].to_s.strip.empty?
  end
end

.authentication_enabledObject



105
106
107
# File 'lib/tng.rb', line 105

def self.authentication_enabled
  @config[:authentication_enabled]
end

.authentication_enabled=(value) ⇒ Object



101
102
103
# File 'lib/tng.rb', line 101

def self.authentication_enabled=(value)
  @config[:authentication_enabled] = value
end

.authentication_libraryObject



113
114
115
# File 'lib/tng.rb', line 113

def self.authentication_library
  @config[:authentication_library]
end

.authentication_library=(value) ⇒ Object



109
110
111
# File 'lib/tng.rb', line 109

def self.authentication_library=(value)
  @config[:authentication_library] = value
end

.authentication_methodsObject



129
130
131
# File 'lib/tng.rb', line 129

def self.authentication_methods
  @config[:authentication_methods]
end

.authentication_methods=(value) ⇒ Object



125
126
127
# File 'lib/tng.rb', line 125

def self.authentication_methods=(value)
  @config[:authentication_methods] = value
end

.authorization_libraryObject



121
122
123
# File 'lib/tng.rb', line 121

def self.authorization_library
  @config[:authorization_library]
end

.authorization_library=(value) ⇒ Object



117
118
119
# File 'lib/tng.rb', line 117

def self.authorization_library=(value)
  @config[:authorization_library] = value
end

.base_urlObject



88
89
90
# File 'lib/tng.rb', line 88

def self.base_url
  @config[:base_url]
end

.base_url=(value) ⇒ Object



84
85
86
# File 'lib/tng.rb', line 84

def self.base_url=(value)
  @config[:base_url] = value
end

.before_styleObject



217
218
219
# File 'lib/tng.rb', line 217

def self.before_style
  @config[:before_style]
end

.before_style=(value) ⇒ Object



213
214
215
# File 'lib/tng.rb', line 213

def self.before_style=(value)
  @config[:before_style] = value
end

.configObject



72
73
74
# File 'lib/tng.rb', line 72

def self.config
  @config
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Tng)

    the object that the method was called on



68
69
70
# File 'lib/tng.rb', line 68

def self.configure
  yield(self) if block_given?
end

.context_styleObject



201
202
203
# File 'lib/tng.rb', line 201

def self.context_style
  @config[:context_style]
end

.context_style=(value) ⇒ Object



197
198
199
# File 'lib/tng.rb', line 197

def self.context_style=(value)
  @config[:context_style] = value
end

.describe_styleObject



193
194
195
# File 'lib/tng.rb', line 193

def self.describe_style
  @config[:describe_style]
end

.describe_style=(value) ⇒ Object



189
190
191
# File 'lib/tng.rb', line 189

def self.describe_style=(value)
  @config[:describe_style] = value
end

.factory_libraryObject



153
154
155
# File 'lib/tng.rb', line 153

def self.factory_library
  @config[:factory_library]
end

.factory_library=(value) ⇒ Object



149
150
151
# File 'lib/tng.rb', line 149

def self.factory_library=(value)
  @config[:factory_library] = value
end

.http_mock_libraryObject



145
146
147
# File 'lib/tng.rb', line 145

def self.http_mock_library
  @config[:http_mock_library]
end

.http_mock_library=(value) ⇒ Object



141
142
143
# File 'lib/tng.rb', line 141

def self.http_mock_library=(value)
  @config[:http_mock_library] = value
end

.initialize_framework_defaults(framework) ⇒ Object



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/tng.rb', line 273

def self.initialize_framework_defaults(framework)
  if framework == "minitest"
    @config.merge!({
                     test_style: "spec",
                     setup_style: false,
                     assertion_style: "assert",
                     teardown_style: false
                   })
    @config.delete(:describe_style)
    @config.delete(:context_style)
    @config.delete(:it_style)
    @config.delete(:before_style)
    @config.delete(:after_style)
    @config.delete(:let_style)
    @config.delete(:subject_style)
  elsif framework == "rspec"
    @config.merge!({
                     describe_style: true,
                     context_style: "context",
                     it_style: "it",
                     before_style: "before",
                     after_style: "after",
                     let_style: true,
                     subject_style: true
                   })
    @config.delete(:test_style)
    @config.delete(:setup_style)
    @config.delete(:assertion_style)
    @config.delete(:teardown_style)
  end
end

.it_styleObject



209
210
211
# File 'lib/tng.rb', line 209

def self.it_style
  @config[:it_style]
end

.it_style=(value) ⇒ Object



205
206
207
# File 'lib/tng.rb', line 205

def self.it_style=(value)
  @config[:it_style] = value
end

.let_styleObject



233
234
235
# File 'lib/tng.rb', line 233

def self.let_style
  @config[:let_style]
end

.let_style=(value) ⇒ Object



229
230
231
# File 'lib/tng.rb', line 229

def self.let_style=(value)
  @config[:let_style] = value
end

.mock_libraryObject



137
138
139
# File 'lib/tng.rb', line 137

def self.mock_library
  @config[:mock_library]
end

.mock_library=(value) ⇒ Object



133
134
135
# File 'lib/tng.rb', line 133

def self.mock_library=(value)
  @config[:mock_library] = value
end

.read_file_source_codeObject



257
258
259
# File 'lib/tng.rb', line 257

def self.read_file_source_code
  @config[:read_file_source_code]
end

.read_file_source_code=(value) ⇒ Object



253
254
255
# File 'lib/tng.rb', line 253

def self.read_file_source_code=(value)
  @config[:read_file_source_code] = value
end

.setup_styleObject



169
170
171
# File 'lib/tng.rb', line 169

def self.setup_style
  @config[:setup_style]
end

.setup_style=(value) ⇒ Object



165
166
167
# File 'lib/tng.rb', line 165

def self.setup_style=(value)
  @config[:setup_style] = value
end

.subject_styleObject



241
242
243
# File 'lib/tng.rb', line 241

def self.subject_style
  @config[:subject_style]
end

.subject_style=(value) ⇒ Object



237
238
239
# File 'lib/tng.rb', line 237

def self.subject_style=(value)
  @config[:subject_style] = value
end

.teardown_styleObject



185
186
187
# File 'lib/tng.rb', line 185

def self.teardown_style
  @config[:teardown_style]
end

.teardown_style=(value) ⇒ Object



181
182
183
# File 'lib/tng.rb', line 181

def self.teardown_style=(value)
  @config[:teardown_style] = value
end

.test_examplesObject



249
250
251
# File 'lib/tng.rb', line 249

def self.test_examples
  @config[:test_examples]
end

.test_examples=(value) ⇒ Object



245
246
247
# File 'lib/tng.rb', line 245

def self.test_examples=(value)
  @config[:test_examples] = value
end

.test_styleObject



161
162
163
# File 'lib/tng.rb', line 161

def self.test_style
  @config[:test_style]
end

.test_style=(value) ⇒ Object



157
158
159
# File 'lib/tng.rb', line 157

def self.test_style=(value)
  @config[:test_style] = value
end

.testing_frameworkObject



97
98
99
# File 'lib/tng.rb', line 97

def self.testing_framework
  @config[:testing_framework]
end

.testing_framework=(value) ⇒ Object



92
93
94
95
# File 'lib/tng.rb', line 92

def self.testing_framework=(value)
  @config[:testing_framework] = value
  initialize_framework_defaults(value)
end