interaction 0.0.1 → 0.0.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/README.md +1 -1
- data/interaction.gemspec +1 -1
- data/lib/interaction.rb +2 -3
- data/lib/interaction/validation_helpers.rb +1 -1
- data/lib/interaction/version.rb +1 -1
- data/spec/interaction/validation_helpers_spec.rb +5 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f6540164e956df26bace2a6bf1587e87cf370d
|
4
|
+
data.tar.gz: 54f712fec342b6a37e583bd81f0e6c6f86e845ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f6eef545d0053a932be6dfac2403ba52989066a2bb004e5a9e6f8a213cf8b5f4ab72d3c3aa22920a0c35a577bc0c49e47602c8d72fe4fd8f606f0b078854e08
|
7
|
+
data.tar.gz: 3d35d32ead882c2eb60d0bdcc739a03492e9f1ca2a889bb76975b6e121aca655922f9ad7f896a89f3a669dd56b2dadb47285e61b6327824418b3f89e8d5b27de
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ application `SignUp`, `RequestResetPasswordEmail` etc.
|
|
7
7
|
Attributes are whitelisted and coerced into an expected type using Virtus. An
|
8
8
|
attribute will either be the specified type or nil.
|
9
9
|
|
10
|
-
Take a look at the [code itself](https://github.com/stevehodgkiss/
|
10
|
+
Take a look at the [code itself](https://github.com/stevehodgkiss/interaction/blob/master/lib/interaction.rb) for full details of the API provided.
|
11
11
|
|
12
12
|
## A simple example
|
13
13
|
|
data/interaction.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["steve@hodgkiss.me"]
|
11
11
|
spec.summary = %q{Provides a convention for modelling user interactions as use case classes.}
|
12
12
|
spec.description = %q{}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/stevehodgkiss/interaction"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/interaction.rb
CHANGED
@@ -3,9 +3,8 @@ require "interaction/params"
|
|
3
3
|
require "interaction/validation_helpers"
|
4
4
|
|
5
5
|
module Interaction
|
6
|
-
# Override Ruby's module inclusion hook to prepend base with
|
7
|
-
#
|
8
|
-
# ActiveSupport::Validation.
|
6
|
+
# Override Ruby's module inclusion hook to prepend base with #perform,
|
7
|
+
# extend base with a .perform method, and include Params for Virtus.
|
9
8
|
#
|
10
9
|
# @api private
|
11
10
|
def self.included(base)
|
data/lib/interaction/version.rb
CHANGED
@@ -12,11 +12,12 @@ describe Interaction::ValidationHelpers do
|
|
12
12
|
ActiveModel::Name.new(self, nil, "Test")
|
13
13
|
end
|
14
14
|
|
15
|
-
attr_accessor :name
|
15
|
+
attr_accessor :name, :result
|
16
16
|
validates :name, presence: true
|
17
17
|
|
18
18
|
def perform
|
19
19
|
validate!
|
20
|
+
@result = true
|
20
21
|
end
|
21
22
|
|
22
23
|
public :merge_errors
|
@@ -45,12 +46,15 @@ describe Interaction::ValidationHelpers do
|
|
45
46
|
let(:params) { {} }
|
46
47
|
|
47
48
|
it { should_not be_success }
|
49
|
+
it { expect(use_case.result).to be_nil }
|
48
50
|
end
|
49
51
|
|
50
52
|
context 'when validation succeeds' do
|
51
53
|
let(:params) { { name: 'Test' } }
|
52
54
|
|
53
55
|
it { should be_success }
|
56
|
+
|
57
|
+
it { expect(use_case.result).to eq(true) }
|
54
58
|
end
|
55
59
|
end
|
56
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Hodgkiss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -102,7 +102,7 @@ files:
|
|
102
102
|
- spec/interaction/validation_helpers_spec.rb
|
103
103
|
- spec/interaction_spec.rb
|
104
104
|
- spec/spec_helper.rb
|
105
|
-
homepage:
|
105
|
+
homepage: https://github.com/stevehodgkiss/interaction
|
106
106
|
licenses:
|
107
107
|
- MIT
|
108
108
|
metadata: {}
|