datum 4.0.5 → 4.0.6
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
- metadata +4 -15
- data/MIT-LICENSE +0 -44
- data/README.md +0 -11
- data/Rakefile +0 -32
- data/lib/datum/container.rb +0 -73
- data/lib/datum/datum.rb +0 -60
- data/lib/datum/helpers.rb +0 -61
- data/lib/datum/version.rb +0 -10
- data/lib/datum.rb +0 -37
- data/lib/plan9/structures.rb +0 -74
- data/lib/support/scenario.rb +0 -16
- data/lib/support/test.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd0ab8b68f08c7c3ce0ff9696276bdc83bf10bb6
|
4
|
+
data.tar.gz: 5b5d2a2e7ef9e75f35372c1e857e8b36438ac784
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dc8e628d38230f0f6a5165119a334c282dad89d9a684105ed38baa63111d0731b85d39f9a40b7cc0fb399385774cc0a1dd64cef92f5ce591869f6573ec490fc
|
7
|
+
data.tar.gz: f6a92f4847a45bf59e91fa3def51b9f9f6577ab7bb98f51c40ffd7925d5860cb69f05927ee1f475e0fe0fbcbaac8dc7ab1ddcdd3772bde99701bbf439c3efc7b
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyemill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Flexible data-driven test solution for Rails
|
14
14
|
email:
|
@@ -16,18 +16,7 @@ email:
|
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
|
-
files:
|
20
|
-
- MIT-LICENSE
|
21
|
-
- README.md
|
22
|
-
- Rakefile
|
23
|
-
- lib/datum.rb
|
24
|
-
- lib/datum/container.rb
|
25
|
-
- lib/datum/datum.rb
|
26
|
-
- lib/datum/helpers.rb
|
27
|
-
- lib/datum/version.rb
|
28
|
-
- lib/plan9/structures.rb
|
29
|
-
- lib/support/scenario.rb
|
30
|
-
- lib/support/test.rb
|
19
|
+
files: []
|
31
20
|
homepage: https://github.com/tyemill/datum
|
32
21
|
licenses:
|
33
22
|
- MIT
|
@@ -48,7 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
37
|
version: '0'
|
49
38
|
requirements: []
|
50
39
|
rubyforge_project:
|
51
|
-
rubygems_version: 2.
|
40
|
+
rubygems_version: 2.4.5
|
52
41
|
signing_key:
|
53
42
|
specification_version: 4
|
54
43
|
summary: Flexible data-driven test solution for Rails
|
data/MIT-LICENSE
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
Copyright 2015 Tyemill
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
|
-
#### From https://github.com/iconara/immutable_struct/blob/master/LICENSE
|
23
|
-
#### Provided due to use of immutable_struct/blob/master/lib/immutable_struct.rb
|
24
|
-
|
25
|
-
Copyright (c) 2010 Theo Hultberg
|
26
|
-
|
27
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
28
|
-
a copy of this software and associated documentation files (the
|
29
|
-
"Software"), to deal in the Software without restriction, including
|
30
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
31
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
32
|
-
permit persons to whom the Software is furnished to do so, subject to
|
33
|
-
the following conditions:
|
34
|
-
|
35
|
-
The above copyright notice and this permission notice shall be
|
36
|
-
included in all copies or substantial portions of the Software.
|
37
|
-
|
38
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
39
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
40
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
41
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
42
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
43
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
44
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
##### Datum is currently being updated. Hold on.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
## License
|
6
|
-
|
7
|
-
MIT License. Copyright 2012-2015 Tyemill. http://tyemill.com
|
8
|
-
|
9
|
-
You are not granted rights or licenses to the trademarks of Tyemill, including without limitation the Datum name or logo.
|
10
|
-
|
11
|
-
Datum struct uses ImprovedStruct and ImmutableStruct which are derivitive works based on ImmutableStruct by Theo Hultberg. This great class can be found here: [Immutable Struct](https://github.com/iconara/immutable_struct)
|
data/Rakefile
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
6
|
-
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
11
|
-
rdoc.title = 'Datum'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.rdoc')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Bundler::GemHelper.install_tasks
|
21
|
-
|
22
|
-
require 'rake/testtask'
|
23
|
-
|
24
|
-
Rake::TestTask.new(:test) do |t|
|
25
|
-
t.libs << 'lib'
|
26
|
-
t.libs << 'test'
|
27
|
-
t.pattern = 'test/**/*_test.rb'
|
28
|
-
t.verbose = false
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
task default: :test
|
data/lib/datum/container.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require "datum/helpers"
|
2
|
-
|
3
|
-
module Datum
|
4
|
-
# A Container object holds attributes for a single data test.
|
5
|
-
class Container
|
6
|
-
|
7
|
-
# Creates a Hash key formatted for use with a Container.
|
8
|
-
#
|
9
|
-
# @param [TestCase] tst_instance The TestCase instance for the data_test
|
10
|
-
# @param [String] data_method_name The name of the data_test method
|
11
|
-
# @return [String] Container compatible Hash key
|
12
|
-
def self.key tst_instance, data_method_name
|
13
|
-
Helpers.build_key(tst_instance, data_method_name)
|
14
|
-
end
|
15
|
-
|
16
|
-
# @!attribute [r] data_method_name
|
17
|
-
# @return [String] The name of the data test method
|
18
|
-
attr_reader :data_method_name
|
19
|
-
|
20
|
-
# @!attribute [r] test_instance
|
21
|
-
# @return [TestCase] The ActiveSupport::TestCase instance of the data test
|
22
|
-
attr_reader :test_instance
|
23
|
-
|
24
|
-
# @!visibility private
|
25
|
-
# @param [String] data_method_name The name of test method to be called
|
26
|
-
# @param [TestCase] tst_instance The instance containing the data_method_name
|
27
|
-
def initialize(data_method_name, tst_instance)
|
28
|
-
@data_method_name = data_method_name; @test_instance = tst_instance
|
29
|
-
@loaded_data = {}; @invoked_data = {}
|
30
|
-
::Datum.send(:add_container, self,
|
31
|
-
Container.key(@test_instance, @data_method_name))
|
32
|
-
end
|
33
|
-
|
34
|
-
# @!attribute [r] count
|
35
|
-
# @return [int] The total number of tests / data elements / datums
|
36
|
-
def count; @loaded_data.count + @invoked_data.count; end;
|
37
|
-
|
38
|
-
# @!attribute [r] data
|
39
|
-
# A Hash of data elements, datum structs for the test case
|
40
|
-
#
|
41
|
-
# @return [Hash] A Hash of data elements, datum structs for the test case
|
42
|
-
def data; @loaded_data.merge(@invoked_data); end
|
43
|
-
|
44
|
-
alias_method :length, :count
|
45
|
-
alias_method :size, :count
|
46
|
-
alias_method :test_count, :count
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def add_datum datum
|
51
|
-
test_name = Helpers.build_test_name(data_method_name, test_count + 1)
|
52
|
-
@loaded_data[Datum.key(test_instance, test_name)] = datum
|
53
|
-
add_data_test test_name
|
54
|
-
[count, test_name]
|
55
|
-
end
|
56
|
-
|
57
|
-
def invoke_datum key, tst_case
|
58
|
-
@invoked_data[key] = datum = @loaded_data.delete(key)
|
59
|
-
tst_case.instance_variable_set :@datum, datum
|
60
|
-
tst_case.send datum.container.data_method_name
|
61
|
-
end
|
62
|
-
|
63
|
-
def add_data_test test_name
|
64
|
-
test_instance.send(:define_method, test_name) do
|
65
|
-
datum_key = Datum.key(nm = self.class.to_s, __method__)
|
66
|
-
container_key = Container.key(nm,
|
67
|
-
Helpers.data_method_from_test_name(__method__))
|
68
|
-
::Datum.containers[container_key].send(:invoke_datum, datum_key, self)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
data/lib/datum/datum.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require "datum/container"
|
2
|
-
require "datum/helpers"
|
3
|
-
require "plan9/structures"
|
4
|
-
|
5
|
-
module Datum
|
6
|
-
# Datum ImmutableStruct to be extended by data_test test cases
|
7
|
-
class Datum < Plan9::ImmutableStruct
|
8
|
-
# Creates a Hash key formatted for use with a Datum
|
9
|
-
#
|
10
|
-
# @param [TestCase] test_instance The TestCase instance for the test
|
11
|
-
# @param [String] test_name The name of the test
|
12
|
-
# @return [String] Datum compatible Hash key
|
13
|
-
def self.key test_instance, test_name
|
14
|
-
Helpers.build_key(test_instance, test_name)
|
15
|
-
end
|
16
|
-
|
17
|
-
# @!visibility private
|
18
|
-
def self.new(*attrs, &block)
|
19
|
-
attrs.push "datum_id"
|
20
|
-
super(*attrs, &block)
|
21
|
-
end
|
22
|
-
|
23
|
-
protected
|
24
|
-
|
25
|
-
def self.init_new(struct)
|
26
|
-
super(struct)
|
27
|
-
datumize_constructor!(struct)
|
28
|
-
struct
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
def self.datumize_constructor! struct
|
33
|
-
|
34
|
-
struct.class_eval do
|
35
|
-
alias_method :datum_initialize, :initialize
|
36
|
-
|
37
|
-
# @!attribute [r] test_method_name
|
38
|
-
# @return [String] The name of the test method
|
39
|
-
attr_reader :test_method_name
|
40
|
-
|
41
|
-
# @!attribute [r] container
|
42
|
-
# @return [Container] A reference to the Container of this Datum
|
43
|
-
attr_reader :container
|
44
|
-
|
45
|
-
# @!visibility private
|
46
|
-
def initialize(*atrs)
|
47
|
-
dtm_id = configure_attributes
|
48
|
-
is_hash_case?(*atrs) ? atrs.first[:datum_id] = dtm_id : atrs.push(dtm_id)
|
49
|
-
datum_initialize(*atrs)
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
def configure_attributes
|
54
|
-
@container = ::Datum.send(:current_container)
|
55
|
-
(dtm_id, @test_method_name = @container.send(:add_datum, self))[0]
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/lib/datum/helpers.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
module Datum
|
2
|
-
|
3
|
-
# @!visibility private
|
4
|
-
# Various helper functions
|
5
|
-
class Helpers
|
6
|
-
class << self
|
7
|
-
|
8
|
-
# @param [String] test_name Test case name generated from data_test usage
|
9
|
-
# @return [int] The index of the data_test / datum_id
|
10
|
-
def index_from_test_name test_name
|
11
|
-
((test_name.to_s.split('_')[-1]).to_i)
|
12
|
-
end
|
13
|
-
|
14
|
-
# @param [String] test_name Test case name generated from data_test usage
|
15
|
-
# @return [String] Name of the data_test method which generated the test
|
16
|
-
def data_method_from_test_name test_name
|
17
|
-
test_name.slice(/(?<=_).*(?=_)/)
|
18
|
-
end
|
19
|
-
|
20
|
-
# @param [String] data_method_name The name of the data_test method
|
21
|
-
# @param [int] counter The index / datum_id of the current test case
|
22
|
-
# @return [String] Test name for current test case, index, data_test method
|
23
|
-
def build_test_name data_method_name, counter
|
24
|
-
"test_#{data_method_name}_#{counter}"
|
25
|
-
end
|
26
|
-
|
27
|
-
# @param [TestCase] test_instance The ActiveSupport::TestCase instance
|
28
|
-
# @param [String] method The name of the method
|
29
|
-
# @return [String] A key for usage in Datum-compatible Hash instances
|
30
|
-
def build_key test_instance, method
|
31
|
-
"#{test_instance}_#{method}"
|
32
|
-
end
|
33
|
-
|
34
|
-
# @param [String] file_name The name of the file to read
|
35
|
-
# @param [Pathname] directory A Pathname representing the file's directory
|
36
|
-
# @param [String] ext Optional extention of the file (default: '.rb')
|
37
|
-
# @return [String] The file's contents
|
38
|
-
def read_file file_name, directory, ext = ".rb"
|
39
|
-
File.read directory.join("#{file_name}#{ext}")
|
40
|
-
end
|
41
|
-
|
42
|
-
# Reads a ruby file and eval's it's contents at the current code location
|
43
|
-
#
|
44
|
-
# @param [String] file_name The name of the file to import
|
45
|
-
# @param [Pathname] directory A Pathname representing the file's directory
|
46
|
-
# @param [Binding] current_binding Context at a particular code location
|
47
|
-
def import_file file_name, directory, current_binding
|
48
|
-
eval(read_file(file_name, directory), current_binding)
|
49
|
-
end
|
50
|
-
|
51
|
-
# @param [ActiveRecord::Base] resource An ActiveRecord Model instance
|
52
|
-
# @param [Hash] override_hash Hash of attributes / values to override from
|
53
|
-
# @return [Hash] Hash of attributes from provided resource
|
54
|
-
def clone_resource resource, override_hash = nil
|
55
|
-
override_hash.nil? ? resource.dup.attributes.with_indifferent_access :
|
56
|
-
resource.dup.attributes.merge(
|
57
|
-
override_hash.with_indifferent_access).with_indifferent_access
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
data/lib/datum/version.rb
DELETED
data/lib/datum.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
|
2
|
-
require "datum/helpers"
|
3
|
-
require "datum/datum"
|
4
|
-
require "datum/container"
|
5
|
-
require "support/test"
|
6
|
-
require "support/scenario"
|
7
|
-
|
8
|
-
# Datum is a flexible data-driven test solution for Rails
|
9
|
-
module Datum
|
10
|
-
@@all_containers, @@scenario_path, @@data_path, @@datum_path = nil
|
11
|
-
|
12
|
-
class << self
|
13
|
-
|
14
|
-
# @!attribute [r] path
|
15
|
-
# @return [Pathname] Fully qualified path for the root of datum directory
|
16
|
-
def path; @@datum_path ||= Rails.root.join('test', 'datum'); end
|
17
|
-
|
18
|
-
# @!attribute [r] data_path
|
19
|
-
# @return [Pathname] Fully qualified path for the datum/data directory
|
20
|
-
def data_path; @@data_path ||= ::Datum.path.join('data'); end
|
21
|
-
|
22
|
-
# @!attribute [r] scenario_path
|
23
|
-
# @return [Pathname] Fully qualified path for the datum/scenarios directory
|
24
|
-
def scenario_path; @@scenario_path ||= ::Datum.path.join('scenarios'); end
|
25
|
-
|
26
|
-
# @!attribute [r] containers
|
27
|
-
# @return [Hash] Hash of all loaded Containers
|
28
|
-
def containers; @@all_containers ||= {}; end
|
29
|
-
|
30
|
-
private
|
31
|
-
def add_container container, key
|
32
|
-
::Datum.containers[key] = container
|
33
|
-
::Datum.instance_variable_set(:"@current_container", container)
|
34
|
-
end
|
35
|
-
def current_container; @current_container; end;
|
36
|
-
end
|
37
|
-
end
|
data/lib/plan9/structures.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# @!visibility private
|
2
|
-
module Plan9 # Module for simple code reuse between various projects.
|
3
|
-
|
4
|
-
class ImprovedStruct # A few improvements to a Ruby Struct
|
5
|
-
#
|
6
|
-
# Re-organized slightly, this code is reused from 'ImmutableStruct'
|
7
|
-
# by Theo Hultberg. See https://github.com/iconara/immutable_struct
|
8
|
-
# Copyright notice mentioned in the LICENSE file.
|
9
|
-
#
|
10
|
-
def self.new(*attrs, &block)
|
11
|
-
init_new(Struct.new(*attrs, &block))
|
12
|
-
end
|
13
|
-
|
14
|
-
protected
|
15
|
-
def self.init_new(struct)
|
16
|
-
optionalize_constructor!(struct)
|
17
|
-
extend_dup!(struct)
|
18
|
-
struct
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
def self.optionalize_constructor!(struct)
|
23
|
-
struct.class_eval do
|
24
|
-
alias_method :struct_initialize, :initialize
|
25
|
-
|
26
|
-
def initialize(*attrs)
|
27
|
-
if is_hash_case?(*attrs)
|
28
|
-
struct_initialize(*members.map { |m| attrs.first[m.to_sym] })
|
29
|
-
else
|
30
|
-
struct_initialize(*attrs)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
protected
|
35
|
-
def is_hash_case?(*a)
|
36
|
-
# @return (bool) true if attrs are Hash, false otherwise
|
37
|
-
members.size > 1 && a && a.size == 1 && a.first.instance_of?(Hash)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.extend_dup!(struct)
|
43
|
-
struct.class_eval do
|
44
|
-
def dup(overrides={})
|
45
|
-
self.class.new(to_h.merge(overrides))
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class ImmutableStruct < ImprovedStruct # A read-only Struct
|
52
|
-
# Re-organized slightly, this code is reused from 'ImmutableStruct'
|
53
|
-
# by Theo Hultberg. See https://github.com/iconara/immutable_struct
|
54
|
-
# Copyright notice mentioned in the LICENSE file.
|
55
|
-
|
56
|
-
protected
|
57
|
-
|
58
|
-
def self.init_new(struct)
|
59
|
-
make_immutable!(struct)
|
60
|
-
super(struct)
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def self.make_immutable!(struct)
|
66
|
-
# removes the member= method, to prevent write
|
67
|
-
struct.send(:undef_method, "[]=".to_sym)
|
68
|
-
struct.members.each do |member|
|
69
|
-
struct.send(:undef_method, "#{member}=".to_sym)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
data/lib/support/scenario.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
|
2
|
-
# For use in a scenario file, imports an existing scenario's code and objects
|
3
|
-
#
|
4
|
-
# @param [symbol, String] scenario_name The name of a scenario file
|
5
|
-
def __import scenario_name
|
6
|
-
::Datum::Helpers.import_file scenario_name, ::Datum.scenario_path, binding
|
7
|
-
end
|
8
|
-
|
9
|
-
# For use in a scenario file, clones the attributes of an existing instance
|
10
|
-
#
|
11
|
-
# @param [ActiveRecord::Base] resource An ActiveRecord Model instance
|
12
|
-
# @param [Hash] override_hash Hash of attributes / values to override from
|
13
|
-
# @return [Hash] Hash of attributes from provided resource
|
14
|
-
def __clone resource, override_hash = nil
|
15
|
-
::Datum::Helpers.clone_resource resource, override_hash
|
16
|
-
end
|
data/lib/support/test.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require "datum/helpers"
|
2
|
-
require "datum/container"
|
3
|
-
require "datum/datum"
|
4
|
-
|
5
|
-
# Extends ActiveSupport::Test with the process_scenario method and includes
|
6
|
-
# the Datum module
|
7
|
-
#
|
8
|
-
# @note Supports most extending test types (functional, integration, etc)
|
9
|
-
class ActiveSupport::TestCase
|
10
|
-
include Datum
|
11
|
-
# Imports a scenario file into the execution context of the current test
|
12
|
-
#
|
13
|
-
# @param [symbol, String] scenario_name The name of a scenario file
|
14
|
-
def process_scenario scenario_name
|
15
|
-
__import(scenario_name)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# Defines a test to work in conjuction with Datum struct extensions found in
|
20
|
-
# a file with the same name in the test/datum/data directory
|
21
|
-
#
|
22
|
-
# @param [String] name Name of the file in the datum/data directory
|
23
|
-
# @param [Block] block A block of Ruby code
|
24
|
-
def data_test name, &block
|
25
|
-
::Datum::Container.new(name, self)
|
26
|
-
self.send(:define_method, name, &block)
|
27
|
-
self.class_eval(::Datum::Helpers.read_file(name, ::Datum.data_path))
|
28
|
-
end
|