slimkeyfy 0.0.1
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 +7 -0
- data/.gitignore +34 -0
- data/.rspec +3 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +22 -0
- data/LICENSE +21 -0
- data/README.md +172 -0
- data/bin/slimkeyfy +5 -0
- data/lib/.DS_Store +0 -0
- data/lib/slimkeyfy/console/command_line.rb +90 -0
- data/lib/slimkeyfy/console/io_action.rb +30 -0
- data/lib/slimkeyfy/console/printer.rb +50 -0
- data/lib/slimkeyfy/console/translate.rb +101 -0
- data/lib/slimkeyfy/console.rb +8 -0
- data/lib/slimkeyfy/slimutils/file_utils.rb +61 -0
- data/lib/slimkeyfy/slimutils/hash_merging.rb +84 -0
- data/lib/slimkeyfy/slimutils/key_generator.rb +70 -0
- data/lib/slimkeyfy/slimutils/yaml_processor.rb +56 -0
- data/lib/slimkeyfy/slimutils.rb +8 -0
- data/lib/slimkeyfy/transformer/base_transformer.rb +42 -0
- data/lib/slimkeyfy/transformer/controller_transformer.rb +20 -0
- data/lib/slimkeyfy/transformer/slim_transformer.rb +92 -0
- data/lib/slimkeyfy/transformer/whitespacer.rb +48 -0
- data/lib/slimkeyfy/transformer/word.rb +49 -0
- data/lib/slimkeyfy/transformer.rb +9 -0
- data/lib/slimkeyfy/version.rb +3 -0
- data/lib/slimkeyfy.rb +12 -0
- data/slimkeyfy.gemspec +21 -0
- data/vendor/bundle/bin/htmldiff +25 -0
- data/vendor/bundle/bin/ldiff +25 -0
- data/vendor/bundle/bin/rspec +23 -0
- data/vendor/bundle/build_info/diff-lcs-1.2.5.info +1 -0
- data/vendor/bundle/build_info/rspec-3.0.0.info +1 -0
- data/vendor/bundle/build_info/rspec-core-3.0.2.info +1 -0
- data/vendor/bundle/build_info/rspec-expectations-3.0.2.info +1 -0
- data/vendor/bundle/build_info/rspec-mocks-3.0.2.info +1 -0
- data/vendor/bundle/build_info/rspec-support-3.0.2.info +1 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/.autotest +3 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/.gemtest +0 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/.hoerc +2 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/.rspec +2 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/.travis.yml +22 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/Contributing.rdoc +64 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/Gemfile +20 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/History.rdoc +152 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/License.rdoc +39 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/Manifest.txt +38 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/README.rdoc +85 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/Rakefile +41 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/autotest/discover.rb +1 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/bin/htmldiff +32 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/bin/ldiff +6 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/docs/COPYING.txt +339 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/docs/artistic.txt +127 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/array.rb +7 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/block.rb +37 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/callbacks.rb +322 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/change.rb +177 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/htmldiff.rb +149 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/hunk.rb +276 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/internals.rb +301 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/ldiff.rb +195 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/string.rb +5 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs.rb +805 -0
- data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff-lcs.rb +3 -0
- data/vendor/bundle/gems/rspec-3.0.0/License.txt +24 -0
- data/vendor/bundle/gems/rspec-3.0.0/README.md +47 -0
- data/vendor/bundle/gems/rspec-3.0.0/lib/rspec.rb +3 -0
- data/vendor/bundle/gems/rspec-core-3.0.2/.document +5 -0
- data/vendor/bundle/gems/rspec-core-3.0.2/.yardopts +7 -0
- data/vendor/bundle/gems/rspec-core-3.0.2/Changelog.md +1466 -0
- data/vendor/bundle/gems/rspec-core-3.0.2/License.txt +25 -0
- data/vendor/bundle/gems/rspec-core-3.0.2/README.md +243 -0
- data/vendor/bundle/gems/rspec-core-3.0.2/exe/rspec +4 -0
- data/vendor/bundle/gems/rspec-expectations-3.0.2/.document +5 -0
- data/vendor/bundle/gems/rspec-expectations-3.0.2/.yardopts +6 -0
- data/vendor/bundle/gems/rspec-expectations-3.0.2/Changelog.md +749 -0
- data/vendor/bundle/gems/rspec-expectations-3.0.2/License.txt +24 -0
- data/vendor/bundle/gems/rspec-expectations-3.0.2/README.md +278 -0
- data/vendor/bundle/gems/rspec-mocks-3.0.2/.document +5 -0
- data/vendor/bundle/gems/rspec-mocks-3.0.2/.yardopts +6 -0
- data/vendor/bundle/gems/rspec-mocks-3.0.2/Changelog.md +733 -0
- data/vendor/bundle/gems/rspec-mocks-3.0.2/License.txt +24 -0
- data/vendor/bundle/gems/rspec-mocks-3.0.2/README.md +380 -0
- data/vendor/bundle/gems/rspec-support-3.0.2/Changelog.md +30 -0
- data/vendor/bundle/gems/rspec-support-3.0.2/LICENSE.txt +22 -0
- data/vendor/bundle/gems/rspec-support-3.0.2/README.md +17 -0
- data/vendor/bundle/specifications/diff-lcs-1.2.5.gemspec +68 -0
- data/vendor/bundle/specifications/rspec-3.0.0.gemspec +43 -0
- data/vendor/bundle/specifications/rspec-core-3.0.2.gemspec +66 -0
- data/vendor/bundle/specifications/rspec-expectations-3.0.2.gemspec +51 -0
- data/vendor/bundle/specifications/rspec-mocks-3.0.2.gemspec +48 -0
- data/vendor/bundle/specifications/rspec-support-3.0.2.gemspec +42 -0
- metadata +153 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2012 David Chelimsky, Myron Marston
|
|
4
|
+
Copyright (c) 2006 David Chelimsky, The RSpec Development Team
|
|
5
|
+
Copyright (c) 2005 Steven Baker
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# RSpec Expectations [](http://travis-ci.org/rspec/rspec-expectations) [](https://codeclimate.com/github/rspec/rspec-expectations)
|
|
2
|
+
|
|
3
|
+
RSpec::Expectations lets you express expected outcomes on an object in an
|
|
4
|
+
example.
|
|
5
|
+
|
|
6
|
+
expect(account.balance).to eq(Money.new(37.42, :USD))
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
If you want to use rspec-expectations with rspec, just install the rspec gem
|
|
11
|
+
and RubyGems will also install rspec-expectations for you (along with
|
|
12
|
+
rspec-core and rspec-mocks):
|
|
13
|
+
|
|
14
|
+
gem install rspec
|
|
15
|
+
|
|
16
|
+
If you want to use rspec-expectations with another tool, like Test::Unit,
|
|
17
|
+
Minitest, or Cucumber, you can install it directly:
|
|
18
|
+
|
|
19
|
+
gem install rspec-expectations
|
|
20
|
+
|
|
21
|
+
## Basic usage
|
|
22
|
+
|
|
23
|
+
Here's an example using rspec-core:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
RSpec.describe Order do
|
|
27
|
+
it "sums the prices of the items in its line items" do
|
|
28
|
+
order = Order.new
|
|
29
|
+
order.add_entry(LineItem.new(:item => Item.new(
|
|
30
|
+
:price => Money.new(1.11, :USD)
|
|
31
|
+
)))
|
|
32
|
+
order.add_entry(LineItem.new(:item => Item.new(
|
|
33
|
+
:price => Money.new(2.22, :USD),
|
|
34
|
+
:quantity => 2
|
|
35
|
+
)))
|
|
36
|
+
expect(order.total).to eq(Money.new(5.55, :USD))
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The `describe` and `it` methods come from rspec-core. The `Order`, `LineItem`, `Item` and `Money` classes would be from _your_ code. The last line of the example
|
|
42
|
+
expresses an expected outcome. If `order.total == Money.new(5.55, :USD)`, then
|
|
43
|
+
the example passes. If not, it fails with a message like:
|
|
44
|
+
|
|
45
|
+
expected: #<Money @value=5.55 @currency=:USD>
|
|
46
|
+
got: #<Money @value=1.11 @currency=:USD>
|
|
47
|
+
|
|
48
|
+
## Built-in matchers
|
|
49
|
+
|
|
50
|
+
### Equivalence
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
expect(actual).to eq(expected) # passes if actual == expected
|
|
54
|
+
expect(actual).to eql(expected) # passes if actual.eql?(expected)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Note: The new `expect` syntax no longer supports the `==` matcher.
|
|
58
|
+
|
|
59
|
+
### Identity
|
|
60
|
+
|
|
61
|
+
```ruby
|
|
62
|
+
expect(actual).to be(expected) # passes if actual.equal?(expected)
|
|
63
|
+
expect(actual).to equal(expected) # passes if actual.equal?(expected)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Comparisons
|
|
67
|
+
|
|
68
|
+
```ruby
|
|
69
|
+
expect(actual).to be > expected
|
|
70
|
+
expect(actual).to be >= expected
|
|
71
|
+
expect(actual).to be <= expected
|
|
72
|
+
expect(actual).to be < expected
|
|
73
|
+
expect(actual).to be_within(delta).of(expected)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Regular expressions
|
|
77
|
+
|
|
78
|
+
```ruby
|
|
79
|
+
expect(actual).to match(/expression/)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Note: The new `expect` syntax no longer supports the `=~` matcher.
|
|
83
|
+
|
|
84
|
+
### Types/classes
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
expect(actual).to be_an_instance_of(expected) # passes if actual.class == expected
|
|
88
|
+
expect(actual).to be_a(expected) # passes if actual.is_a?(expected)
|
|
89
|
+
expect(actual).to be_an(expected) # an alias for be_a
|
|
90
|
+
expect(actual).to be_a_kind_of(expected) # another alias
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Truthiness
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
expect(actual).to be_truthy # passes if actual is truthy (not nil or false)
|
|
97
|
+
expect(actual).to be true # passes if actual == true
|
|
98
|
+
expect(actual).to be_falsy # passes if actual is falsy (nil or false)
|
|
99
|
+
expect(actual).to be false # passes if actual == false
|
|
100
|
+
expect(actual).to be_nil # passes if actual is nil
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Expecting errors
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
expect { ... }.to raise_error
|
|
107
|
+
expect { ... }.to raise_error(ErrorClass)
|
|
108
|
+
expect { ... }.to raise_error("message")
|
|
109
|
+
expect { ... }.to raise_error(ErrorClass, "message")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Expecting throws
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
expect { ... }.to throw_symbol
|
|
116
|
+
expect { ... }.to throw_symbol(:symbol)
|
|
117
|
+
expect { ... }.to throw_symbol(:symbol, 'value')
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Yielding
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
expect { |b| 5.tap(&b) }.to yield_control # passes regardless of yielded args
|
|
124
|
+
|
|
125
|
+
expect { |b| yield_if_true(true, &b) }.to yield_with_no_args # passes only if no args are yielded
|
|
126
|
+
|
|
127
|
+
expect { |b| 5.tap(&b) }.to yield_with_args(5)
|
|
128
|
+
expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum)
|
|
129
|
+
expect { |b| "a string".tap(&b) }.to yield_with_args(/str/)
|
|
130
|
+
|
|
131
|
+
expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
|
|
132
|
+
expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Predicate matchers
|
|
136
|
+
|
|
137
|
+
```ruby
|
|
138
|
+
expect(actual).to be_xxx # passes if actual.xxx?
|
|
139
|
+
expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Ranges (Ruby >= 1.9 only)
|
|
143
|
+
|
|
144
|
+
```ruby
|
|
145
|
+
expect(1..10).to cover(3)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Collection membership
|
|
149
|
+
|
|
150
|
+
```ruby
|
|
151
|
+
expect(actual).to include(expected)
|
|
152
|
+
expect(actual).to start_with(expected)
|
|
153
|
+
expect(actual).to end_with(expected)
|
|
154
|
+
|
|
155
|
+
expect(actual).to contain_exactly(individual, items)
|
|
156
|
+
# ...which is the same as:
|
|
157
|
+
expect(actual).to match_array(expected_array)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### Examples
|
|
161
|
+
|
|
162
|
+
```ruby
|
|
163
|
+
expect([1, 2, 3]).to include(1)
|
|
164
|
+
expect([1, 2, 3]).to include(1, 2)
|
|
165
|
+
expect([1, 2, 3]).to start_with(1)
|
|
166
|
+
expect([1, 2, 3]).to start_with(1, 2)
|
|
167
|
+
expect([1, 2, 3]).to end_with(3)
|
|
168
|
+
expect([1, 2, 3]).to end_with(2, 3)
|
|
169
|
+
expect({:a => 'b'}).to include(:a => 'b')
|
|
170
|
+
expect("this string").to include("is str")
|
|
171
|
+
expect("this string").to start_with("this")
|
|
172
|
+
expect("this string").to end_with("ring")
|
|
173
|
+
expect([1, 2, 3]).to contain_exactly(2, 3, 1)
|
|
174
|
+
expect([1, 2, 3]).to match_array([3, 2, 1])
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## `should` syntax
|
|
178
|
+
|
|
179
|
+
In addition to the `expect` syntax, rspec-expectations continues to support the
|
|
180
|
+
`should` syntax:
|
|
181
|
+
|
|
182
|
+
```ruby
|
|
183
|
+
actual.should eq expected
|
|
184
|
+
actual.should be > 3
|
|
185
|
+
[1, 2, 3].should_not include 4
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
See [detailed information on the `should` syntax and its usage.](https://github.com/rspec/rspec-expectations/blob/master/Should.md)
|
|
189
|
+
|
|
190
|
+
## Compound Matcher Expressions
|
|
191
|
+
|
|
192
|
+
You can also create compound matcher expressions using `and` or `or`:
|
|
193
|
+
|
|
194
|
+
``` ruby
|
|
195
|
+
expect(alphabet).to start_with("a").and end_with("z")
|
|
196
|
+
expect(stoplight.color).to eq("red").or eq("green").or eq("yellow")
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Composing Matchers
|
|
200
|
+
|
|
201
|
+
Many of the built-in matchers are designed to take matchers as
|
|
202
|
+
arguments, to allow you to flexibly specify only the essential
|
|
203
|
+
aspects of an object or data structure. In addition, all of the
|
|
204
|
+
built-in matchers have one or more aliases that provide better
|
|
205
|
+
phrasing for when they are used as arguments to another matcher.
|
|
206
|
+
|
|
207
|
+
### Examples
|
|
208
|
+
|
|
209
|
+
```ruby
|
|
210
|
+
expect { k += 1.05 }.to change { k }.by( a_value_within(0.1).of(1.0) )
|
|
211
|
+
|
|
212
|
+
expect { s = "barn" }.to change { s }
|
|
213
|
+
.from( a_string_matching(/foo/) )
|
|
214
|
+
.to( a_string_matching(/bar/) )
|
|
215
|
+
|
|
216
|
+
expect(["barn", 2.45]).to contain_exactly(
|
|
217
|
+
a_value_within(0.1).of(2.5),
|
|
218
|
+
a_string_starting_with("bar")
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
expect(["barn", "food", 2.45]).to end_with(
|
|
222
|
+
a_string_matching("foo"),
|
|
223
|
+
a_value > 2
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
expect(["barn", 2.45]).to include( a_string_starting_with("bar") )
|
|
227
|
+
|
|
228
|
+
expect(:a => "food", :b => "good").to include(:a => a_string_matching(/foo/))
|
|
229
|
+
|
|
230
|
+
hash = {
|
|
231
|
+
:a => {
|
|
232
|
+
:b => ["foo", 5],
|
|
233
|
+
:c => { :d => 2.05 }
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
expect(hash).to match(
|
|
238
|
+
:a => {
|
|
239
|
+
:b => a_collection_containing_exactly(
|
|
240
|
+
a_string_starting_with("f"),
|
|
241
|
+
an_instance_of(Fixnum)
|
|
242
|
+
),
|
|
243
|
+
:c => { :d => (a_value < 3) }
|
|
244
|
+
}
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
expect { |probe|
|
|
248
|
+
[1, 2, 3].each(&probe)
|
|
249
|
+
}.to yield_successive_args( a_value < 2, 2, a_value > 2 )
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Usage outside rspec-core
|
|
253
|
+
|
|
254
|
+
You always need to load `rspec/expectations` even if you only want to use one part of the library:
|
|
255
|
+
|
|
256
|
+
```ruby
|
|
257
|
+
require 'rspec/expectations'
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Then simply include `RSpec::Matchers` in any class:
|
|
261
|
+
|
|
262
|
+
```ruby
|
|
263
|
+
class MyClass
|
|
264
|
+
include RSpec::Matchers
|
|
265
|
+
|
|
266
|
+
def do_something(arg)
|
|
267
|
+
expect(arg).to be > 0
|
|
268
|
+
# do other stuff
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Also see
|
|
274
|
+
|
|
275
|
+
* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
|
|
276
|
+
* [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core)
|
|
277
|
+
* [http://github.com/rspec/rspec-mocks](http://github.com/rspec/rspec-mocks)
|
|
278
|
+
* [http://github.com/rspec/rspec-collection_matchers](https://github.com/rspec/rspec-collection_matchers)
|