freud 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,74 @@
1
+ require "spec_helper"
2
+ require "freud/variables"
3
+
4
+ RSpec.describe Freud::Variables do
5
+ let(:vars) { Freud::Variables.new }
6
+
7
+ it "#merge" do
8
+ vars.merge(answer: 42)
9
+ expect(vars.fetch(:answer)).to eq(42)
10
+ end
11
+
12
+ it "#fetch unknown" do
13
+ expect { vars.fetch(:answer) }.to raise_error(KeyError)
14
+ end
15
+
16
+ it "#fetch default" do
17
+ expect(vars.fetch(:answer, 42)).to eq(42)
18
+ end
19
+
20
+ describe "#apply" do
21
+ before(:each) { vars.merge(answer: 42) }
22
+
23
+ it { expect(vars.apply("answer")).to eq("answer") }
24
+
25
+ it { expect(vars.apply("%answer")).to eq("42") }
26
+
27
+ it { expect(vars.apply("%{answer}")).to eq("42") }
28
+
29
+ it { expect(vars.apply("\\%answer")).to eq("%answer") }
30
+
31
+ it { expect(vars.apply("\\%{answer}")).to eq("%{answer}") }
32
+
33
+ it { expect(vars.apply("\\%{nope|66}")).to eq("%{nope|66}") }
34
+
35
+ it { expect(vars.apply("%{nope|66}")).to eq("66") }
36
+
37
+ it { expect(vars.apply("%{answer|66}")).to eq("42") }
38
+
39
+ it { expect(vars.apply("%answer|66")).to eq("42|66") }
40
+
41
+ it { expect { vars.apply("%ANSWER") }.to raise_error(KeyError) }
42
+
43
+ it "nested" do
44
+ vars.merge(outer: "a %inner", inner: "b")
45
+ expect(vars.apply("%outer")).to eq("a b")
46
+ end
47
+
48
+ it "nested default" do
49
+ vars.merge(outer: "a %{nope|%inner}", inner: "b")
50
+ expect(vars.apply("%outer")).to eq("a b")
51
+ end
52
+
53
+ it "nested loop" do
54
+ vars.merge(outer: "a %inner", inner: "b %outer")
55
+ expect { vars.apply("%outer") }.to raise_error(RuntimeError)
56
+ end
57
+ end
58
+
59
+ describe "#test" do
60
+ it { expect(vars.test("%answer")).to be(true) }
61
+
62
+ it { expect(vars.test("%{answer}")).to be(true) }
63
+
64
+ it { expect(vars.test("%{answer|66}")).to be(true) }
65
+
66
+ it { expect(vars.test("answer")).to be(false) }
67
+
68
+ it { expect(vars.test("\\%answer")).to be(false) }
69
+
70
+ it { expect(vars.test("\\%{answer}")).to be(false) }
71
+
72
+ it { expect(vars.test("\\%{answer|66}")).to be(false) }
73
+ end
74
+ end
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: freud
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Don Werve
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 3.0.0
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '3.0'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 3.0.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: guard
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '2.8'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.8'
75
+ - !ruby/object:Gem::Dependency
76
+ name: guard-rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '4.3'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '4.3'
89
+ - !ruby/object:Gem::Dependency
90
+ name: ruby_gntp
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: simplecov
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: pry
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ description: A command-line tool for launching and managing daemons and associated
132
+ infrastructure.
133
+ email:
134
+ - don@werve.net
135
+ executables:
136
+ - freud
137
+ extensions: []
138
+ extra_rdoc_files: []
139
+ files:
140
+ - ".gitignore"
141
+ - Gemfile
142
+ - Guardfile
143
+ - LICENSE.txt
144
+ - README.md
145
+ - Rakefile
146
+ - bin/freud
147
+ - freud.gemspec
148
+ - lib/freud.rb
149
+ - lib/freud/config.rb
150
+ - lib/freud/launcher.rb
151
+ - lib/freud/logging.rb
152
+ - lib/freud/pidfile.rb
153
+ - lib/freud/runner.rb
154
+ - lib/freud/variables.rb
155
+ - lib/freud/version.rb
156
+ - spec/config_spec.rb
157
+ - spec/fixtures/true.json
158
+ - spec/launcher_spec.rb
159
+ - spec/pidfile_spec.rb
160
+ - spec/runner_spec.rb
161
+ - spec/spec_helper.rb
162
+ - spec/variables_spec.rb
163
+ homepage: http://github.com/matadon/freud
164
+ licenses:
165
+ - Apache-2.0
166
+ metadata: {}
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubyforge_project:
183
+ rubygems_version: 2.2.2
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: Help for your inner daemons.
187
+ test_files:
188
+ - spec/config_spec.rb
189
+ - spec/fixtures/true.json
190
+ - spec/launcher_spec.rb
191
+ - spec/pidfile_spec.rb
192
+ - spec/runner_spec.rb
193
+ - spec/spec_helper.rb
194
+ - spec/variables_spec.rb