elabs_matchers 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Gemfile.lock +37 -26
- data/README.md +57 -47
- data/development.txt +26 -0
- data/doc/ElabsMatchers/Helpers/Fixtures.html +33 -23
- data/doc/ElabsMatchers/Helpers/NormalizeKeys.html +222 -0
- data/doc/ElabsMatchers/Helpers/ReloadRecord.html +302 -0
- data/doc/ElabsMatchers/Helpers/SelectYearAndMonth.html +251 -0
- data/doc/ElabsMatchers/Helpers.html +29 -22
- data/doc/ElabsMatchers/Matchers/Allow/AllowMatcher.html +707 -0
- data/doc/ElabsMatchers/Matchers/Allow.html +229 -0
- data/doc/ElabsMatchers/Matchers/ContainHash/ContainHashMatcher.html +506 -0
- data/doc/ElabsMatchers/Matchers/ContainHash.html +222 -0
- data/doc/ElabsMatchers/Matchers/HaveAttribute/HaveAttributeMatcher.html +656 -0
- data/doc/ElabsMatchers/Matchers/HaveAttribute.html +239 -0
- data/doc/ElabsMatchers/Matchers/HaveFields/HaveFieldsMatcher.html +572 -0
- data/doc/ElabsMatchers/Matchers/HaveFields.html +220 -0
- data/doc/ElabsMatchers/Matchers/HaveFlash/HaveFlashMatcher.html +654 -0
- data/doc/ElabsMatchers/Matchers/HaveFlash.html +306 -0
- data/doc/ElabsMatchers/Matchers/HaveFormErrorsOn/HaveFormErrorsOnMatcher.html +678 -0
- data/doc/ElabsMatchers/Matchers/HaveFormErrorsOn.html +236 -0
- data/doc/ElabsMatchers/Matchers/HaveHeader/HaveHeaderMatcher.html +568 -0
- data/doc/ElabsMatchers/Matchers/HaveHeader.html +219 -0
- data/doc/ElabsMatchers/Matchers/HaveImage/HaveImageMatcher.html +592 -0
- data/doc/ElabsMatchers/Matchers/HaveImage.html +219 -0
- data/doc/ElabsMatchers/Matchers/HaveTableRow/HaveTableRowMatcher.html +654 -0
- data/doc/ElabsMatchers/Matchers/HaveTableRow.html +236 -0
- data/doc/ElabsMatchers/Matchers/OnlyInclude/OnlyIncludeMatcher.html +494 -0
- data/doc/ElabsMatchers/Matchers/OnlyInclude.html +221 -0
- data/doc/ElabsMatchers/Matchers/Persist/PersistMatcher.html +586 -0
- data/doc/ElabsMatchers/Matchers/Persist.html +235 -0
- data/doc/ElabsMatchers/Matchers.html +29 -22
- data/doc/ElabsMatchers.html +1144 -21
- data/doc/_index.html +161 -79
- data/doc/class_list.html +12 -6
- data/doc/css/full_list.css +4 -2
- data/doc/css/style.css +50 -44
- data/doc/file.README.html +71 -73
- data/doc/file_list.html +12 -6
- data/doc/frames.html +20 -5
- data/doc/index.html +71 -73
- data/doc/js/app.js +52 -43
- data/doc/js/full_list.js +9 -9
- data/doc/js/jquery.js +4 -16
- data/doc/method_list.html +603 -77
- data/doc/top-level-namespace.html +24 -103
- data/elabs_matchers.gemspec +4 -3
- data/history.txt +15 -0
- data/lib/elabs_matchers/extensions/module.rb +24 -0
- data/lib/elabs_matchers/helpers/fixtures.rb +2 -2
- data/lib/elabs_matchers/helpers/{common.rb → normalize_keys.rb} +3 -4
- data/lib/elabs_matchers/helpers/{orm.rb → reload_record.rb} +9 -6
- data/lib/elabs_matchers/helpers/{capybara.rb → select_year_and_month.rb} +5 -3
- data/lib/elabs_matchers/matchers/allow.rb +130 -0
- data/lib/elabs_matchers/matchers/contain_hash.rb +58 -0
- data/lib/elabs_matchers/matchers/have_attribute.rb +62 -0
- data/lib/elabs_matchers/matchers/have_fields.rb +45 -0
- data/lib/elabs_matchers/matchers/have_flash.rb +65 -0
- data/lib/elabs_matchers/matchers/have_form_errors_on.rb +79 -0
- data/lib/elabs_matchers/matchers/have_header.rb +53 -0
- data/lib/elabs_matchers/matchers/have_image.rb +69 -0
- data/lib/elabs_matchers/matchers/have_table_row.rb +113 -0
- data/lib/elabs_matchers/matchers/only_include.rb +41 -0
- data/lib/elabs_matchers/matchers/persist.rb +42 -0
- data/lib/elabs_matchers/version.rb +1 -1
- data/lib/elabs_matchers.rb +90 -10
- data/spec/elabs_matchers/helpers/fixtures_spec.rb +1 -1
- data/spec/elabs_matchers/helpers/{common_spec.rb → normalize_keys_spec.rb} +2 -2
- data/spec/elabs_matchers/helpers/{orm_spec.rb → reload_record_spec.rb} +3 -2
- data/spec/elabs_matchers/helpers/select_year_and_month_spec.rb +32 -0
- data/spec/elabs_matchers/matchers/{rspec/allow_spec.rb → allow_spec.rb} +5 -4
- data/spec/elabs_matchers/matchers/contain_hash_spec.rb +86 -0
- data/spec/elabs_matchers/matchers/have_attribute_spec.rb +65 -0
- data/spec/elabs_matchers/matchers/have_fields_spec.rb +46 -0
- data/spec/elabs_matchers/matchers/have_flash_spec.rb +97 -0
- data/spec/elabs_matchers/matchers/have_form_errors_on_spec.rb +93 -0
- data/spec/elabs_matchers/matchers/have_header_spec.rb +54 -0
- data/spec/elabs_matchers/matchers/have_image_spec.rb +49 -0
- data/spec/elabs_matchers/matchers/have_table_row_spec.rb +119 -0
- data/spec/elabs_matchers/matchers/only_include_spec.rb +32 -0
- data/spec/elabs_matchers/matchers/persist_spec.rb +21 -0
- data/{lib/elabs_matchers/orm → spec/fixtures}/post.rb +0 -0
- data/spec/spec_helper.rb +19 -8
- data/todo.txt +6 -0
- metadata +104 -48
- data/lib/elabs_matchers/cucumber/common.rb +0 -57
- data/lib/elabs_matchers/helpers/session.rb +0 -81
- data/lib/elabs_matchers/matchers/capybara/common.rb +0 -245
- data/lib/elabs_matchers/matchers/rspec/allow.rb +0 -112
- data/lib/elabs_matchers/matchers/rspec/common.rb +0 -59
- data/lib/elabs_matchers/matchers/rspec/orm.rb +0 -29
- data/spec/elabs_matchers/cucumber/common_spec.rb +0 -49
- data/spec/elabs_matchers/helpers/capybara_spec.rb +0 -32
- data/spec/elabs_matchers/helpers/session_spec.rb +0 -35
- data/spec/elabs_matchers/matchers/capybara/common_spec.rb +0 -202
- data/spec/elabs_matchers/matchers/rspec/common_spec.rb +0 -74
- data/spec/elabs_matchers/matchers/rspec/orm_spec.rb +0 -16
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elabs_matchers (0.0.
|
4
|
+
elabs_matchers (0.0.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activemodel (3.2.
|
10
|
-
activesupport (= 3.2.
|
9
|
+
activemodel (3.2.8)
|
10
|
+
activesupport (= 3.2.8)
|
11
11
|
builder (~> 3.0.0)
|
12
|
-
activesupport (3.2.
|
12
|
+
activesupport (3.2.8)
|
13
13
|
i18n (~> 0.6)
|
14
14
|
multi_json (~> 1.0)
|
15
|
-
|
15
|
+
addressable (2.3.2)
|
16
|
+
builder (3.0.3)
|
16
17
|
capybara (1.1.2)
|
17
18
|
mime-types (>= 1.16)
|
18
19
|
nokogiri (>= 1.3.3)
|
@@ -20,36 +21,45 @@ GEM
|
|
20
21
|
rack-test (>= 0.5.4)
|
21
22
|
selenium-webdriver (~> 2.0)
|
22
23
|
xpath (~> 0.1.4)
|
23
|
-
childprocess (0.3.
|
24
|
-
ffi (~> 1.0.6)
|
24
|
+
childprocess (0.3.5)
|
25
|
+
ffi (~> 1.0, >= 1.0.6)
|
26
|
+
coderay (1.0.6)
|
25
27
|
diff-lcs (1.1.3)
|
26
|
-
ffi (1.
|
27
|
-
i18n (0.6.
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
ffi (1.1.5)
|
29
|
+
i18n (0.6.1)
|
30
|
+
libwebsocket (0.1.5)
|
31
|
+
addressable
|
32
|
+
method_source (0.7.1)
|
33
|
+
mime-types (1.19)
|
34
|
+
multi_json (1.3.6)
|
35
|
+
nokogiri (1.5.5)
|
36
|
+
pry (0.9.9.6)
|
37
|
+
coderay (~> 1.0.5)
|
38
|
+
method_source (~> 0.7.1)
|
39
|
+
slop (>= 2.4.4, < 3)
|
31
40
|
rack (1.4.1)
|
32
41
|
rack-test (0.6.1)
|
33
42
|
rack (>= 1.0)
|
34
43
|
rake (0.9.2.2)
|
35
|
-
redcarpet (2.1.
|
36
|
-
rspec (2.
|
37
|
-
rspec-core (~> 2.
|
38
|
-
rspec-expectations (~> 2.
|
39
|
-
rspec-mocks (~> 2.
|
40
|
-
rspec-core (2.
|
41
|
-
rspec-expectations (2.
|
42
|
-
diff-lcs (~> 1.1.
|
43
|
-
rspec-mocks (2.
|
44
|
-
rubyzip (0.9.
|
45
|
-
selenium-webdriver (2.
|
44
|
+
redcarpet (2.1.1)
|
45
|
+
rspec (2.11.0)
|
46
|
+
rspec-core (~> 2.11.0)
|
47
|
+
rspec-expectations (~> 2.11.0)
|
48
|
+
rspec-mocks (~> 2.11.0)
|
49
|
+
rspec-core (2.11.1)
|
50
|
+
rspec-expectations (2.11.3)
|
51
|
+
diff-lcs (~> 1.1.3)
|
52
|
+
rspec-mocks (2.11.2)
|
53
|
+
rubyzip (0.9.9)
|
54
|
+
selenium-webdriver (2.25.0)
|
46
55
|
childprocess (>= 0.2.5)
|
47
|
-
|
48
|
-
multi_json (~> 1.0
|
56
|
+
libwebsocket (~> 0.1.3)
|
57
|
+
multi_json (~> 1.0)
|
49
58
|
rubyzip
|
59
|
+
slop (2.4.4)
|
50
60
|
xpath (0.1.4)
|
51
61
|
nokogiri (~> 1.3)
|
52
|
-
yard (0.
|
62
|
+
yard (0.8.2.1)
|
53
63
|
|
54
64
|
PLATFORMS
|
55
65
|
ruby
|
@@ -59,6 +69,7 @@ DEPENDENCIES
|
|
59
69
|
activesupport
|
60
70
|
capybara
|
61
71
|
elabs_matchers!
|
72
|
+
pry
|
62
73
|
rake
|
63
74
|
redcarpet
|
64
75
|
rspec
|
data/README.md
CHANGED
@@ -6,76 +6,86 @@ Elabs matchers aims to extend existing rspec matchers from e.g Rspec, Rspec-rail
|
|
6
6
|
of less generic once. This could be things like asserting a table appearing in a certain way or check that
|
7
7
|
an active record instance has been successfully persisted after an update.
|
8
8
|
|
9
|
+
It is important to know that this gem aims to extend rspec / capybara with more matchers. If functionality in either of theses
|
10
|
+
makes any of elabs matchers' matchers obsolete they will be deprecated and removed from elabs matchers.
|
11
|
+
|
9
12
|
Below follows a list of matchers that the gem bundles. To get documentation about each matcher the source code is
|
10
13
|
your bast friend at this point.
|
11
14
|
|
15
|
+
The gem's api should be consider subject to change on any level until version 1.0
|
16
|
+
|
17
|
+
## Setup
|
18
|
+
|
19
|
+
add elabs_matchers to your Gemfile:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
gem "elabs_matchers"
|
23
|
+
```
|
24
|
+
|
12
25
|
### Model matchers:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
26
|
+
```ruby
|
27
|
+
record.should allow("Blog post").as(:title)
|
28
|
+
hash.contain_hash({ "baz" => "bar" })
|
29
|
+
array.only_include("bar", "foo")
|
30
|
+
record.should persist(:title, "Blog post")
|
31
|
+
```
|
17
32
|
|
18
33
|
### Model helpers:
|
19
|
-
|
20
|
-
|
34
|
+
```ruby
|
35
|
+
reload(post)
|
36
|
+
save_and_reload(post)
|
37
|
+
```
|
21
38
|
|
22
39
|
### Acceptance matchers:
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
40
|
+
```ruby
|
41
|
+
page.should have_flash_notice("Success")
|
42
|
+
page.should have_flash_alert("Error")
|
43
|
+
page.should have_form_errors_on("Name", "Can't be blank")
|
44
|
+
page.should have_header("Elabs")
|
45
|
+
page.should have_image("Logo")
|
46
|
+
page.should have_fields("Author" => "Adam", "Year" => "2011")
|
47
|
+
page.should have_table_row("Posts", "Title" => "First", :year => "2012")
|
48
|
+
page.should have_attribute("Status", "Pending")
|
49
|
+
```
|
32
50
|
|
33
51
|
### Acceptance helpers:
|
34
|
-
|
35
|
-
|
36
|
-
|
52
|
+
```ruby
|
53
|
+
select_year_and_month("2010", "March", :from => "Birth date")
|
54
|
+
```
|
37
55
|
|
38
56
|
### Common helpers:
|
39
|
-
|
40
|
-
|
41
|
-
|
57
|
+
```ruby
|
58
|
+
normalize_keys({ "First name" => "Adam" })
|
59
|
+
fixture_file("file.txt")
|
60
|
+
```
|
42
61
|
|
43
|
-
##
|
62
|
+
## Configuration
|
44
63
|
|
45
|
-
|
64
|
+
Matchers can be configured in e.g your spec_helper.rb-file:
|
46
65
|
|
47
66
|
```ruby
|
48
|
-
|
67
|
+
ElabsMatchers.configure do |config|
|
68
|
+
config.header_selector = "//h1"
|
69
|
+
config.header_selector_type = :xpath
|
70
|
+
config.image_selector = lambda { |src| "img[src='#{src}']" }
|
71
|
+
end
|
49
72
|
```
|
50
73
|
|
51
|
-
|
74
|
+
See [elabs_matchers.rb](https://github.com/elabs/elabs_matchers/blob/master/lib/elabs_matchers.rb)
|
52
75
|
|
53
|
-
```ruby
|
54
|
-
gem 'elabs_matchers', :git => 'git://github.com/elabs/elabs_matchers.git', :require => false
|
55
|
-
```
|
56
76
|
|
57
|
-
|
77
|
+
## More
|
78
|
+
The gem includes YARD documentation which can be read with any browser.
|
79
|
+
The gem's test suite should also serve as detailed documentation for each matcher and helper.
|
58
80
|
|
59
|
-
```ruby
|
60
|
-
Spork.prefork do
|
61
|
-
...
|
62
|
-
require 'elabs_matchers'
|
63
|
-
...
|
64
|
-
end
|
65
|
-
```
|
66
81
|
|
67
82
|
## Development
|
68
83
|
|
69
|
-
|
70
|
-
bundle exec rake
|
71
|
-
```
|
84
|
+
See [devlopment.txt](https://github.com/elabs/elabs_matchers/blob/master/development.rb)
|
72
85
|
|
73
|
-
|
86
|
+
## Contributors
|
74
87
|
|
75
|
-
|
76
|
-
* Make yard document rspec matchers
|
77
|
-
* Use matcher with RSpec::Matchers:DSL
|
78
|
-
* Add contributors
|
88
|
+
So far the code base is a joined effort by everyone at Elabs.
|
79
89
|
|
80
90
|
## License:
|
81
91
|
|
@@ -85,7 +95,7 @@ should run all the gem's specs.
|
|
85
95
|
|
86
96
|
Permission is hereby granted, free of charge, to any person obtaining
|
87
97
|
a copy of this software and associated documentation files (the
|
88
|
-
|
98
|
+
"Software"), to deal in the Software without restriction, including
|
89
99
|
without limitation the rights to use, copy, modify, merge, publish,
|
90
100
|
distribute, sublicense, and/or sell copies of the Software, and to
|
91
101
|
permit persons to whom the Software is furnished to do so, subject to
|
@@ -94,10 +104,10 @@ should run all the gem's specs.
|
|
94
104
|
The above copyright notice and this permission notice shall be
|
95
105
|
included in all copies or substantial portions of the Software.
|
96
106
|
|
97
|
-
THE SOFTWARE IS PROVIDED
|
107
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
98
108
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
99
109
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
100
110
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
101
111
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
102
112
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
103
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
113
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/development.txt
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
## Setting up:
|
2
|
+
#
|
3
|
+
1. Fork the gem
|
4
|
+
2. Clone you fork to your local machine
|
5
|
+
3. Run:
|
6
|
+
gem install bundler
|
7
|
+
bundle install
|
8
|
+
rspec
|
9
|
+
|
10
|
+
## Pull requests:
|
11
|
+
#
|
12
|
+
Pull requests are appreciated. Before submitting please consider the following:
|
13
|
+
|
14
|
+
* Public methods are documented.
|
15
|
+
* `rake yard` runs without warnings.
|
16
|
+
* Matchers are using the "class syntax", that is, not the DSL.
|
17
|
+
* Use double quotes ("), not single quotes (') whenever possible.
|
18
|
+
Exceptions are when writing copy, "It's a fine day" and "Expected '#{actual}' to be '#{expected}'." is also fine.
|
19
|
+
* When writing matches? methods, consider writing does_not_match? as well.
|
20
|
+
This is important when writing Capybara matchers since failing to do so will cause problems with
|
21
|
+
specs that are rune with asynchronous communication going on (AJAX).
|
22
|
+
* Try to follow the pattern of a selector and a selector_type method in each matcher
|
23
|
+
* If possible, allow the user to override the selector and selector type using the configure syntax.
|
24
|
+
* Test your methods using the same pattern as existing specs.
|
25
|
+
|
26
|
+
Thank you for helping out!
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: ElabsMatchers::Helpers::Fixtures
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,10 +15,12 @@
|
|
15
15
|
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
19
|
-
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
20
21
|
</script>
|
21
22
|
|
23
|
+
|
22
24
|
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
23
25
|
|
24
26
|
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
@@ -26,36 +28,41 @@
|
|
26
28
|
|
27
29
|
</head>
|
28
30
|
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
31
|
<div id="header">
|
34
32
|
<div id="menu">
|
35
33
|
|
36
|
-
<a href="../../_index.html">Index (F)</a> »
|
34
|
+
<a href="../../_index.html">Index (F)</a> »
|
37
35
|
<span class='title'><span class='object_link'><a href="../../ElabsMatchers.html" title="ElabsMatchers (module)">ElabsMatchers</a></span></span> » <span class='title'><span class='object_link'><a href="../Helpers.html" title="ElabsMatchers::Helpers (module)">Helpers</a></span></span>
|
38
36
|
»
|
39
37
|
<span class="title">Fixtures</span>
|
40
38
|
|
41
|
-
|
39
|
+
|
42
40
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
41
|
</div>
|
44
42
|
|
45
43
|
<div id="search">
|
46
44
|
|
47
|
-
<a
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
48
49
|
|
49
|
-
<a
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
50
54
|
|
51
|
-
<a
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
52
59
|
|
53
60
|
</div>
|
54
61
|
<div class="clear"></div>
|
55
62
|
</div>
|
56
|
-
|
63
|
+
|
57
64
|
<iframe id="search_frame"></iframe>
|
58
|
-
|
65
|
+
|
59
66
|
<div id="content"><h1>Module: ElabsMatchers::Helpers::Fixtures
|
60
67
|
|
61
68
|
|
@@ -106,6 +113,7 @@
|
|
106
113
|
|
107
114
|
|
108
115
|
|
116
|
+
|
109
117
|
|
110
118
|
|
111
119
|
<span class="summary_desc"><div class='inline'>
|
@@ -122,16 +130,18 @@
|
|
122
130
|
|
123
131
|
<div id="instance_method_details" class="method_details_list">
|
124
132
|
<h2>Instance Method Details</h2>
|
125
|
-
|
133
|
+
|
126
134
|
|
127
135
|
<div class="method_details first">
|
128
|
-
<
|
136
|
+
<h3 class="signature first" id="fixture_file-instance_method">
|
129
137
|
|
130
138
|
- (<tt>Object</tt>) <strong>fixture_file</strong>(path)
|
131
139
|
|
132
140
|
|
133
141
|
|
134
|
-
|
142
|
+
|
143
|
+
|
144
|
+
</h3><div class="docstring">
|
135
145
|
<div class="discussion">
|
136
146
|
|
137
147
|
<p>Opens a file from the fixtures directory.</p>
|
@@ -142,12 +152,12 @@
|
|
142
152
|
</div>
|
143
153
|
</div>
|
144
154
|
<div class="tags">
|
145
|
-
<
|
155
|
+
<p class="tag_title">Parameters:</p>
|
146
156
|
<ul class="param">
|
147
157
|
|
148
158
|
<li>
|
149
159
|
|
150
|
-
<span class='name'>
|
160
|
+
<span class='name'>path</span>
|
151
161
|
|
152
162
|
|
153
163
|
<span class='type'>(<tt>String</tt>)</span>
|
@@ -156,7 +166,7 @@
|
|
156
166
|
|
157
167
|
—
|
158
168
|
<div class='inline'>
|
159
|
-
<p>
|
169
|
+
<p>A file name, relative to the fixtures folder.</p>
|
160
170
|
</div>
|
161
171
|
|
162
172
|
</li>
|
@@ -190,11 +200,11 @@
|
|
190
200
|
</div>
|
191
201
|
|
192
202
|
</div>
|
193
|
-
|
203
|
+
|
194
204
|
<div id="footer">
|
195
|
-
Generated on
|
205
|
+
Generated on Wed Sep 19 15:04:26 2012 by
|
196
206
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
197
|
-
0.
|
207
|
+
0.8.2.1 (ruby-1.9.3).
|
198
208
|
</div>
|
199
209
|
|
200
210
|
</body>
|
@@ -0,0 +1,222 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: ElabsMatchers::Helpers::NormalizeKeys
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (N)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../ElabsMatchers.html" title="ElabsMatchers (module)">ElabsMatchers</a></span></span> » <span class='title'><span class='object_link'><a href="../Helpers.html" title="ElabsMatchers::Helpers (module)">Helpers</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">NormalizeKeys</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: ElabsMatchers::Helpers::NormalizeKeys
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/elabs_matchers/helpers/normalize_keys.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<h2>
|
96
|
+
Instance Method Summary
|
97
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
98
|
+
</h2>
|
99
|
+
|
100
|
+
<ul class="summary">
|
101
|
+
|
102
|
+
<li class="public ">
|
103
|
+
<span class="summary_signature">
|
104
|
+
|
105
|
+
<a href="#normalize_keys-instance_method" title="#normalize_keys (instance method)">- (Object) <strong>normalize_keys</strong>(hash) </a>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
</span>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<span class="summary_desc"><div class='inline'>
|
120
|
+
<p>Normalizes a hash so that it can be described in a more human friendly
|
121
|
+
manner.</p>
|
122
|
+
</div></span>
|
123
|
+
|
124
|
+
</li>
|
125
|
+
|
126
|
+
|
127
|
+
</ul>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<div id="instance_method_details" class="method_details_list">
|
133
|
+
<h2>Instance Method Details</h2>
|
134
|
+
|
135
|
+
|
136
|
+
<div class="method_details first">
|
137
|
+
<h3 class="signature first" id="normalize_keys-instance_method">
|
138
|
+
|
139
|
+
- (<tt>Object</tt>) <strong>normalize_keys</strong>(hash)
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
</h3><div class="docstring">
|
146
|
+
<div class="discussion">
|
147
|
+
|
148
|
+
<p>Normalizes a hash so that it can be described in a more human friendly
|
149
|
+
manner.</p>
|
150
|
+
|
151
|
+
<p>Examples:</p>
|
152
|
+
|
153
|
+
<p># Or in a Cucumber table: Given the following people:</p>
|
154
|
+
|
155
|
+
<pre class="code ruby"><code>| First name | Last name |
|
156
|
+
| Douglas | Adams |</code></pre>
|
157
|
+
|
158
|
+
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
<div class="tags">
|
162
|
+
<p class="tag_title">Parameters:</p>
|
163
|
+
<ul class="param">
|
164
|
+
|
165
|
+
<li>
|
166
|
+
|
167
|
+
<span class='name'>hash</span>
|
168
|
+
|
169
|
+
|
170
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
—
|
175
|
+
<div class='inline'>
|
176
|
+
<p>A hash of human-friendly key and value pairs.</p>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
</li>
|
180
|
+
|
181
|
+
</ul>
|
182
|
+
|
183
|
+
|
184
|
+
</div><table class="source_code">
|
185
|
+
<tr>
|
186
|
+
<td>
|
187
|
+
<pre class="lines">
|
188
|
+
|
189
|
+
|
190
|
+
20
|
191
|
+
21
|
192
|
+
22
|
193
|
+
23
|
194
|
+
24
|
195
|
+
25</pre>
|
196
|
+
</td>
|
197
|
+
<td>
|
198
|
+
<pre class="code"><span class="info file"># File 'lib/elabs_matchers/helpers/normalize_keys.rb', line 20</span>
|
199
|
+
|
200
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_normalize_keys'>normalize_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
201
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_new_hash'>new_hash</span><span class='comma'>,</span> <span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='op'>|</span>
|
202
|
+
<span class='id identifier rubyid_new_hash'>new_hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_parameterize'>parameterize</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>_</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
203
|
+
<span class='id identifier rubyid_new_hash'>new_hash</span>
|
204
|
+
<span class='kw'>end</span>
|
205
|
+
<span class='kw'>end</span></pre>
|
206
|
+
</td>
|
207
|
+
</tr>
|
208
|
+
</table>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
</div>
|
212
|
+
|
213
|
+
</div>
|
214
|
+
|
215
|
+
<div id="footer">
|
216
|
+
Generated on Wed Sep 19 15:04:26 2012 by
|
217
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
218
|
+
0.8.2.1 (ruby-1.9.3).
|
219
|
+
</div>
|
220
|
+
|
221
|
+
</body>
|
222
|
+
</html>
|