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.
Files changed (97) hide show
  1. data/.gitignore +2 -1
  2. data/Gemfile.lock +37 -26
  3. data/README.md +57 -47
  4. data/development.txt +26 -0
  5. data/doc/ElabsMatchers/Helpers/Fixtures.html +33 -23
  6. data/doc/ElabsMatchers/Helpers/NormalizeKeys.html +222 -0
  7. data/doc/ElabsMatchers/Helpers/ReloadRecord.html +302 -0
  8. data/doc/ElabsMatchers/Helpers/SelectYearAndMonth.html +251 -0
  9. data/doc/ElabsMatchers/Helpers.html +29 -22
  10. data/doc/ElabsMatchers/Matchers/Allow/AllowMatcher.html +707 -0
  11. data/doc/ElabsMatchers/Matchers/Allow.html +229 -0
  12. data/doc/ElabsMatchers/Matchers/ContainHash/ContainHashMatcher.html +506 -0
  13. data/doc/ElabsMatchers/Matchers/ContainHash.html +222 -0
  14. data/doc/ElabsMatchers/Matchers/HaveAttribute/HaveAttributeMatcher.html +656 -0
  15. data/doc/ElabsMatchers/Matchers/HaveAttribute.html +239 -0
  16. data/doc/ElabsMatchers/Matchers/HaveFields/HaveFieldsMatcher.html +572 -0
  17. data/doc/ElabsMatchers/Matchers/HaveFields.html +220 -0
  18. data/doc/ElabsMatchers/Matchers/HaveFlash/HaveFlashMatcher.html +654 -0
  19. data/doc/ElabsMatchers/Matchers/HaveFlash.html +306 -0
  20. data/doc/ElabsMatchers/Matchers/HaveFormErrorsOn/HaveFormErrorsOnMatcher.html +678 -0
  21. data/doc/ElabsMatchers/Matchers/HaveFormErrorsOn.html +236 -0
  22. data/doc/ElabsMatchers/Matchers/HaveHeader/HaveHeaderMatcher.html +568 -0
  23. data/doc/ElabsMatchers/Matchers/HaveHeader.html +219 -0
  24. data/doc/ElabsMatchers/Matchers/HaveImage/HaveImageMatcher.html +592 -0
  25. data/doc/ElabsMatchers/Matchers/HaveImage.html +219 -0
  26. data/doc/ElabsMatchers/Matchers/HaveTableRow/HaveTableRowMatcher.html +654 -0
  27. data/doc/ElabsMatchers/Matchers/HaveTableRow.html +236 -0
  28. data/doc/ElabsMatchers/Matchers/OnlyInclude/OnlyIncludeMatcher.html +494 -0
  29. data/doc/ElabsMatchers/Matchers/OnlyInclude.html +221 -0
  30. data/doc/ElabsMatchers/Matchers/Persist/PersistMatcher.html +586 -0
  31. data/doc/ElabsMatchers/Matchers/Persist.html +235 -0
  32. data/doc/ElabsMatchers/Matchers.html +29 -22
  33. data/doc/ElabsMatchers.html +1144 -21
  34. data/doc/_index.html +161 -79
  35. data/doc/class_list.html +12 -6
  36. data/doc/css/full_list.css +4 -2
  37. data/doc/css/style.css +50 -44
  38. data/doc/file.README.html +71 -73
  39. data/doc/file_list.html +12 -6
  40. data/doc/frames.html +20 -5
  41. data/doc/index.html +71 -73
  42. data/doc/js/app.js +52 -43
  43. data/doc/js/full_list.js +9 -9
  44. data/doc/js/jquery.js +4 -16
  45. data/doc/method_list.html +603 -77
  46. data/doc/top-level-namespace.html +24 -103
  47. data/elabs_matchers.gemspec +4 -3
  48. data/history.txt +15 -0
  49. data/lib/elabs_matchers/extensions/module.rb +24 -0
  50. data/lib/elabs_matchers/helpers/fixtures.rb +2 -2
  51. data/lib/elabs_matchers/helpers/{common.rb → normalize_keys.rb} +3 -4
  52. data/lib/elabs_matchers/helpers/{orm.rb → reload_record.rb} +9 -6
  53. data/lib/elabs_matchers/helpers/{capybara.rb → select_year_and_month.rb} +5 -3
  54. data/lib/elabs_matchers/matchers/allow.rb +130 -0
  55. data/lib/elabs_matchers/matchers/contain_hash.rb +58 -0
  56. data/lib/elabs_matchers/matchers/have_attribute.rb +62 -0
  57. data/lib/elabs_matchers/matchers/have_fields.rb +45 -0
  58. data/lib/elabs_matchers/matchers/have_flash.rb +65 -0
  59. data/lib/elabs_matchers/matchers/have_form_errors_on.rb +79 -0
  60. data/lib/elabs_matchers/matchers/have_header.rb +53 -0
  61. data/lib/elabs_matchers/matchers/have_image.rb +69 -0
  62. data/lib/elabs_matchers/matchers/have_table_row.rb +113 -0
  63. data/lib/elabs_matchers/matchers/only_include.rb +41 -0
  64. data/lib/elabs_matchers/matchers/persist.rb +42 -0
  65. data/lib/elabs_matchers/version.rb +1 -1
  66. data/lib/elabs_matchers.rb +90 -10
  67. data/spec/elabs_matchers/helpers/fixtures_spec.rb +1 -1
  68. data/spec/elabs_matchers/helpers/{common_spec.rb → normalize_keys_spec.rb} +2 -2
  69. data/spec/elabs_matchers/helpers/{orm_spec.rb → reload_record_spec.rb} +3 -2
  70. data/spec/elabs_matchers/helpers/select_year_and_month_spec.rb +32 -0
  71. data/spec/elabs_matchers/matchers/{rspec/allow_spec.rb → allow_spec.rb} +5 -4
  72. data/spec/elabs_matchers/matchers/contain_hash_spec.rb +86 -0
  73. data/spec/elabs_matchers/matchers/have_attribute_spec.rb +65 -0
  74. data/spec/elabs_matchers/matchers/have_fields_spec.rb +46 -0
  75. data/spec/elabs_matchers/matchers/have_flash_spec.rb +97 -0
  76. data/spec/elabs_matchers/matchers/have_form_errors_on_spec.rb +93 -0
  77. data/spec/elabs_matchers/matchers/have_header_spec.rb +54 -0
  78. data/spec/elabs_matchers/matchers/have_image_spec.rb +49 -0
  79. data/spec/elabs_matchers/matchers/have_table_row_spec.rb +119 -0
  80. data/spec/elabs_matchers/matchers/only_include_spec.rb +32 -0
  81. data/spec/elabs_matchers/matchers/persist_spec.rb +21 -0
  82. data/{lib/elabs_matchers/orm → spec/fixtures}/post.rb +0 -0
  83. data/spec/spec_helper.rb +19 -8
  84. data/todo.txt +6 -0
  85. metadata +104 -48
  86. data/lib/elabs_matchers/cucumber/common.rb +0 -57
  87. data/lib/elabs_matchers/helpers/session.rb +0 -81
  88. data/lib/elabs_matchers/matchers/capybara/common.rb +0 -245
  89. data/lib/elabs_matchers/matchers/rspec/allow.rb +0 -112
  90. data/lib/elabs_matchers/matchers/rspec/common.rb +0 -59
  91. data/lib/elabs_matchers/matchers/rspec/orm.rb +0 -29
  92. data/spec/elabs_matchers/cucumber/common_spec.rb +0 -49
  93. data/spec/elabs_matchers/helpers/capybara_spec.rb +0 -32
  94. data/spec/elabs_matchers/helpers/session_spec.rb +0 -35
  95. data/spec/elabs_matchers/matchers/capybara/common_spec.rb +0 -202
  96. data/spec/elabs_matchers/matchers/rspec/common_spec.rb +0 -74
  97. data/spec/elabs_matchers/matchers/rspec/orm_spec.rb +0 -16
data/doc/file_list.html CHANGED
@@ -8,13 +8,13 @@
8
8
 
9
9
  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
10
 
11
-
11
+
12
12
 
13
13
  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
14
 
15
15
  <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
16
 
17
-
17
+
18
18
  <base id="base_target" target="_parent" />
19
19
  </head>
20
20
  <body>
@@ -28,16 +28,22 @@
28
28
  <h1 id="full_list_header">File List</h1>
29
29
  <div id="nav">
30
30
 
31
- <a target="_self" href="class_list.html">Classes</a>
31
+ <span><a target="_self" href="class_list.html">
32
+ Classes
33
+ </a></span>
32
34
 
33
- <a target="_self" href="method_list.html">Methods</a>
35
+ <span><a target="_self" href="method_list.html">
36
+ Methods
37
+ </a></span>
34
38
 
35
- <a target="_self" href="file_list.html">Files</a>
39
+ <span><a target="_self" href="file_list.html">
40
+ Files
41
+ </a></span>
36
42
 
37
43
  </div>
38
44
  <div id="search">Search: <input type="text" /></div>
39
45
 
40
- <ul id="full_list" class="files">
46
+ <ul id="full_list" class="file">
41
47
 
42
48
 
43
49
  <li class="r1"><a href="index.html" title="README">README</a></li>
data/doc/frames.html CHANGED
@@ -4,10 +4,25 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Documentation by YARD 0.7.5</title>
7
+ <title>Documentation by YARD 0.8.2.1</title>
8
8
  </head>
9
- <frameset cols="20%,*">
10
- <frame name="list" src="class_list.html" />
11
- <frame name="main" src="index.html" />
12
- </frameset>
9
+ <script type="text/javascript" charset="utf-8">
10
+ window.onload = function() {
11
+ var match = window.location.hash.match(/^#!(.+)/);
12
+ var name = 'index.html';
13
+ if (match) {
14
+ name = unescape(match[1]);
15
+ }
16
+ document.writeln('<frameset cols="20%,*">' +
17
+ '<frame name="list" src="class_list.html" />' +
18
+ '<frame name="main" src="' + name + '" />' +
19
+ '</frameset>');
20
+ }
21
+ </script>
22
+ <noscript>
23
+ <frameset cols="20%,*">
24
+ <frame name="list" src="class_list.html" />
25
+ <frame name="main" src="index.html" />
26
+ </frameset>
27
+ </noscript>
13
28
  </html>
data/doc/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.7.5
9
+ &mdash; 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
+ hasFrames = window.top.frames.main ? true : false;
18
19
  relpath = '';
19
- if (relpath != '') 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,34 +28,39 @@
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" title="Index">Index</a> &raquo;
34
+ <a href="_index.html">Index</a> &raquo;
37
35
  <span class="title">File: README</span>
38
36
 
39
-
37
+
40
38
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
39
  </div>
42
40
 
43
41
  <div id="search">
44
42
 
45
- <a id="class_list_link" href="#">Class List</a>
43
+ <a class="full_list_link" id="class_list_link"
44
+ href="class_list.html">
45
+ Class List
46
+ </a>
46
47
 
47
- <a id="method_list_link" href="#">Method List</a>
48
+ <a class="full_list_link" id="method_list_link"
49
+ href="method_list.html">
50
+ Method List
51
+ </a>
48
52
 
49
- <a id="file_list_link" href="#">File List</a>
53
+ <a class="full_list_link" id="file_list_link"
54
+ href="file_list.html">
55
+ File List
56
+ </a>
50
57
 
51
58
  </div>
52
59
  <div class="clear"></div>
53
60
  </div>
54
-
61
+
55
62
  <iframe id="search_frame"></iframe>
56
-
63
+
57
64
  <div id="content"><div id='filecontents'><h1>Elabs matchers</h1>
58
65
 
59
66
  <p><a href="http://travis-ci.org/elabs/elabs_matchers"><img src="https://secure.travis-ci.org/elabs/elabs_matchers.png" alt="Build Status"></a></p>
@@ -62,90 +69,81 @@
62
69
  of less generic once. This could be things like asserting a table appearing in a certain way or check that
63
70
  an active record instance has been successfully persisted after an update.</p>
64
71
 
72
+ <p>It is important to know that this gem aims to extend rspec / capybara with more matchers. If functionality in either of theses
73
+ makes any of elabs matchers&#39; matchers obsolete they will be deprecated and removed from elabs matchers.</p>
74
+
65
75
  <p>Below follows a list of matchers that the gem bundles. To get documentation about each matcher the source code is
66
76
  your bast friend at this point.</p>
67
77
 
78
+ <h2>Setup</h2>
79
+
80
+ <p>add elabs_matchers to your Gemfile:</p>
81
+
82
+ <pre class="code ruby"><code><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>elabs_matchers</span><span class='tstring_end'>&quot;</span></span>
83
+ </code></pre>
84
+
68
85
  <h3>Model matchers:</h3>
69
86
 
70
- <ul>
71
- <li>hash.contain_hash({ &quot;baz&quot; =&gt; &quot;bar&quot; })</li>
72
- <li>array.only_include(&quot;bar&quot;, &quot;foo&quot;)</li>
73
- <li>record.should persist(:title, &quot;Blog post&quot;)</li>
74
- <li>record.should allow(&quot;Blog post&quot;).as(:title)</li>
75
- </ul>
87
+ <pre class="code ruby"><code><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_allow'>allow</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Blog post</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_as'>as</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
88
+ <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_contain_hash'>contain_hash</span><span class='lparen'>(</span><span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>baz</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bar</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span><span class='rparen'>)</span>
89
+ <span class='id identifier rubyid_array'>array</span><span class='period'>.</span><span class='id identifier rubyid_only_include'>only_include</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>bar</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>foo</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
90
+ <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_persist'>persist</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Blog post</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
91
+ </code></pre>
76
92
 
77
93
  <h3>Model helpers:</h3>
78
94
 
79
- <ul>
80
- <li>reload(post)</li>
81
- <li>save_and_reload(post)</li>
82
- </ul>
95
+ <pre class="code ruby"><code><span class='id identifier rubyid_reload'>reload</span><span class='lparen'>(</span><span class='id identifier rubyid_post'>post</span><span class='rparen'>)</span>
96
+ <span class='id identifier rubyid_save_and_reload'>save_and_reload</span><span class='lparen'>(</span><span class='id identifier rubyid_post'>post</span><span class='rparen'>)</span>
97
+ </code></pre>
83
98
 
84
99
  <h3>Acceptance matchers:</h3>
85
100
 
86
- <ul>
87
- <li>page.should have_options([&quot;Yes&quot;, &quot;No&quot;])</li>
88
- <li>page.should have_table_row(&#39;Posts&#39;, &quot;Title&quot; =&gt; &quot;First&quot;, :year =&gt; &quot;2012&quot;)</li>
89
- <li>page.should have_attribute(&quot;Status&quot;, &quot;Pending&quot;)</li>
90
- <li>page.should have_image(&quot;Logo&quot;)</li>
91
- <li>page.should have_header(&quot;Elabs&quot;)</li>
92
- <li>page.should have_flash_notice(&quot;Success&quot;)</li>
93
- <li>page.should have_flash_alert(&quot;Error&quot;)</li>
94
- <li>page.should have_form_errors_on(&quot;Name&quot;, &quot;Can&#39;t be blank&quot;)</li>
95
- <li>page.should have_fields(&quot;Author&quot; =&gt; &quot;Adam&quot;, &quot;Year&quot; =&gt; &quot;2011&quot;)</li>
96
- </ul>
101
+ <pre class="code ruby"><code><span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_have_flash_notice'>have_flash_notice</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Success</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
102
+ <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_have_flash_alert'>have_flash_alert</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Error</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
103
+ <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_have_form_errors_on'>have_form_errors_on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Name</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Can't be blank</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
104
+ <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_have_header'>have_header</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Elabs</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
105
+ <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_have_image'>have_image</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Logo</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
106
+ <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_have_fields'>have_fields</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Author</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Adam</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Year</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>2011</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
107
+ <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_have_table_row'>have_table_row</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Posts</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Title</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>First</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:year</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>2012</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
108
+ <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_have_attribute'>have_attribute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Status</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Pending</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
109
+ </code></pre>
97
110
 
98
111
  <h3>Acceptance helpers:</h3>
99
112
 
100
- <ul>
101
- <li>select_year_and_month(&quot;2010&quot;, &quot;March&quot;, :from =&gt; &quot;Birth date&quot;)</li>
102
- <li>sign_in_as(user)</li>
103
- <li>sign_out</li>
104
- </ul>
113
+ <pre class="code ruby"><code><span class='id identifier rubyid_select_year_and_month'>select_year_and_month</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>2010</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>March</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:from</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Birth date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
114
+ </code></pre>
105
115
 
106
116
  <h3>Common helpers:</h3>
107
117
 
108
- <ul>
109
- <li>select_year_and_month(&quot;2010&quot;, &quot;March&quot;, :from =&gt; &quot;Birth date&quot;)</li>
110
- <li>normalize_keys({ &quot;First name&quot; =&gt; &quot;Adam&quot; })</li>
111
- <li>fixture_file(&quot;file.txt&quot;)</li>
112
- </ul>
118
+ <pre class="code ruby"><code><span class='id identifier rubyid_normalize_keys'>normalize_keys</span><span class='lparen'>(</span><span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>First name</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Adam</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span><span class='rparen'>)</span>
119
+ <span class='id identifier rubyid_fixture_file'>fixture_file</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>file.txt</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
120
+ </code></pre>
113
121
 
114
- <h2>Setup</h2>
122
+ <h2>Configuration</h2>
115
123
 
116
- <p>add elabs_matchers to your Gemfile:</p>
124
+ <p>Matchers can be configured in e.g your spec_helper.rb-file:</p>
117
125
 
118
- <pre class="code ruby"><code><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>elabs_matchers</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:git</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git://github.com/elabs/elabs_matchers.git</span><span class='tstring_end'>'</span></span>
126
+ <pre class="code ruby"><code><span class='const'>ElabsMatchers</span><span class='period'>.</span><span class='id identifier rubyid_configure'>configure</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_config'>config</span><span class='op'>|</span>
127
+ <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_header_selector'>header_selector</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>//h1</span><span class='tstring_end'>&quot;</span></span>
128
+ <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_header_selector_type'>header_selector_type</span> <span class='op'>=</span> <span class='symbol'>:xpath</span>
129
+ <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_image_selector'>image_selector</span> <span class='op'>=</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_src'>src</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>img[src='</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_src'>src</span><span class='rbrace'>}</span><span class='tstring_content'>']</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
130
+ <span class='kw'>end</span>
119
131
  </code></pre>
120
132
 
121
- <p>if you&#39;re using Spork gem you need to tell bundler not to require the files for you:</p>
133
+ <p>See <a href="https://github.com/elabs/elabs_matchers/blob/master/lib/elabs_matchers.rb">elabs_matchers.rb</a></p>
122
134
 
123
- <pre class="code ruby"><code><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>elabs_matchers</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:git</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>git://github.com/elabs/elabs_matchers.git</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:require</span> <span class='op'>=&gt;</span> <span class='kw'>false</span>
124
- </code></pre>
125
-
126
- <p>then you&#39;ll require them inside your spork prefork block:</p>
135
+ <h2>More</h2>
127
136
 
128
- <pre class="code ruby"><code>Spork.prefork do
129
- ...
130
- require 'elabs_matchers'
131
- ...
132
- end
133
- </code></pre>
137
+ <p>The gem includes YARD documentation which can be read with any browser.
138
+ The gem&#39;s test suite should also serve as detailed documentation for each matcher and helper.</p>
134
139
 
135
140
  <h2>Development</h2>
136
141
 
137
- <pre class="code bash"><code>bundle exec rake
138
- </code></pre>
139
-
140
- <p>should run all the gem&#39;s specs.</p>
142
+ <p>See <a href="https://github.com/elabs/elabs_matchers/blob/master/development.rb">devlopment.txt</a></p>
141
143
 
142
- <h2>TODOS</h2>
144
+ <h2>Contributors</h2>
143
145
 
144
- <ul>
145
- <li>Make yard document rspec matchers</li>
146
- <li>Use matcher with RSpec::Matchers:DSL</li>
147
- <li>Add contributors</li>
148
- </ul>
146
+ <p>So far the code base is a joined effort by everyone at Elabs.</p>
149
147
 
150
148
  <h2>License:</h2>
151
149
 
@@ -155,7 +153,7 @@ end
155
153
 
156
154
  <p>Permission is hereby granted, free of charge, to any person obtaining
157
155
  a copy of this software and associated documentation files (the
158
- &#39;Software&#39;), to deal in the Software without restriction, including
156
+ &quot;Software&quot;), to deal in the Software without restriction, including
159
157
  without limitation the rights to use, copy, modify, merge, publish,
160
158
  distribute, sublicense, and/or sell copies of the Software, and to
161
159
  permit persons to whom the Software is furnished to do so, subject to
@@ -164,7 +162,7 @@ end
164
162
  <p>The above copyright notice and this permission notice shall be
165
163
  included in all copies or substantial portions of the Software.</p>
166
164
 
167
- <p>THE SOFTWARE IS PROVIDED &#39;AS IS&#39;, WITHOUT WARRANTY OF ANY KIND,
165
+ <p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
168
166
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
169
167
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
170
168
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
@@ -172,11 +170,11 @@ end
172
170
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
173
171
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
174
172
  </div></div>
175
-
173
+
176
174
  <div id="footer">
177
- Generated on Fri Feb 17 16:29:16 2012 by
175
+ Generated on Wed Sep 19 15:04:26 2012 by
178
176
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
179
- 0.7.5 (ruby-1.9.3).
177
+ 0.8.2.1 (ruby-1.9.3).
180
178
  </div>
181
179
 
182
180
  </body>
data/doc/js/app.js CHANGED
@@ -44,21 +44,14 @@ function createFullTreeLinks() {
44
44
 
45
45
  function fixBoxInfoHeights() {
46
46
  $('dl.box dd.r1, dl.box dd.r2').each(function() {
47
- $(this).prev().height($(this).height());
47
+ $(this).prev().height($(this).height());
48
48
  });
49
49
  }
50
50
 
51
51
  function searchFrameLinks() {
52
- $('#method_list_link').click(function() {
53
- toggleSearchFrame(this, relpath + 'method_list.html');
54
- });
55
-
56
- $('#class_list_link').click(function() {
57
- toggleSearchFrame(this, relpath + 'class_list.html');
58
- });
59
-
60
- $('#file_list_link').click(function() {
61
- toggleSearchFrame(this, relpath + 'file_list.html');
52
+ $('.full_list_link').click(function() {
53
+ toggleSearchFrame(this, $(this).attr('href'));
54
+ return false;
62
55
  });
63
56
  }
64
57
 
@@ -82,10 +75,13 @@ function linkSummaries() {
82
75
  }
83
76
 
84
77
  function framesInit() {
85
- if (window.top.frames.main) {
78
+ if (hasFrames) {
86
79
  document.body.className = 'frames';
87
80
  $('#menu .noframes a').attr('href', document.location);
88
- $('html head title', window.parent.document).text($('html head title').text());
81
+ window.top.document.title = $('html head title').text();
82
+ }
83
+ else {
84
+ $('#menu .noframes a').text('frames').attr('href', framesUrl);
89
85
  }
90
86
  }
91
87
 
@@ -107,28 +103,34 @@ function keyboardShortcuts() {
107
103
 
108
104
  function summaryToggle() {
109
105
  $('.summary_toggle').click(function() {
110
- localStorage.summaryCollapsed = $(this).text();
111
- $(this).text($(this).text() == "collapse" ? "expand" : "collapse");
112
- var next = $(this).parent().parent().nextAll('ul.summary').first();
113
- if (next.hasClass('compact')) {
114
- next.toggle();
115
- next.nextAll('ul.summary').first().toggle();
116
- }
117
- else if (next.hasClass('summary')) {
118
- var list = $('<ul class="summary compact" />');
119
- list.html(next.html());
120
- list.find('.summary_desc, .note').remove();
121
- list.find('a').each(function() {
122
- $(this).html($(this).find('strong').html());
123
- $(this).parent().html($(this)[0].outerHTML);
124
- });
125
- next.before(list);
126
- next.toggle();
106
+ if (localStorage) {
107
+ localStorage.summaryCollapsed = $(this).text();
127
108
  }
109
+ $('.summary_toggle').each(function() {
110
+ $(this).text($(this).text() == "collapse" ? "expand" : "collapse");
111
+ var next = $(this).parent().parent().nextAll('ul.summary').first();
112
+ if (next.hasClass('compact')) {
113
+ next.toggle();
114
+ next.nextAll('ul.summary').first().toggle();
115
+ }
116
+ else if (next.hasClass('summary')) {
117
+ var list = $('<ul class="summary compact" />');
118
+ list.html(next.html());
119
+ list.find('.summary_desc, .note').remove();
120
+ list.find('a').each(function() {
121
+ $(this).html($(this).find('strong').html());
122
+ $(this).parent().html($(this)[0].outerHTML);
123
+ });
124
+ next.before(list);
125
+ next.toggle();
126
+ }
127
+ });
128
128
  return false;
129
129
  });
130
130
  if (localStorage) {
131
- if (localStorage.summaryCollapsed == "collapse") $('.summary_toggle').click();
131
+ if (localStorage.summaryCollapsed == "collapse") {
132
+ $('.summary_toggle').first().click();
133
+ }
132
134
  else localStorage.summaryCollapsed = "expand";
133
135
  }
134
136
  }
@@ -151,30 +153,37 @@ function generateTOC() {
151
153
  for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
152
154
  var lastTag = parseInt(tags[0][1], 10);
153
155
  $(tags.join(', ')).each(function() {
156
+ if ($(this).parents('.method_details .docstring').length != 0) return;
154
157
  if (this.id == "filecontents") return;
155
158
  show = true;
156
159
  var thisTag = parseInt(this.tagName[1], 10);
157
160
  if (this.id.length === 0) {
158
- var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
159
- if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
160
- this.id = proposedId;
161
+ var proposedId = $(this).attr('toc-id');
162
+ if (typeof(proposedId) != "undefined") this.id = proposedId;
163
+ else {
164
+ var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
165
+ if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
166
+ this.id = proposedId;
167
+ }
161
168
  }
162
- if (thisTag > lastTag) {
163
- for (i = 0; i < thisTag - lastTag; i++) {
164
- var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
165
- }
169
+ if (thisTag > lastTag) {
170
+ for (i = 0; i < thisTag - lastTag; i++) {
171
+ var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
172
+ }
166
173
  }
167
- if (thisTag < lastTag) {
168
- for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
174
+ if (thisTag < lastTag) {
175
+ for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
169
176
  }
170
- toc.append('<li><a href="#' + this.id + '">' + $(this).text() + '</a></li>');
177
+ var title = $(this).attr('toc-title');
178
+ if (typeof(title) == "undefined") title = $(this).text();
179
+ toc.append('<li><a href="#' + this.id + '">' + title + '</a></li>');
171
180
  lastTag = thisTag;
172
181
  });
173
182
  if (!show) return;
174
183
  html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
175
184
  $('#content').prepend(html);
176
185
  $('#toc').append(_toc);
177
- $('#toc .hide_toc').toggle(function() {
186
+ $('#toc .hide_toc').toggle(function() {
178
187
  $('#toc .top').slideUp('fast');
179
188
  $('#toc').toggleClass('hidden');
180
189
  $('#toc .title small').toggle();
@@ -183,7 +192,7 @@ function generateTOC() {
183
192
  $('#toc').toggleClass('hidden');
184
193
  $('#toc .title small').toggle();
185
194
  });
186
- $('#toc .float_toc').toggle(function() {
195
+ $('#toc .float_toc').toggle(function() {
187
196
  $(this).text('float');
188
197
  $('#toc').toggleClass('nofloat');
189
198
  }, function() {