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: 8827de3786f69176bee130b330e1daec92e43b37
4
- data.tar.gz: 66e521faaa6beb0d6375e8a7dce4b10ae8b9dba3
3
+ metadata.gz: 3f73a6c62c3dec5940828a799f898dca69365ff1
4
+ data.tar.gz: d70fd2748664ae4413bdcaa4f5036fbbc752b9ed
5
5
  SHA512:
6
- metadata.gz: 6e328086161555f8383d10c4392656f980b67b44cd83c8df82568ab00edb8499c71d1052f79aacc835ac6784a89a5792756f93f384be5a1f567309c7e4ca9eea
7
- data.tar.gz: 5c1649e5ce330e9cb6be9aad253d6091e1ba62fc16a62c9124e0c88a85039cb40998b71c8d544d4524899ebce205549efb18bb2a10fbfce8d45f1d243ef9b276
6
+ metadata.gz: 9a78336e7023fe1b544d57015b7d9a51c0a7e951695727a251bc9cb170aefb8d2620c927765c30d79776f7707070105a4689d7d3ac1dbd638febe4bad0ab7275
7
+ data.tar.gz: 2ff6dc9358f4f6ed5c1439c3f4947fd3110b6c80359ef8bd542cfd2986f8fd9a812095428d471bccf05aeb23986295a691dc062a3601bc9909d0ee25e76629c8
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SimpleInteraction::Rails
2
2
 
3
- This is a work in progress tests are missing! And test generator is missing too
3
+ This is a work in progress tests are missing!
4
4
 
5
5
  This simply add a generator to your rails app to create interaction files
6
6
 
@@ -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
@@ -1,4 +1,4 @@
1
- <% module_namespacing do -%>
1
+ <% interaction_namespaced do -%>
2
2
  class <%= class_name %>
3
3
  include SimpleInteraction
4
4
  <% if options['requirements'].any? %>
@@ -4,7 +4,9 @@ require 'test_helper'
4
4
  class <%= class_name %>Test < ActiveSupport::TestCase
5
5
 
6
6
  def test_run_implemented
7
- assert <%= class_name %>.private_method_defined?(:run), 'You must implement a run method'
7
+ assert_nothing_raised do
8
+ <%= class_name %>.run
9
+ end
8
10
  end
9
11
 
10
12
  end
@@ -1,5 +1,5 @@
1
1
  module SimpleInteraction
2
2
  module Rails
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_interaction-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Boza