tradesman 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3709e7f3b27cda92aaf6dc131eaf6aa1b3de869
4
- data.tar.gz: 9862de5df502cccce9682806e1710df738f4bde1
3
+ metadata.gz: 775cba2453d710d366ab8baefe83cb5f159bce97
4
+ data.tar.gz: 54e46fd0e368979137809e39398a6cec79319d74
5
5
  SHA512:
6
- metadata.gz: c1219785e7c94d998ba219a11764daf8df4d76d1073e43ba0a73ee9f31b40df982f90e15d602ebdb53f7ac7fbdd805331207765074549fdde8c9e0817d0f5da2
7
- data.tar.gz: 56650c880247e12f10b6638bfab459bbddd5cbcc1c5c6d533235221175d7aa27c1ee2059f185d49dbe4bcddae3b1b26cc7aa9ab6a6bea1514a653cb63e0b56fb
6
+ metadata.gz: 9fea98170b6eb07ee3e1415bcf6ef9231c2a9968a71994d8859e61c4d54654971e3fc223f8d4ef9ce01b98c107b8b6011880e53490c03134716bfe7fde2717ea
7
+ data.tar.gz: d182ec3e7ca01341b4224cc99144460cc6ab1ea569b6d4d829b7f156c0fcfdec01ced8755b75aa31106601b7a3757c36068987d39baad6ae4d66e1c06013c1ee
@@ -3,7 +3,7 @@ module Tradesman
3
3
  attr_reader :class_name, :action_string, :subject_string, :parent_string
4
4
 
5
5
  PARSE_REGEX = /(Create|Update|Delete)(.+)/
6
- PARSE_REGEX_WITH_PARENT = /(Create|Update|Delete)(.+)4(.+)/
6
+ PARSE_REGEX_WITH_PARENT = /(Create)([A-Z]+.+)For([A-Z]+.+)/
7
7
 
8
8
  def initialize(class_name)
9
9
  @class_name = class_name
@@ -31,7 +31,7 @@ module Tradesman
31
31
  private
32
32
 
33
33
  def regex
34
- /.+4.+/.match(@class_name) ? PARSE_REGEX_WITH_PARENT : PARSE_REGEX
34
+ /.+For[A-Z]+.+/.match(@class_name) ? PARSE_REGEX_WITH_PARENT : PARSE_REGEX
35
35
  end
36
36
 
37
37
  def str_to_sym(str)
data/spec/parser_spec.rb CHANGED
@@ -18,8 +18,8 @@ describe Tradesman::Parser do
18
18
  end
19
19
  end
20
20
 
21
- context 'CreateUser4Employer' do
22
- subject { Tradesman::Parser.new('CreateUser4Employer') }
21
+ context 'CreateUserForEmployer' do
22
+ subject { Tradesman::Parser.new('CreateUserForEmployer') }
23
23
 
24
24
  it 'finds a match' do
25
25
  expect(subject.match?).to be true
@@ -38,6 +38,94 @@ describe Tradesman::Parser do
38
38
  end
39
39
  end
40
40
 
41
+ context 'CreateFortressForSkeletor' do
42
+ subject { Tradesman::Parser.new('CreateFortressForSkeletor') }
43
+
44
+ it 'finds a match' do
45
+ expect(subject.match?).to be true
46
+ end
47
+
48
+ it 'parses the action' do
49
+ expect(subject.action).to eq :create
50
+ end
51
+
52
+ it 'parses the subject' do
53
+ expect(subject.subject).to eq :fortress
54
+ end
55
+
56
+ it 'parses the parent' do
57
+ expect(subject.parent).to eq :skeletor
58
+ end
59
+ end
60
+
61
+ context 'CreateCloudFormationForSky' do
62
+ subject { Tradesman::Parser.new('CreateCloudFormationForSky') }
63
+
64
+ it 'finds a match' do
65
+ expect(subject.match?).to be true
66
+ end
67
+
68
+ it 'parses the action' do
69
+ expect(subject.action).to eq :create
70
+ end
71
+
72
+ it 'parses the subject' do
73
+ expect(subject.subject).to eq :cloud_formation
74
+ end
75
+
76
+ it 'parses the parent' do
77
+ expect(subject.parent).to eq :sky
78
+ end
79
+ end
80
+
81
+ context 'CreateWallForFortress' do
82
+ subject { Tradesman::Parser.new('CreateWallForFortress') }
83
+
84
+ it 'finds a match' do
85
+ expect(subject.match?).to be true
86
+ end
87
+
88
+ it 'parses the action' do
89
+ expect(subject.action).to eq :create
90
+ end
91
+
92
+ it 'parses the subject' do
93
+ expect(subject.subject).to eq :wall
94
+ end
95
+
96
+ it 'parses the parent' do
97
+ expect(subject.parent).to eq :fortress
98
+ end
99
+ end
100
+
101
+ context 'CreateHailForCloudFormation' do
102
+ subject { Tradesman::Parser.new('CreateHailForCloudFormation') }
103
+
104
+ it 'finds a match' do
105
+ expect(subject.match?).to be true
106
+ end
107
+
108
+ it 'parses the action' do
109
+ expect(subject.action).to eq :create
110
+ end
111
+
112
+ it 'parses the subject' do
113
+ expect(subject.subject).to eq :hail
114
+ end
115
+
116
+ it 'parses the parent' do
117
+ expect(subject.parent).to eq :cloud_formation
118
+ end
119
+ end
120
+
121
+ context 'UpdateFortressForSkeletor' do
122
+ subject { Tradesman::Parser.new('UpdateFortressForSkeletor') }
123
+
124
+ it 'finds a match' do
125
+ expect(subject.match?).to be false
126
+ end
127
+ end
128
+
41
129
  context 'DeleteCustomerInvoice' do
42
130
  subject { Tradesman::Parser.new('DeleteCustomerInvoice') }
43
131
 
@@ -81,7 +81,7 @@ describe Tradesman do
81
81
 
82
82
  context 'for parent' do
83
83
  let(:employer) { TradesmanSpec::Employer.create }
84
- let(:outcome) { Tradesman::CreateUser4Employer.run(parent_id: employer.id, last_name: 'Turner') }
84
+ let(:outcome) { Tradesman::CreateUserForEmployer.run(parent_id: employer.id, last_name: 'Turner') }
85
85
 
86
86
  it 'creates a new record' do
87
87
  expect(outcome.success?).to be true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tradesman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Turner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-28 00:00:00.000000000 Z
12
+ date: 2015-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: horza