snake_params 0.1.0
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 +15 -0
- data/.overcommit.yml +7 -0
- data/.rubocop.yml +256 -0
- data/.travis.yml +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/lib/snake_params.rb +40 -0
- data/lib/snake_params/version.rb +3 -0
- data/snake_params.gemspec +29 -0
- data/spec/snake_params_spec.rb +62 -0
- data/spec/spec_helper.rb +43 -0
- metadata +143 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 9940687d4a6605fde359d7cd49ad28eab0dec5bf
|
|
4
|
+
data.tar.gz: 2a746732434d6837cba196315a1698500e8ae952
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d9df509e9ea26dc14918482dd2672af3e22f1b72bb4b5bcdd4d0d50b6b2950e49d0fbe6af09fb6316b633c712c80d5bec7704de5afd84fdae5e13c33ba14d77c
|
|
7
|
+
data.tar.gz: 1fa55b50a5fc7135e6d47cd7cef80047a086fee1ee51dea16196e0d4cab693bb3556e894bbff12ad24268fa7f78e12ae7a1d20c5a0f8ac3e4eea9c308e0b2010
|
data/.gitignore
ADDED
data/.overcommit.yml
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
AccessorMethodName:
|
|
2
|
+
Enabled: false
|
|
3
|
+
|
|
4
|
+
Alias:
|
|
5
|
+
Enabled: false
|
|
6
|
+
|
|
7
|
+
AmbiguousOperator:
|
|
8
|
+
Enabled: false
|
|
9
|
+
|
|
10
|
+
AmbiguousRegexpLiteral:
|
|
11
|
+
Enabled: false
|
|
12
|
+
|
|
13
|
+
ArrayJoin:
|
|
14
|
+
Enabled: false
|
|
15
|
+
|
|
16
|
+
AsciiComments:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
|
19
|
+
AsciiIdentifiers:
|
|
20
|
+
Enabled: false
|
|
21
|
+
|
|
22
|
+
AssignmentInCondition:
|
|
23
|
+
Enabled: true
|
|
24
|
+
|
|
25
|
+
Attr:
|
|
26
|
+
Enabled: false
|
|
27
|
+
|
|
28
|
+
BlockNesting:
|
|
29
|
+
Enabled: false
|
|
30
|
+
|
|
31
|
+
BracesAroundHashParameters:
|
|
32
|
+
Enabled: false
|
|
33
|
+
|
|
34
|
+
CaseEquality:
|
|
35
|
+
Enabled: false
|
|
36
|
+
|
|
37
|
+
CharacterLiteral:
|
|
38
|
+
Enabled: false
|
|
39
|
+
|
|
40
|
+
ClassLength:
|
|
41
|
+
Enabled: false
|
|
42
|
+
|
|
43
|
+
ClassVars:
|
|
44
|
+
Enabled: false
|
|
45
|
+
|
|
46
|
+
CollectionMethods:
|
|
47
|
+
PreferredMethods:
|
|
48
|
+
find: detect
|
|
49
|
+
reduce: inject
|
|
50
|
+
collect: map
|
|
51
|
+
find_all: select
|
|
52
|
+
|
|
53
|
+
ColonMethodCall:
|
|
54
|
+
Enabled: false
|
|
55
|
+
|
|
56
|
+
CommentAnnotation:
|
|
57
|
+
Enabled: false
|
|
58
|
+
|
|
59
|
+
ConditionPosition:
|
|
60
|
+
Enabled: false
|
|
61
|
+
|
|
62
|
+
CyclomaticComplexity:
|
|
63
|
+
Enabled: false
|
|
64
|
+
|
|
65
|
+
Delegate:
|
|
66
|
+
Enabled: false
|
|
67
|
+
|
|
68
|
+
DeprecatedClassMethods:
|
|
69
|
+
Enabled: false
|
|
70
|
+
|
|
71
|
+
DeprecatedHashMethods:
|
|
72
|
+
Enabled: false
|
|
73
|
+
|
|
74
|
+
Documentation:
|
|
75
|
+
Enabled: false
|
|
76
|
+
|
|
77
|
+
DotPosition:
|
|
78
|
+
EnforcedStyle: trailing
|
|
79
|
+
|
|
80
|
+
DoubleNegation:
|
|
81
|
+
Enabled: false
|
|
82
|
+
|
|
83
|
+
ElseLayout:
|
|
84
|
+
Enabled: false
|
|
85
|
+
|
|
86
|
+
EmptyLiteral:
|
|
87
|
+
Enabled: false
|
|
88
|
+
|
|
89
|
+
Encoding:
|
|
90
|
+
Enabled: false
|
|
91
|
+
|
|
92
|
+
EvenOdd:
|
|
93
|
+
Enabled: false
|
|
94
|
+
|
|
95
|
+
FileName:
|
|
96
|
+
Enabled: false
|
|
97
|
+
|
|
98
|
+
FlipFlop:
|
|
99
|
+
Enabled: false
|
|
100
|
+
|
|
101
|
+
FormatString:
|
|
102
|
+
Enabled: false
|
|
103
|
+
|
|
104
|
+
GlobalVars:
|
|
105
|
+
Enabled: false
|
|
106
|
+
|
|
107
|
+
HandleExceptions:
|
|
108
|
+
Enabled: false
|
|
109
|
+
|
|
110
|
+
IfUnlessModifier:
|
|
111
|
+
Enabled: false
|
|
112
|
+
|
|
113
|
+
IfWithSemicolon:
|
|
114
|
+
Enabled: false
|
|
115
|
+
|
|
116
|
+
InvalidCharacterLiteral:
|
|
117
|
+
Enabled: false
|
|
118
|
+
|
|
119
|
+
Lambda:
|
|
120
|
+
Enabled: false
|
|
121
|
+
|
|
122
|
+
LambdaCall:
|
|
123
|
+
Enabled: false
|
|
124
|
+
|
|
125
|
+
LineEndConcatenation:
|
|
126
|
+
Enabled: false
|
|
127
|
+
|
|
128
|
+
LineLength:
|
|
129
|
+
Max: 80
|
|
130
|
+
|
|
131
|
+
LiteralInCondition:
|
|
132
|
+
Enabled: false
|
|
133
|
+
|
|
134
|
+
LiteralInInterpolation:
|
|
135
|
+
Enabled: false
|
|
136
|
+
|
|
137
|
+
Loop:
|
|
138
|
+
Enabled: false
|
|
139
|
+
|
|
140
|
+
MethodLength:
|
|
141
|
+
Enabled: false
|
|
142
|
+
|
|
143
|
+
ModuleFunction:
|
|
144
|
+
Enabled: false
|
|
145
|
+
|
|
146
|
+
NegatedIf:
|
|
147
|
+
Enabled: false
|
|
148
|
+
|
|
149
|
+
NegatedWhile:
|
|
150
|
+
Enabled: false
|
|
151
|
+
|
|
152
|
+
Next:
|
|
153
|
+
Enabled: false
|
|
154
|
+
|
|
155
|
+
NilComparison:
|
|
156
|
+
Enabled: false
|
|
157
|
+
|
|
158
|
+
Not:
|
|
159
|
+
Enabled: false
|
|
160
|
+
|
|
161
|
+
NumericLiterals:
|
|
162
|
+
Enabled: false
|
|
163
|
+
|
|
164
|
+
OneLineConditional:
|
|
165
|
+
Enabled: false
|
|
166
|
+
|
|
167
|
+
OpMethod:
|
|
168
|
+
Enabled: false
|
|
169
|
+
|
|
170
|
+
ParameterLists:
|
|
171
|
+
Enabled: false
|
|
172
|
+
|
|
173
|
+
ParenthesesAsGroupedExpression:
|
|
174
|
+
Enabled: false
|
|
175
|
+
|
|
176
|
+
PercentLiteralDelimiters:
|
|
177
|
+
PreferredDelimiters:
|
|
178
|
+
'%': '{}'
|
|
179
|
+
|
|
180
|
+
PerlBackrefs:
|
|
181
|
+
Enabled: false
|
|
182
|
+
|
|
183
|
+
PredicateName:
|
|
184
|
+
NamePrefixBlacklist:
|
|
185
|
+
- is_
|
|
186
|
+
|
|
187
|
+
Proc:
|
|
188
|
+
Enabled: false
|
|
189
|
+
|
|
190
|
+
RaiseArgs:
|
|
191
|
+
Enabled: false
|
|
192
|
+
|
|
193
|
+
RedundantReturn:
|
|
194
|
+
AllowMultipleReturnValues: true
|
|
195
|
+
|
|
196
|
+
RegexpLiteral:
|
|
197
|
+
Enabled: false
|
|
198
|
+
|
|
199
|
+
RequireParentheses:
|
|
200
|
+
Enabled: false
|
|
201
|
+
|
|
202
|
+
SelfAssignment:
|
|
203
|
+
Enabled: false
|
|
204
|
+
|
|
205
|
+
SignalException:
|
|
206
|
+
EnforcedStyle: only_raise
|
|
207
|
+
|
|
208
|
+
SingleLineBlockParams:
|
|
209
|
+
Enabled: false
|
|
210
|
+
|
|
211
|
+
SingleLineMethods:
|
|
212
|
+
Enabled: false
|
|
213
|
+
|
|
214
|
+
SpecialGlobalVars:
|
|
215
|
+
Enabled: false
|
|
216
|
+
|
|
217
|
+
StringLiterals:
|
|
218
|
+
EnforcedStyle: double_quotes
|
|
219
|
+
|
|
220
|
+
Style/MultilineBlockChain:
|
|
221
|
+
Enabled: false
|
|
222
|
+
|
|
223
|
+
VariableInterpolation:
|
|
224
|
+
Enabled: false
|
|
225
|
+
|
|
226
|
+
TrailingComma:
|
|
227
|
+
Enabled: false
|
|
228
|
+
|
|
229
|
+
TrivialAccessors:
|
|
230
|
+
Enabled: false
|
|
231
|
+
|
|
232
|
+
UnderscorePrefixedVariableName:
|
|
233
|
+
Enabled: false
|
|
234
|
+
|
|
235
|
+
VariableInterpolation:
|
|
236
|
+
Enabled: false
|
|
237
|
+
|
|
238
|
+
Void:
|
|
239
|
+
Enabled: false
|
|
240
|
+
|
|
241
|
+
WhenThen:
|
|
242
|
+
Enabled: false
|
|
243
|
+
|
|
244
|
+
WhileUntilModifier:
|
|
245
|
+
Enabled: false
|
|
246
|
+
|
|
247
|
+
WordArray:
|
|
248
|
+
Enabled: false
|
|
249
|
+
|
|
250
|
+
GuardClause:
|
|
251
|
+
Enabled: false
|
|
252
|
+
|
|
253
|
+
# Renaming `has_something?` to `something?` obfuscates whether it is a "is-a" or
|
|
254
|
+
# # a "has-a" relationship.
|
|
255
|
+
PredicateName:
|
|
256
|
+
Enabled: false
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
rvm:
|
|
3
|
+
- 2.0.0
|
|
4
|
+
- 2.1.4
|
|
5
|
+
script: bundle exec rspec
|
|
6
|
+
addons:
|
|
7
|
+
code_climate:
|
|
8
|
+
repo_token: b8adadfd37374a0514104b47bf5f0bd5a0755dca59a1aa04bccccb4e1c358e7e
|
|
9
|
+
notifications:
|
|
10
|
+
email: false
|
|
11
|
+
hipchat:
|
|
12
|
+
rooms:
|
|
13
|
+
secure: K4ZW9PvT8I/aCBqHUVZQUZszutVFQwcDqJ7h9Y8wQ7E9HGvVh31ZtqJGhtBZb0SQUVgeyZb22i1uD2ci+HtMVIBOXg7p1n358leWEib+L7QjvP+N/ICWO3l8U6sFLfEhH0KfP68hzlwB8nC5kLSyxLkDKf38amOSTLqKq2EPqcI=
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2015 Panorama Education
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[](https://codeclimate.com/github/panorama-ed/snake_params)
|
|
2
|
+
[](https://codeclimate.com/github/panorama-ed/snake_params) [](https://travis-ci.org/panorama-ed/snake_params) [](http://inch-ci.org/github/panorama-ed/snake_params)
|
|
3
|
+
|
|
4
|
+
# SnakeParams
|
|
5
|
+
|
|
6
|
+
SnakeParams is a module that helps smoothing out the differences in naming
|
|
7
|
+
conventions between the front-end (camelCase) and the back-end (snake_case) in
|
|
8
|
+
Rails.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Add this line to your application's Gemfile:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
gem 'snake_params'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
And then execute:
|
|
19
|
+
|
|
20
|
+
$ bundle
|
|
21
|
+
|
|
22
|
+
Or install it yourself as:
|
|
23
|
+
|
|
24
|
+
$ gem install snake_params
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
To start using the camelCase to snake_case conversion, just include this module
|
|
29
|
+
in your Rails controller:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
include ::SnakeParams
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Contributing
|
|
36
|
+
|
|
37
|
+
1. Fork it ( https://github.com/panorama-ed/snake_params/fork )
|
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
41
|
+
5. Create a new Pull Request
|
|
42
|
+
|
|
43
|
+
**Make sure your changes have appropriate tests (`bundle exec rspec`)
|
|
44
|
+
and conform to the Rubocop style specified.** We use
|
|
45
|
+
[overcommit](https://github.com/causes/overcommit) to enforce good code.
|
|
46
|
+
|
|
47
|
+
## Documentation
|
|
48
|
+
For more information, check the project's [Ruby Docs](http://www.rubydoc.info/github/panorama-ed/snake_params/master).
|
data/lib/snake_params.rb
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require "snake_params/version"
|
|
2
|
+
|
|
3
|
+
require "active_support/concern"
|
|
4
|
+
require "active_support/inflector"
|
|
5
|
+
|
|
6
|
+
# SnakeParams helps smooth out the differences in naming conventions between
|
|
7
|
+
# the front-end (camelCase) and the back-end (snake_case). To use, just include
|
|
8
|
+
# this module in your Rails controller classes like this:
|
|
9
|
+
#
|
|
10
|
+
# include SnakeParams
|
|
11
|
+
module SnakeParams
|
|
12
|
+
extend ActiveSupport::Concern
|
|
13
|
+
|
|
14
|
+
included do
|
|
15
|
+
before_action :deep_snake_case_params!
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
# A method that recursively snake cases the camel cased params we receive
|
|
20
|
+
# from the frontend.
|
|
21
|
+
# @param val [Array/Hash] the parameters as they come from the front-end
|
|
22
|
+
def deep_snake_case_params!(val = params)
|
|
23
|
+
case val
|
|
24
|
+
when Array
|
|
25
|
+
val.map { |v| deep_snake_case_params!(v) }
|
|
26
|
+
when Hash
|
|
27
|
+
# We iterate the keys and then get the value, as opposed to the usual
|
|
28
|
+
# val.each do |k,v| because otherwise we get an error during the
|
|
29
|
+
# iteration with updates: can't add a new key into hash during iteration
|
|
30
|
+
val.keys.each do |k, v = val[k]|
|
|
31
|
+
val.delete k
|
|
32
|
+
val[k.underscore] = deep_snake_case_params!(v)
|
|
33
|
+
end
|
|
34
|
+
val
|
|
35
|
+
else
|
|
36
|
+
val
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "snake_params/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "snake_params"
|
|
8
|
+
spec.version = SnakeParams::VERSION
|
|
9
|
+
spec.authors = ["David Lago"]
|
|
10
|
+
spec.email = ["dlago@panoramaed.com"]
|
|
11
|
+
spec.summary = "Convert parameters from camelCase to snake_case."
|
|
12
|
+
spec.description = "Convert parameters from camelCase to snake_case. This "\
|
|
13
|
+
"bridges the gap between JavaScript and Ruby naming conventions."
|
|
14
|
+
spec.homepage = "https://www.github.com/panorama-ed/snake_params"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
20
|
+
spec.require_paths = ["lib"]
|
|
21
|
+
|
|
22
|
+
spec.add_dependency "activesupport", "~> 4.0"
|
|
23
|
+
|
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
|
25
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4"
|
|
26
|
+
spec.add_development_dependency "overcommit", "~> 0.21"
|
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.1"
|
|
28
|
+
spec.add_development_dependency "rubocop", "~> 0.28"
|
|
29
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Snake Params" do
|
|
4
|
+
it "recursively snake cases parameters" do
|
|
5
|
+
class ExampleController1
|
|
6
|
+
def self.before_action(_); end
|
|
7
|
+
|
|
8
|
+
def params
|
|
9
|
+
{
|
|
10
|
+
"thisIsA" => "test",
|
|
11
|
+
"ofParameters" => {
|
|
12
|
+
# Make sure we don't convert values, just keys:
|
|
13
|
+
"thatAre" => "camelCased",
|
|
14
|
+
"that" => {
|
|
15
|
+
"shouldBe" => "converted"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"to" => [
|
|
19
|
+
{ "snakeCased" => "1" },
|
|
20
|
+
{ "parameters" => "2" }
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
include ::SnakeParams
|
|
26
|
+
|
|
27
|
+
def action
|
|
28
|
+
deep_snake_case_params!
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
controller = ExampleController1.new
|
|
33
|
+
|
|
34
|
+
expect(controller.action).to eq(
|
|
35
|
+
"this_is_a" => "test",
|
|
36
|
+
"of_parameters" => {
|
|
37
|
+
"that_are" => "camelCased",
|
|
38
|
+
"that" => {
|
|
39
|
+
"should_be" => "converted"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"to" => [
|
|
43
|
+
{ "snake_cased" => "1" },
|
|
44
|
+
{ "parameters" => "2" }
|
|
45
|
+
]
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "attaches to before_action" do
|
|
50
|
+
class ExampleController2
|
|
51
|
+
def self.before_action(_); end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
expect(ExampleController2).
|
|
55
|
+
to receive(:before_action).
|
|
56
|
+
with(:deep_snake_case_params!)
|
|
57
|
+
|
|
58
|
+
class ExampleController2
|
|
59
|
+
include ::SnakeParams
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require "codeclimate-test-reporter"
|
|
2
|
+
CodeClimate::TestReporter.start
|
|
3
|
+
|
|
4
|
+
require "snake_params"
|
|
5
|
+
|
|
6
|
+
RSpec.configure do |config|
|
|
7
|
+
# These two settings work together to allow you to limit a spec run
|
|
8
|
+
# to individual examples or groups you care about by tagging them with
|
|
9
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
|
10
|
+
# get run.
|
|
11
|
+
config.filter_run :focus
|
|
12
|
+
config.run_all_when_everything_filtered = true
|
|
13
|
+
|
|
14
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
|
15
|
+
# recommended.
|
|
16
|
+
# For more details, see:
|
|
17
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
|
18
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
19
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
|
20
|
+
config.disable_monkey_patching!
|
|
21
|
+
|
|
22
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
|
23
|
+
# file, and it's useful to allow more verbose output when running an
|
|
24
|
+
# individual spec file.
|
|
25
|
+
if config.files_to_run.one?
|
|
26
|
+
# Use the documentation formatter for detailed output,
|
|
27
|
+
# unless a formatter has already been configured
|
|
28
|
+
# (e.g. via a command-line flag).
|
|
29
|
+
config.default_formatter = "doc"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
33
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
34
|
+
# the seed, which is printed after each run.
|
|
35
|
+
# --seed 1234
|
|
36
|
+
config.order = :random
|
|
37
|
+
|
|
38
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
|
39
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
40
|
+
# test failures related to randomization by passing the same `--seed` value
|
|
41
|
+
# as the one that triggered the failure.
|
|
42
|
+
Kernel.srand config.seed
|
|
43
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: snake_params
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- David Lago
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activesupport
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '4.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '4.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.7'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.7'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: codeclimate-test-reporter
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0.4'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0.4'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: overcommit
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0.21'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0.21'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '3.1'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.1'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rubocop
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0.28'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0.28'
|
|
97
|
+
description: Convert parameters from camelCase to snake_case. This bridges the gap
|
|
98
|
+
between JavaScript and Ruby naming conventions.
|
|
99
|
+
email:
|
|
100
|
+
- dlago@panoramaed.com
|
|
101
|
+
executables: []
|
|
102
|
+
extensions: []
|
|
103
|
+
extra_rdoc_files: []
|
|
104
|
+
files:
|
|
105
|
+
- ".gitignore"
|
|
106
|
+
- ".overcommit.yml"
|
|
107
|
+
- ".rubocop.yml"
|
|
108
|
+
- ".travis.yml"
|
|
109
|
+
- Gemfile
|
|
110
|
+
- LICENSE.txt
|
|
111
|
+
- README.md
|
|
112
|
+
- lib/snake_params.rb
|
|
113
|
+
- lib/snake_params/version.rb
|
|
114
|
+
- snake_params.gemspec
|
|
115
|
+
- spec/snake_params_spec.rb
|
|
116
|
+
- spec/spec_helper.rb
|
|
117
|
+
homepage: https://www.github.com/panorama-ed/snake_params
|
|
118
|
+
licenses:
|
|
119
|
+
- MIT
|
|
120
|
+
metadata: {}
|
|
121
|
+
post_install_message:
|
|
122
|
+
rdoc_options: []
|
|
123
|
+
require_paths:
|
|
124
|
+
- lib
|
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
|
+
requirements:
|
|
127
|
+
- - ">="
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: '0'
|
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
|
+
requirements:
|
|
132
|
+
- - ">="
|
|
133
|
+
- !ruby/object:Gem::Version
|
|
134
|
+
version: '0'
|
|
135
|
+
requirements: []
|
|
136
|
+
rubyforge_project:
|
|
137
|
+
rubygems_version: 2.4.5
|
|
138
|
+
signing_key:
|
|
139
|
+
specification_version: 4
|
|
140
|
+
summary: Convert parameters from camelCase to snake_case.
|
|
141
|
+
test_files:
|
|
142
|
+
- spec/snake_params_spec.rb
|
|
143
|
+
- spec/spec_helper.rb
|