simple_interaction-rails 0.0.3 → 0.0.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f73a6c62c3dec5940828a799f898dca69365ff1
|
4
|
+
data.tar.gz: d70fd2748664ae4413bdcaa4f5036fbbc752b9ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a78336e7023fe1b544d57015b7d9a51c0a7e951695727a251bc9cb170aefb8d2620c927765c30d79776f7707070105a4689d7d3ac1dbd638febe4bad0ab7275
|
7
|
+
data.tar.gz: 2ff6dc9358f4f6ed5c1439c3f4947fd3110b6c80359ef8bd542cfd2986f8fd9a812095428d471bccf05aeb23986295a691dc062a3601bc9909d0ee25e76629c8
|
data/README.md
CHANGED
@@ -10,4 +10,25 @@ class InteractionGenerator < ::Rails::Generators::NamedBase
|
|
10
10
|
|
11
11
|
hook_for :test_framework
|
12
12
|
|
13
|
+
protected
|
14
|
+
|
15
|
+
def class_name
|
16
|
+
file_name.camelize
|
17
|
+
end
|
18
|
+
|
19
|
+
def interaction_namespaced(&block)
|
20
|
+
namespaces = class_path.reverse.map do |module_name|
|
21
|
+
build_namespaces(module_name)
|
22
|
+
end
|
23
|
+
content = capture(&block)
|
24
|
+
content = wrap_with_namespace(content) if namespaced?
|
25
|
+
content = indent(content).chomp
|
26
|
+
content = namespaces.reduce {|mod, memo| memo % mod } % content
|
27
|
+
concat(content)
|
28
|
+
end
|
29
|
+
|
30
|
+
def build_namespaces(module_name)
|
31
|
+
"module #{module_name.camelize}\n%s\nend\n"
|
32
|
+
end
|
33
|
+
|
13
34
|
end
|
@@ -4,7 +4,9 @@ require 'test_helper'
|
|
4
4
|
class <%= class_name %>Test < ActiveSupport::TestCase
|
5
5
|
|
6
6
|
def test_run_implemented
|
7
|
-
|
7
|
+
assert_nothing_raised do
|
8
|
+
<%= class_name %>.run
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
end
|