From 546f1c5f598bd9cf60144bd233ee14ecad84c6cd Mon Sep 17 00:00:00 2001 From: Myron Marston Date: Thu, 6 Nov 2014 16:05:41 -0800 Subject: [PATCH 01/14] Disable directory indexing for docs. --- config.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.rb b/config.rb index 714e36091..3318097d3 100644 --- a/config.rb +++ b/config.rb @@ -12,6 +12,8 @@ activate :syntax activate :directory_indexes +page "documentation/**/*.html", directory_index: false + set :css_dir, 'stylesheets' set :js_dir, 'javascripts' set :images_dir, 'images' From e618b3e00738fd6d418e50012556e29f9895bccf Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 11 Dec 2014 22:03:56 +1100 Subject: [PATCH 02/14] yard template --- docs-template/default/layout/html/headers.erb | 14 ++++++++++ docs-template/plugin.rb | 27 +++++++++++++++++++ lib/yard-rspec-docs-template.rb | 1 + yard-rspec-docs-template.gemspec | 22 +++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 docs-template/default/layout/html/headers.erb create mode 100644 docs-template/plugin.rb create mode 100644 lib/yard-rspec-docs-template.rb create mode 100644 yard-rspec-docs-template.gemspec diff --git a/docs-template/default/layout/html/headers.erb b/docs-template/default/layout/html/headers.erb new file mode 100644 index 000000000..aeeab3b7d --- /dev/null +++ b/docs-template/default/layout/html/headers.erb @@ -0,0 +1,14 @@ + + + <%= h @page_title %> + <% if options.title && @page_title != options.title %> + — <%= h options.title %> + <% end %> + +<% stylesheets.each do |stylesheet| %> + +<% end %> +<%= erb :script_setup %> +<% javascripts.each do |javascript| %> + +<% end %> diff --git a/docs-template/plugin.rb b/docs-template/plugin.rb new file mode 100644 index 000000000..95db477b5 --- /dev/null +++ b/docs-template/plugin.rb @@ -0,0 +1,27 @@ +module TagsTemplateHelper + + def url_for(*args) + super + .gsub(/^[\.\/]*/,'/') # Makes paths absolute + .gsub(/^[\.\/]*css/, '/stylesheets/docs') # Links to our css + .gsub(/^[\.\/]*js/, '/javascripts/docs') # Links to our js + end + + def url_for_file(*args) + super.gsub(/^[\.\/]*/,'/') + end + +end + +module YARD + module Templates::Helpers + + module HtmlHelper + + def url_for_list(*args) + super.gsub(/^[\.\/]*/,'/') + end + + end + end +end diff --git a/lib/yard-rspec-docs-template.rb b/lib/yard-rspec-docs-template.rb new file mode 100644 index 000000000..849e660e7 --- /dev/null +++ b/lib/yard-rspec-docs-template.rb @@ -0,0 +1 @@ +YARD::Templates::Engine.register_template_path Pathname.new(File.dirname(__FILE__)).join('..', 'docs-template') diff --git a/yard-rspec-docs-template.gemspec b/yard-rspec-docs-template.gemspec new file mode 100644 index 000000000..40ac440a3 --- /dev/null +++ b/yard-rspec-docs-template.gemspec @@ -0,0 +1,22 @@ +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) + +Gem::Specification.new do |spec| + spec.name = "yard-rspec-docs-template" + spec.version = "0.0.1" + spec.authors = ["Jon Rowe"] + spec.email = ["hello@jonrowe.co.uk"] + spec.summary = %q{Skin for RSpec documentation in YARD} + spec.description = %q{} + spec.homepage = "https://github.com/rspec/rspec.github.io" + spec.license = "MIT" + + spec.files = `git ls-files -z lib`.split("\x0") + spec.require_paths = ["lib"] + + spec.add_dependency "yard" + + spec.add_development_dependency "bundler", "~> 1.7" + spec.add_development_dependency "rake", "~> 10.0" +end From 381f8f90c320d96688b4907636c0d204efaa10bd Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 17 Dec 2014 10:12:23 +1100 Subject: [PATCH 03/14] ignore local documentation css and js so we can use our bundled ones --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e00044b55..d3318570b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ # Ignore bundler artifacts bin bundle + +source/documentation/**/**/css +source/documentation/**/**/js From 753231dc411aee054777a8953d3c9f8626b4e6de Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 17 Dec 2014 10:28:21 +1100 Subject: [PATCH 04/14] common stylesheets and js for docs --- source/javascripts/docs/app.js | 219 +++++++++++++++++ source/javascripts/docs/full_list.js | 181 ++++++++++++++ source/javascripts/docs/jquery.js | 4 + source/stylesheets/docs/common.css | 1 + source/stylesheets/docs/full_list.css | 57 +++++ source/stylesheets/docs/style.css | 339 ++++++++++++++++++++++++++ 6 files changed, 801 insertions(+) create mode 100644 source/javascripts/docs/app.js create mode 100644 source/javascripts/docs/full_list.js create mode 100644 source/javascripts/docs/jquery.js create mode 100644 source/stylesheets/docs/common.css create mode 100644 source/stylesheets/docs/full_list.css create mode 100644 source/stylesheets/docs/style.css diff --git a/source/javascripts/docs/app.js b/source/javascripts/docs/app.js new file mode 100644 index 000000000..d933ebcf5 --- /dev/null +++ b/source/javascripts/docs/app.js @@ -0,0 +1,219 @@ +function createSourceLinks() { + $('.method_details_list .source_code'). + before("[View source]"); + $('.toggleSource').toggle(function() { + $(this).parent().nextAll('.source_code').slideDown(100); + $(this).text("Hide source"); + }, + function() { + $(this).parent().nextAll('.source_code').slideUp(100); + $(this).text("View source"); + }); +} + +function createDefineLinks() { + var tHeight = 0; + $('.defines').after(" more..."); + $('.toggleDefines').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).prev().show(); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function() { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more..."); + }); +} + +function createFullTreeLinks() { + var tHeight = 0; + $('.inheritanceTree').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass('showAll'); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function() { + $(this).parent().toggleClass('showAll'); + $(this).parent().prev().height(tHeight); + $(this).text("show all"); + }); +} + +function fixBoxInfoHeights() { + $('dl.box dd.r1, dl.box dd.r2').each(function() { + $(this).prev().height($(this).height()); + }); +} + +function searchFrameLinks() { + $('.full_list_link').click(function() { + toggleSearchFrame(this, $(this).attr('href')); + return false; + }); +} + +function toggleSearchFrame(id, link) { + var frame = $('#search_frame'); + $('#search a').removeClass('active').addClass('inactive'); + if (frame.attr('src') == link && frame.css('display') != "none") { + frame.slideUp(100); + $('#search a').removeClass('active inactive'); + } + else { + $(id).addClass('active').removeClass('inactive'); + frame.attr('src', link).slideDown(100); + } +} + +function linkSummaries() { + $('.summary_signature').click(function() { + document.location = $(this).find('a').attr('href'); + }); +} + +function framesInit() { + if (hasFrames) { + document.body.className = 'frames'; + $('#menu .noframes a').attr('href', document.location); + try { + window.top.document.title = $('html head title').text(); + } catch(error) { + // some browsers will not allow this when serving from file:// + // but we don't want to stop the world. + } + } + else { + $('#menu .noframes a').text('frames').attr('href', framesUrl); + } +} + +function keyboardShortcuts() { + if (window.top.frames.main) return; + $(document).keypress(function(evt) { + if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return; + if (typeof evt.target !== "undefined" && + (evt.target.nodeName == "INPUT" || + evt.target.nodeName == "TEXTAREA")) return; + switch (evt.charCode) { + case 67: case 99: $('#class_list_link').click(); break; // 'c' + case 77: case 109: $('#method_list_link').click(); break; // 'm' + case 70: case 102: $('#file_list_link').click(); break; // 'f' + default: break; + } + }); +} + +function summaryToggle() { + $('.summary_toggle').click(function() { + if (localStorage) { + localStorage.summaryCollapsed = $(this).text(); + } + $('.summary_toggle').each(function() { + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().nextAll('ul.summary').first(); + if (next.hasClass('compact')) { + next.toggle(); + next.nextAll('ul.summary').first().toggle(); + } + else if (next.hasClass('summary')) { + var list = $('
    '); + list.html(next.html()); + list.find('.summary_desc, .note').remove(); + list.find('a').each(function() { + $(this).html($(this).find('strong').html()); + $(this).parent().html($(this)[0].outerHTML); + }); + next.before(list); + next.toggle(); + } + }); + return false; + }); + if (localStorage) { + if (localStorage.summaryCollapsed == "collapse") { + $('.summary_toggle').first().click(); + } + else localStorage.summaryCollapsed = "expand"; + } +} + +function fixOutsideWorldLinks() { + $('a').each(function() { + if (window.location.host != this.host) this.target = '_parent'; + }); +} + +function generateTOC() { + if ($('#filecontents').length === 0) return; + var _toc = $('
      '); + var show = false; + var toc = _toc; + var counter = 0; + var tags = ['h2', 'h3', 'h4', 'h5', 'h6']; + var i; + if ($('#filecontents h1').length > 1) tags.unshift('h1'); + for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; } + var lastTag = parseInt(tags[0][1], 10); + $(tags.join(', ')).each(function() { + if ($(this).parents('.method_details .docstring').length != 0) return; + if (this.id == "filecontents") return; + show = true; + var thisTag = parseInt(this.tagName[1], 10); + if (this.id.length === 0) { + var proposedId = $(this).attr('toc-id'); + if (typeof(proposedId) != "undefined") this.id = proposedId; + else { + var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_'); + if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; } + this.id = proposedId; + } + } + if (thisTag > lastTag) { + for (i = 0; i < thisTag - lastTag; i++) { + var tmp = $('
        '); toc.append(tmp); toc = tmp; + } + } + if (thisTag < lastTag) { + for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent(); + } + var title = $(this).attr('toc-title'); + if (typeof(title) == "undefined") title = $(this).text(); + toc.append('
      1. ' + title + '
      2. '); + lastTag = thisTag; + }); + if (!show) return; + html = ''; + $('#content').prepend(html); + $('#toc').append(_toc); + $('#toc .hide_toc').toggle(function() { + $('#toc .top').slideUp('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }, function() { + $('#toc .top').slideDown('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }); + $('#toc .float_toc').toggle(function() { + $(this).text('float'); + $('#toc').toggleClass('nofloat'); + }, function() { + $(this).text('left'); + $('#toc').toggleClass('nofloat'); + }); +} + +$(framesInit); +$(createSourceLinks); +$(createDefineLinks); +$(createFullTreeLinks); +$(fixBoxInfoHeights); +$(searchFrameLinks); +$(linkSummaries); +$(keyboardShortcuts); +$(summaryToggle); +$(fixOutsideWorldLinks); +$(generateTOC); diff --git a/source/javascripts/docs/full_list.js b/source/javascripts/docs/full_list.js new file mode 100644 index 000000000..4b10377e6 --- /dev/null +++ b/source/javascripts/docs/full_list.js @@ -0,0 +1,181 @@ +var inSearch = null; +var searchIndex = 0; +var searchCache = []; +var searchString = ''; +var regexSearchString = ''; +var caseSensitiveMatch = false; +var ignoreKeyCodeMin = 8; +var ignoreKeyCodeMax = 46; +var commandKey = 91; + +RegExp.escape = function(text) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); +} + +function fullListSearch() { + // generate cache + searchCache = []; + $('#full_list li').each(function() { + var link = $(this).find('.object_link a'); + if (link.length === 0) return; + var fullName = link.attr('title').split(' ')[0]; + searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link}); + }); + + $('#search input').keyup(function(event) { + if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) + || event.keyCode == commandKey) + return; + searchString = this.value; + caseSensitiveMatch = searchString.match(/[A-Z]/) != null; + regexSearchString = RegExp.escape(searchString); + if (caseSensitiveMatch) { + regexSearchString += "|" + + $.map(searchString.split(''), function(e) { return RegExp.escape(e); }). + join('.+?'); + } + if (searchString === "") { + clearTimeout(inSearch); + inSearch = null; + $('ul .search_uncollapsed').removeClass('search_uncollapsed'); + $('#full_list, #content').removeClass('insearch'); + $('#full_list li').removeClass('found').each(function() { + + var link = $(this).find('.object_link a'); + if (link.length > 0) link.text(link.text()); + }); + if (clicked) { + clicked.parents('ul').each(function() { + $(this).removeClass('collapsed').prev().removeClass('collapsed'); + }); + } + highlight(); + } + else { + if (inSearch) clearTimeout(inSearch); + searchIndex = 0; + lastRowClass = ''; + $('#full_list, #content').addClass('insearch'); + $('#noresults').text(''); + searchItem(); + } + }); + + $('#search input').focus(); + $('#full_list').after("
        "); +} + +var lastRowClass = ''; +function searchItem() { + for (var i = 0; i < searchCache.length / 50; i++) { + var item = searchCache[searchIndex]; + var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name); + var matchString = regexSearchString; + var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i"); + if (searchName.match(matchRegexp) == null) { + item.node.removeClass('found'); + } + else { + item.node.css('padding-left', '10px').addClass('found'); + item.node.parents().addClass('search_uncollapsed'); + item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1'); + lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2'; + item.link.html(item.name.replace(matchRegexp, "$&")); + } + + if (searchCache.length === searchIndex + 1) { + searchDone(); + return; + } + else { + searchIndex++; + } + } + inSearch = setTimeout('searchItem()', 0); +} + +function searchDone() { + highlight(true); + if ($('#full_list li:visible').size() === 0) { + $('#noresults').text('No results were found.').hide().fadeIn(); + } + else { + $('#noresults').text(''); + } + $('#content').removeClass('insearch'); + clearTimeout(inSearch); + inSearch = null; +} + +clicked = null; +function linkList() { + $('#full_list li, #full_list li a:last').click(function(evt) { + if ($(this).hasClass('toggle')) return true; + if (this.tagName.toLowerCase() == "li") { + if ($(this).find('.object_link a').length === 0) { + $(this).children('a.toggle').click(); + return false; + } + var toggle = $(this).children('a.toggle'); + if (toggle.size() > 0 && evt.pageX < toggle.offset().left) { + toggle.click(); + return false; + } + } + if (clicked) clicked.removeClass('clicked'); + var win; + try { + win = window.top.frames.main ? window.top.frames.main : window.parent; + } catch (e) { win = window.parent; } + if (this.tagName.toLowerCase() == "a") { + clicked = $(this).parents('li').addClass('clicked'); + win.location = this.href; + } + else { + clicked = $(this).addClass('clicked'); + win.location = $(this).find('a:last').attr('href'); + } + return false; + }); +} + +function collapse() { + if (!$('#full_list').hasClass('class')) return; + $('#full_list.class a.toggle').click(function() { + $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed'); + highlight(); + return false; + }); + $('#full_list.class ul').each(function() { + $(this).addClass('collapsed').prev().addClass('collapsed'); + }); + $('#full_list.class').children().removeClass('collapsed'); + highlight(); +} + +function highlight(no_padding) { + var n = 1; + $('#full_list li:visible').each(function() { + var next = n == 1 ? 2 : 1; + $(this).removeClass("r" + next).addClass("r" + n); + if (!no_padding && $('#full_list').hasClass('class')) { + $(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px'); + } + n = next; + }); +} + +function escapeShortcut() { + $(document).keydown(function(evt) { + if (evt.which == 27) { + $('#search_frame', window.top.document).slideUp(100); + $('#search a', window.top.document).removeClass('active inactive'); + $(window.top).focus(); + } + }); +} + +$(escapeShortcut); +$(fullListSearch); +$(linkList); +$(collapse); diff --git a/source/javascripts/docs/jquery.js b/source/javascripts/docs/jquery.js new file mode 100644 index 000000000..198b3ff07 --- /dev/null +++ b/source/javascripts/docs/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
        a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
        "+""+"
        ",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
        t
        ",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
        ",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

        ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
        ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
        ","
        "],thead:[1,"","
        "],tr:[2,"","
        "],td:[3,"","
        "],col:[2,"","
        "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
        ","
        "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
        ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/source/stylesheets/docs/common.css b/source/stylesheets/docs/common.css new file mode 100644 index 000000000..cf25c4523 --- /dev/null +++ b/source/stylesheets/docs/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/source/stylesheets/docs/full_list.css b/source/stylesheets/docs/full_list.css new file mode 100644 index 000000000..c918cf190 --- /dev/null +++ b/source/stylesheets/docs/full_list.css @@ -0,0 +1,57 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; } +#full_list ul { padding: 0; } +#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } +#noresults { padding: 7px 12px; } +#content.insearch #noresults { margin-left: 7px; } +ul.collapsed ul, ul.collapsed li { display: none; } +ul.collapsed.search_uncollapsed { display: block; } +ul.collapsed.search_uncollapsed li { display: list-item; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } +li:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a:link, a:visited { text-decoration: none; color: #05a; } +li.clicked { background: #05a; color: #ccc; } +li.clicked a:link, li.clicked a:visited { color: #eee; } +li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; } +#nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; } +#nav a:link, #nav a:visited { color: #358; } +#nav a:hover { background: transparent; color: #5af; } +.frames #nav span:after { content: ' | '; } +.frames #nav span:last-child:after { content: ''; } + +.frames #content h1 { margin-top: 0; } +.frames li { white-space: nowrap; cursor: normal; } +.frames li small { display: block; font-size: 0.8em; } +.frames li small:before { content: ""; } +.frames li small:after { content: ""; } +.frames li small.search_info { display: none; } +.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +.frames #content.insearch #search { background-position: center right; } +.frames #search input { width: 110px; } +.frames #nav { display: block; } + +#full_list.insearch li { display: none; } +#full_list.insearch li.found { display: list-item; padding-left: 10px; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/source/stylesheets/docs/style.css b/source/stylesheets/docs/style.css new file mode 100644 index 000000000..96307c561 --- /dev/null +++ b/source/stylesheets/docs/style.css @@ -0,0 +1,339 @@ +body { + padding: 0 20px; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; +} +body.frames { padding: 0 5px; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; +} +h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; } +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link, .docstring .object_link { font-family: monospace; } +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } + +/* style for
        */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + +/* style for
          */ +#filecontents li > p, .docstring li > p { margin: 0px; } +#filecontents ul, .docstring ul { padding-left: 20px; } +/* style for
          */ +#filecontents dl, .docstring dl { border: 1px solid #ccc; } +#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; } +#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; } +#filecontents dd > p, .docstring dd > p { margin: 0px; } + +.note { + color: #222; + -moz-border-radius: 3px; -webkit-border-radius: 3px; + background: #e3e4e3; border: 1px solid #d5d5d5; padding: 7px 10px; + display: block; +} +.note.todo { background: #ffffc5; border-color: #ececaa; } +.note.returns_void { background: #efefef; } +.note.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.private { background: #ffffc5; border-color: #ececaa; } +.note.title { padding: 1px 5px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; } +.summary_signature + .note.title { margin-left: 7px; } +h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; } +.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; } +.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.private { background: #d5d5d5; border-color: #c5c5c5; } +.note.title.not_defined_here { background: transparent; border: none; font-style: italic; } +.discussion .note { margin-top: 6px; } +.discussion .note:first-child { margin-top: 0; } + +h3.inherited { + font-style: italic; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-weight: normal; + padding: 0; + margin: 0; + margin-top: 12px; + margin-bottom: 3px; + font-size: 13px; +} +p.inherited { + padding: 0; + margin: 0; + margin-left: 25px; +} + +#filecontents dl.box, dl.box { + border: 0; + width: 520px; + font-size: 1em; +} +#filecontents dl.box dt, dl.box dt { + float: left; + display: block; + width: 100px; + margin: 0; + text-align: right; + font-weight: bold; + background: transparent; + border: 1px solid #aaa; + border-width: 1px 0px 0px 1px; + padding: 6px 0; + padding-right: 10px; +} +#filecontents dl.box dd, dl.box dd { + float: left; + display: block; + width: 380px; + margin: 0; + padding: 6px 0; + padding-right: 20px; + border: 1px solid #aaa; + border-width: 1px 1px 0 0; +} +#filecontents dl.box .last, dl.box .last { + border-bottom: 1px solid #aaa; +} +#filecontents dl.box .r1, dl.box .r1 { background: #eee; } + +ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; } +.index_inline_list { padding-left: 0; font-size: 1.1em; } +.index_inline_list li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; } + +dl.constants { margin-left: 40px; } +dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; } +dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; } + +.summary_desc { margin-left: 32px; display: block; font-family: sans-serif; } +.summary_desc tt { font-size: 0.9em; } +dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; } +dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; } +dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; } +dl.constants .discussion *:first-child { margin-top: 0; } +dl.constants .discussion *:last-child { margin-bottom: 0; } + +.method_details { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; } +.method_details.first { border: 0; } +p.signature, h3.signature { + font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace; + padding: 6px 10px; margin-top: 18px; + background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +p.signature tt, +h3.signature tt { font-family: Monaco, Consolas, Courier, monospace; } +p.signature .overload, +h3.signature .overload { display: block; } +p.signature .extras, +h3.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; } +p.signature .not_defined_here, +h3.signature .not_defined_here, +p.signature .aliases, +h3.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; } +p.signature .aliases .names, +h3.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; } + +.tags .tag_title { font-size: 1em; margin-bottom: 0; font-weight: bold; } +.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; } +.tags ul li { margin-bottom: 3px; } +.tags ul .name { font-family: monospace; font-weight: bold; } +.tags ul .note { padding: 3px 6px; } +.tags { margin-bottom: 12px; } + +.tags .examples .tag_title { margin-bottom: 10px; font-weight: bold; } +.tags .examples .inline p { padding: 0; margin: 0; margin-left: 15px; font-weight: bold; font-size: 0.9em; } + +.tags .overload .overload_item { list-style: none; margin-bottom: 25px; } +.tags .overload .overload_item .signature { + padding: 2px 8px; + background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; } +.tags .overload .docstring { margin-top: 15px; } + +.defines { display: none; } + +#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; } + +.showSource { font-size: 0.9em; } +.showSource a:link, .showSource a:visited { text-decoration: none; color: #666; } + +#content a:link, #content a:visited { text-decoration: none; color: #05a; } +#content a:hover { background: #ffffa5; } +div.docstring, p.docstring { margin-right: 6em; } + +ul.summary { + list-style: none; + font-family: monospace; + font-size: 1em; + line-height: 1.5em; +} +ul.summary a:link, ul.summary a:visited { + text-decoration: none; font-size: 1.1em; +} +ul.summary li { margin-bottom: 5px; } +.summary .summary_signature { + padding: 1px 10px; + background: #eaeaff; border: 1px solid #dfdfe5; + -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +.summary_signature:hover { background: #eeeeff; cursor: pointer; } +ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;} +ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; } +#content .summary_signature:hover a:link, +#content .summary_signature:hover a:visited { + background: transparent; + color: #48f; +} + +p.inherited a { font-family: monospace; font-size: 0.9em; } +p.inherited { word-spacing: 5px; font-size: 1.2em; } + +p.children { font-size: 1.2em; } +p.children a { font-size: 0.9em; } +p.children strong { font-size: 0.8em; } +p.children strong.modules { padding-left: 5px; } + +ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; } +ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; } +ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHtJREFUeNqMzrEJAkEURdGzuhgZbSoYWcAWoBVsB4JgZAGmphsZCZYzTQgWNCYrDN9RvMmHx+X916SUBFbo8CzD1idXrLErw1mQttgXtyrOcQ/Ny5p4Qh+2XqLYYazsPWNTiuMkRxa4vcV+evuNAUOLIx5+c2hyzv7hNQC67Q+/HHmlEwAAAABJRU5ErkJggg==) no-repeat top center; } +ul.fullTree li:first-child { padding-top: 0; background: transparent; } +ul.fullTree li:last-child { padding-bottom: 0; } +.showAll ul.fullTree { display: block; } +.showAll .inheritName { display: none; } + +#search { position: absolute; right: 14px; top: 0px; } +#search a:link, #search a:visited { + display: block; float: left; margin-right: 4px; + padding: 8px 10px; text-decoration: none; color: #05a; + border: 1px solid #d8d8e5; + -moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px; + background: #eaf0ff; + -webkit-box-shadow: -1px 1px 3px #ddd; +} +#search a:hover { background: #f5faff; color: #06b; } +#search a.active { + background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457; + -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; + -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; +} +#search a.inactive { color: #999; } +.frames #search { display: none; } +.inheritanceTree, .toggleDefines { float: right; } + +#menu { font-size: 1.3em; color: #bbb; top: -5px; position: relative; } +#menu .title, #menu a { font-size: 0.7em; } +#menu .title a { font-size: 1em; } +#menu .title { color: #555; } +#menu a:link, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; } +#menu a:hover { color: #05a; } +#menu .noframes { display: inline; } +.frames #menu .noframes { display: inline; float: right; } + +#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; } +#footer a:link, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; } +#footer a:hover { color: #05a; } + +#listing ul.alpha { font-size: 1.1em; } +#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; } +#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; } +#listing ul.alpha ul { margin: 0; padding-left: 15px; } +#listing ul small { color: #666; font-size: 0.7em; } + +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } + +#search_frame { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 36px; + right: 18px; + width: 500px; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + -webkit-box-shadow: -7px 5px 25px #aaa; + -moz-box-shadow: -7px 5px 25px #aaa; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#content ul.summary li.deprecated .summary_signature a:link, +#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; } + +#toc { + padding: 20px; padding-right: 30px; border: 1px solid #ddd; float: right; background: #fff; margin-left: 20px; margin-bottom: 20px; + max-width: 300px; + -webkit-box-shadow: -2px 2px 6px #bbb; + -moz-box-shadow: -2px 2px 6px #bbb; + z-index: 5000; + position: relative; + overflow-x: auto; +} +#toc.nofloat { float: none; max-width: none; border: none; padding: 0; margin: 20px 0; -webkit-box-shadow: none; -moz-box-shadow: none; } +#toc.nofloat.hidden { padding: 0; background: 0; margin-bottom: 5px; } +#toc .title { margin: 0; } +#toc ol { padding-left: 1.8em; } +#toc li { font-size: 1.1em; line-height: 1.7em; } +#toc > ol > li { font-size: 1.1em; font-weight: bold; } +#toc ol > ol { font-size: 0.9em; } +#toc ol ol > ol { padding-left: 2.3em; } +#toc ol + li { margin-top: 0.3em; } +#toc.hidden { padding: 10px; background: #f6f6f6; -webkit-box-shadow: none; -moz-box-shadow: none; } +#filecontents h1 + #toc.nofloat { margin-top: 0; } + +/* syntax highlighting */ +.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; } +#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; } +#filecontents pre.code, .docstring pre.code { display: block; } +.source_code .lines { padding-right: 12px; color: #555; text-align: right; } +#filecontents pre.code, .docstring pre.code, +.tags pre.example { padding: 5px 12px; margin-top: 4px; border: 1px solid #eef; background: #f5f5ff; } +pre.code { color: #000; } +pre.code .info.file { color: #555; } +pre.code .val { color: #036A07; } +pre.code .tstring_content, +pre.code .heredoc_beg, pre.code .heredoc_end, +pre.code .qwords_beg, pre.code .qwords_end, +pre.code .tstring, pre.code .dstring { color: #036A07; } +pre.code .fid, pre.code .rubyid_new, pre.code .rubyid_to_s, +pre.code .rubyid_to_sym, pre.code .rubyid_to_f, +pre.code .dot + pre.code .id, +pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; } +pre.code .comment { color: #0066FF; } +pre.code .const, pre.code .constant { color: #585CF6; } +pre.code .label, +pre.code .symbol { color: #C5060B; } +pre.code .kw, +pre.code .rubyid_require, +pre.code .rubyid_extend, +pre.code .rubyid_include { color: #0000FF; } +pre.code .ivar { color: #318495; } +pre.code .gvar, +pre.code .rubyid_backref, +pre.code .rubyid_nth_ref { color: #6D79DE; } +pre.code .regexp, .dregexp { color: #036A07; } +pre.code a { border-bottom: 1px dotted #bbf; } From 4ce975b0b797ed058c5dbaadb4fbd7d64e8b7ea1 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 17 Dec 2014 10:16:42 +1100 Subject: [PATCH 05/14] rspec-core 3.2 documentation --- .../documentation/3.2/rspec-core/RSpec.html | 658 ++ .../3.2/rspec-core/RSpec/Core.html | 153 + .../rspec-core/RSpec/Core/Configuration.html | 6642 +++++++++++++++++ .../RSpec/Core/ConfigurationOptions.html | 530 ++ .../3.2/rspec-core/RSpec/Core/DSL.html | 322 + .../3.2/rspec-core/RSpec/Core/Example.html | 1430 ++++ .../RSpec/Core/Example/ExecutionResult.html | 957 +++ .../rspec-core/RSpec/Core/Example/Procsy.html | 550 ++ .../rspec-core/RSpec/Core/ExampleGroup.html | 6316 ++++++++++++++++ .../3.2/rspec-core/RSpec/Core/Formatters.html | 354 + .../RSpec/Core/Formatters/BaseFormatter.html | 677 ++ .../Core/Formatters/BaseTextFormatter.html | 533 ++ .../RSpec/Core/Formatters/ConsoleCodes.html | 387 + .../RSpec/Core/Formatters/Helpers.html | 533 ++ .../RSpec/Core/Formatters/Loader.html | 601 ++ .../Core/Formatters/ProfileFormatter.html | 316 + .../RSpec/Core/Formatters/Protocol.html | 1485 ++++ .../Core/Formatters/SnippetExtractor.html | 681 ++ .../3.2/rspec-core/RSpec/Core/Hooks.html | 1230 +++ .../RSpec/Core/MemoizedHelpers.html | 603 ++ .../Core/MemoizedHelpers/ClassMethods.html | 693 ++ .../3.2/rspec-core/RSpec/Core/Metadata.html | 314 + .../rspec-core/RSpec/Core/MetadataFilter.html | 120 + .../rspec-core/RSpec/Core/Notifications.html | 127 + .../DeprecationNotification.html | 498 ++ .../Notifications/ExampleNotification.html | 248 + .../Notifications/ExamplesNotification.html | 861 +++ .../FailedExampleNotification.html | 937 +++ .../Core/Notifications/GroupNotification.html | 245 + .../Notifications/MessageNotification.html | 233 + .../Core/Notifications/NullNotification.html | 133 + .../PendingExampleFixedNotification.html | 550 ++ .../Notifications/ProfileNotification.html | 410 + .../Core/Notifications/SeedNotification.html | 321 + .../Core/Notifications/StartNotification.html | 322 + .../Notifications/SummaryNotification.html | 586 ++ .../3.2/rspec-core/RSpec/Core/Pending.html | 469 ++ .../Core/Pending/SkipDeclaredInExample.html | 299 + .../3.2/rspec-core/RSpec/Core/RakeTask.html | 928 +++ .../3.2/rspec-core/RSpec/Core/Reporter.html | 468 ++ .../3.2/rspec-core/RSpec/Core/Runner.html | 929 +++ .../rspec-core/RSpec/Core/SharedContext.html | 136 + .../RSpec/Core/SharedExampleGroup.html | 457 ++ .../Core/SharedExampleGroup/TopLevelDSL.html | 295 + ...SharedExampleGroupInclusionStackFrame.html | 590 ++ .../RSpec/Core/SharedExampleGroupModule.html | 369 + .../3.2/rspec-core/RSpec/Core/Version.html | 139 + .../3.2/rspec-core/RSpec/Core/World.html | 980 +++ .../documentation/3.2/rspec-core/_index.html | 571 ++ .../3.2/rspec-core/class_list.html | 58 + .../3.2/rspec-core/file.Changelog.html | 2614 +++++++ .../3.2/rspec-core/file.License.html | 73 + .../3.2/rspec-core/file.README.html | 315 + .../3.2/rspec-core/file_list.html | 66 + .../documentation/3.2/rspec-core/frames.html | 26 + .../documentation/3.2/rspec-core/index.html | 315 + .../3.2/rspec-core/method_list.html | 1761 +++++ .../3.2/rspec-core/top-level-namespace.html | 112 + 58 files changed, 43526 insertions(+) create mode 100644 source/documentation/3.2/rspec-core/RSpec.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Configuration.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/ConfigurationOptions.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/DSL.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Example.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Example/ExecutionResult.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Example/Procsy.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/ExampleGroup.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters/BaseFormatter.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters/ConsoleCodes.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Helpers.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Loader.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters/ProfileFormatter.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Protocol.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Hooks.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/MemoizedHelpers.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Metadata.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/MetadataFilter.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/DeprecationNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ExampleNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ExamplesNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/FailedExampleNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/GroupNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/MessageNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/NullNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/PendingExampleFixedNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ProfileNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/SeedNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/StartNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Notifications/SummaryNotification.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Pending.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Pending/SkipDeclaredInExample.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/RakeTask.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Reporter.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Runner.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/SharedContext.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroup.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroupInclusionStackFrame.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroupModule.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/Version.html create mode 100644 source/documentation/3.2/rspec-core/RSpec/Core/World.html create mode 100644 source/documentation/3.2/rspec-core/_index.html create mode 100644 source/documentation/3.2/rspec-core/class_list.html create mode 100644 source/documentation/3.2/rspec-core/file.Changelog.html create mode 100644 source/documentation/3.2/rspec-core/file.License.html create mode 100644 source/documentation/3.2/rspec-core/file.README.html create mode 100644 source/documentation/3.2/rspec-core/file_list.html create mode 100644 source/documentation/3.2/rspec-core/frames.html create mode 100644 source/documentation/3.2/rspec-core/index.html create mode 100644 source/documentation/3.2/rspec-core/method_list.html create mode 100644 source/documentation/3.2/rspec-core/top-level-namespace.html diff --git a/source/documentation/3.2/rspec-core/RSpec.html b/source/documentation/3.2/rspec-core/RSpec.html new file mode 100644 index 000000000..550b175c1 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec.html @@ -0,0 +1,658 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

          Module: RSpec + + + +

          + +
          + + + + + + + + +
          Defined in:
          +
          lib/rspec/core.rb,
          + lib/rspec/core/drb.rb,
          lib/rspec/core/dsl.rb,
          lib/rspec/core/world.rb,
          lib/rspec/core/hooks.rb,
          lib/rspec/core/runner.rb,
          lib/rspec/core/example.rb,
          lib/rspec/core/pending.rb,
          lib/rspec/core/version.rb,
          lib/rspec/core/warnings.rb,
          lib/rspec/core/ordering.rb,
          lib/rspec/core/flat_map.rb,
          lib/rspec/core/metadata.rb,
          lib/rspec/core/rake_task.rb,
          lib/rspec/core/ruby_project.rb,
          lib/rspec/core/example_group.rb,
          lib/rspec/core/configuration.rb,
          lib/rspec/core/shared_context.rb,
          lib/rspec/core/filter_manager.rb,
          lib/rspec/core/backport_random.rb,
          lib/rspec/core/metadata_filter.rb,
          lib/rspec/core/memoized_helpers.rb,
          lib/rspec/core/formatters/helpers.rb,
          lib/rspec/core/backtrace_formatter.rb,
          lib/rspec/core/formatters/protocol.rb,
          lib/rspec/core/project_initializer.rb,
          lib/rspec/core/mocking_adapters/rr.rb,
          lib/rspec/core/shared_example_group.rb,
          lib/rspec/core/mocking_adapters/null.rb,
          lib/rspec/core/configuration_options.rb,
          lib/rspec/core/mocking_adapters/rspec.rb,
          lib/rspec/core/mocking_adapters/mocha.rb,
          lib/rspec/core/formatters/html_printer.rb,
          lib/rspec/core/formatters/console_codes.rb,
          lib/rspec/core/formatters/json_formatter.rb,
          lib/rspec/core/mocking_adapters/flexmock.rb,
          lib/rspec/core/formatters/html_formatter.rb,
          lib/rspec/core/formatters/base_formatter.rb,
          lib/rspec/core/minitest_assertions_adapter.rb,
          lib/rspec/core/test_unit_assertions_adapter.rb,
          lib/rspec/core/formatters/profile_formatter.rb,
          lib/rspec/core/formatters/snippet_extractor.rb,
          lib/rspec/core/formatters/progress_formatter.rb,
          lib/rspec/core/formatters/base_text_formatter.rb,
          lib/rspec/core/formatters/deprecation_formatter.rb,
          lib/rspec/core/formatters/documentation_formatter.rb
          +
          + +
          +
          + +

          Overview

          +
          + +

          This is borrowed (slightly modified) from Scott Taylor's project_path +project: github.com/smtlaissezfaire/project_path

          + + +
          +
          +
          + + +

          Defined Under Namespace

          +

          + + + Modules: Core + + + + +

          + +

          Constant Summary

          + + + + + + + + + +

          + Class Method Summary + (collapse) +

          + + + + + + + + + + + + +
          +

          Class Method Details

          + + +
          +

          + + + (void) clear_examples + + + + + +

          +
          + +

          Used to ensure examples get reloaded between multiple runs in the same +process and ensures user configuration is persisted.

          + +

          Users must invoke this if they want to clear all examples but preserve +current configuration when they use the runner multiple times within the +same process.

          + + +
          +
          +
          + + +
        + + + + +
        +
        +
        +
        +63
        +64
        +65
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/core.rb', line 63
        +
        +def self.clear_examples
        +  world.reset
        +  configuration.reporter.reset
        +  configuration.start_time = ::RSpec::Core::Time.now
        +  configuration.reset_filters
        +end
        +
        + + +
        +

        + + + (void) configuration + + + + + +

        +
        + +

        Returns the global Configuration +object. While you can use this method to access the configuration, +the more common convention is to use RSpec.configure.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configuration.drb_port = 1234
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core.rb', line 78
        +
        +def self.configuration
        +  @configuration ||= begin
        +                       config = RSpec::Core::Configuration.new
        +                       config.expose_dsl_globally = true
        +                       config
        +                     end
        +end
        +
        +
        + +
        +

        + + + (void) configure {|Configuration| ... } + + + + + +

        +
        + +

        Yields the global configuration to a block.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.add_formatter 'documentation'
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Configuration) + + + + — +
          +

          global configuration

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +94
        +95
        +96
        +
        +
        # File 'lib/rspec/core.rb', line 94
        +
        +def self.configure
        +  yield configuration if block_given?
        +end
        +
        +
        + +
        +

        + + + (void) current_example + + + + + +

        +
        + +

        The example being executed.

        + +

        The primary audience for this method is library authors who need access to +the example currently being executed and also want to support all versions +of RSpec 2 and 3.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |c|
        +  # context.example is deprecated, but RSpec.current_example is not
        +  # available until RSpec 3.0.
        +  fetch_current_example = RSpec.respond_to?(:current_example) ?
        +    proc { RSpec.current_example } : proc { |context| context.example }
        +
        +  c.before(:example) do
        +    example = fetch_current_example.call(self)
        +
        +    # ...
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +119
        +120
        +121
        +
        +
        # File 'lib/rspec/core.rb', line 119
        +
        +def self.current_example
        +  [:current_example]
        +end
        +
        +
        + +
        +

        + + + (void) current_example=(example) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Set the current example being executed.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +125
        +126
        +127
        +
        +
        # File 'lib/rspec/core.rb', line 125
        +
        +def self.current_example=(example)
        +  [:current_example] = example
        +end
        +
        +
        + +
        +

        + + + (void) reset + + + + + +

        +
        + +

        Used to ensure examples get reloaded and user configuration gets reset to +defaults between multiple runs in the same process.

        + +

        Users must invoke this if they want to have the configuration reset when +they use the runner multiple times within the same process. Users must deal +themselves with re-configuration of RSpec before run.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core.rb', line 52
        +
        +def self.reset
        +  @world = nil
        +  @configuration = nil
        +end
        +
        +
        + + + + + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core.html b/source/documentation/3.2/rspec-core/RSpec/Core.html new file mode 100644 index 000000000..1da8d2110 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core.html @@ -0,0 +1,153 @@ + + + + + + Module: RSpec::Core + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core.rb,
        + lib/rspec/core/drb.rb,
        lib/rspec/core/dsl.rb,
        lib/rspec/core/world.rb,
        lib/rspec/core/hooks.rb,
        lib/rspec/core/runner.rb,
        lib/rspec/core/example.rb,
        lib/rspec/core/pending.rb,
        lib/rspec/core/version.rb,
        lib/rspec/core/reporter.rb,
        lib/rspec/core/warnings.rb,
        lib/rspec/core/ordering.rb,
        lib/rspec/core/flat_map.rb,
        lib/rspec/core/metadata.rb,
        lib/rspec/core/rake_task.rb,
        lib/rspec/core/ruby_project.rb,
        lib/rspec/core/option_parser.rb,
        lib/rspec/core/example_group.rb,
        lib/rspec/core/configuration.rb,
        lib/rspec/core/notifications.rb,
        lib/rspec/core/shared_context.rb,
        lib/rspec/core/filter_manager.rb,
        lib/rspec/core/backport_random.rb,
        lib/rspec/core/metadata_filter.rb,
        lib/rspec/core/memoized_helpers.rb,
        lib/rspec/core/formatters/helpers.rb,
        lib/rspec/core/backtrace_formatter.rb,
        lib/rspec/core/formatters/protocol.rb,
        lib/rspec/core/project_initializer.rb,
        lib/rspec/core/mocking_adapters/rr.rb,
        lib/rspec/core/shared_example_group.rb,
        lib/rspec/core/mocking_adapters/null.rb,
        lib/rspec/core/configuration_options.rb,
        lib/rspec/core/mocking_adapters/rspec.rb,
        lib/rspec/core/mocking_adapters/mocha.rb,
        lib/rspec/core/formatters/html_printer.rb,
        lib/rspec/core/formatters/console_codes.rb,
        lib/rspec/core/formatters/json_formatter.rb,
        lib/rspec/core/mocking_adapters/flexmock.rb,
        lib/rspec/core/formatters/html_formatter.rb,
        lib/rspec/core/formatters/base_formatter.rb,
        lib/rspec/core/minitest_assertions_adapter.rb,
        lib/rspec/core/test_unit_assertions_adapter.rb,
        lib/rspec/core/formatters/profile_formatter.rb,
        lib/rspec/core/formatters/snippet_extractor.rb,
        lib/rspec/core/formatters/progress_formatter.rb,
        lib/rspec/core/formatters/base_text_formatter.rb,
        lib/rspec/core/formatters/deprecation_formatter.rb,
        lib/rspec/core/formatters/documentation_formatter.rb
        +
        + +
        +
        + +

        Overview

        +
        + +

        Namespace for the rspec-core code.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: DSL, Formatters, Hooks, MemoizedHelpers, Metadata, MetadataFilter, Notifications, Pending, SharedContext, SharedExampleGroup, Version + + + + Classes: Configuration, ConfigurationOptions, Example, ExampleGroup, RakeTask, Reporter, Runner, SharedExampleGroupInclusionStackFrame, SharedExampleGroupModule, World + + +

        + +

        Constant Summary

        + +
        + +
        DeprecationError = +
        +
        + +

        Deprecation Error.

        + + +
        +
        +
        + + +
        +
        +
        Class.new(StandardError)
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Configuration.html b/source/documentation/3.2/rspec-core/RSpec/Core/Configuration.html new file mode 100644 index 000000000..331c32a45 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Configuration.html @@ -0,0 +1,6642 @@ + + + + + + Class: RSpec::Core::Configuration + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Module.new, Hooks
        + + + + + +
        Defined in:
        +
        lib/rspec/core/configuration.rb
        + +
        +
        + +

        Overview

        +
        + +

        Stores runtime configuration information.

        + +

        Configuration options are loaded from ~/.rspec, +.rspec, .rspec-local, command line switches, and +the SPEC_OPTS environment variable (listed in lowest to +highest precedence; for example, an option in ~/.rspec can be +overridden by an option in .rspec-local).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        +

        Standard settings

        +

        + +
        RSpec.configure do |c|
        +  c.drb          = true
        +  c.drb_port     = 1234
        +  c.default_path = 'behavior'
        +end
        + + +

        +

        Hooks

        +

        + +
        RSpec.configure do |c|
        +  c.before(:suite)   { establish_connection }
        +  c.before(:example) {  :authorized }
        +  c.around(:example) { |ex| Database.transaction(&ex) }
        +end
        + +
        + + +

        See Also:

        + + +
        +

        Constant Summary

        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (void) default_color + + + + + + + + + + + + + + + + +
          +

          The default output color.

          +
          + +
        • + + +
        • + + + - (void) default_path + + + + + + + + + + + + + + + + +
          +

          Path to use if no path is provided to the rspec command +(default: "spec").

          +
          + +
        • + + +
        • + + + - (void) detail_color + + + + + + + + + + + + + + + + +
          +

          Color used to print details.

          +
          + +
        • + + +
        • + + + - (void) drb + + + + + + + + + + + + + + + + +
          +

          Run examples over DRb (default: false).

          +
          + +
        • + + +
        • + + + - (void) drb_port + + + + + + + + + + + + + + + + +
          +

          The drb_port (default: nil).

          +
          + +
        • + + +
        • + + + - (void) dry_run + + + + + + + + + + + + + + + + +
          +

          Prints the formatter output of your suite without running any examples or +hooks.

          +
          + +
        • + + +
        • + + + - (void) error_stream + + + + + + + + + + + + + + + + +
          +

          Default: $stderr.

          +
          + +
        • + + +
        • + + + - (void) exclude_pattern + + + + + + + + + + + + + + + + +
          +

          Exclude files matching this pattern.

          +
          + +
        • + + +
        • + + + - (void) fail_fast + + + + + + + + + + + + + + + + +
          +

          Clean up and exit after the first failure (default: false).

          +
          + +
        • + + +
        • + + + - (void) failure_color + + + + + + + + + + + + + + + + +
          +

          Color to use to indicate failure.

          +
          + +
        • + + +
        • + + + - (void) failure_exit_code + + + + + + + + + + + + + + + + +
          +

          The exit code to return if there are any failures (default: 1).

          +
          + +
        • + + +
        • + + + - (Array) files_to_run + + + + + + + + + readonly + + + + + + + + + +
          +

          The spec files RSpec will run.

          +
          + +
        • + + +
        • + + + - (void) fixed_color + + + + + + + + + + + + + + + + +
          +

          Color used when a pending example is fixed.

          +
          + +
        • + + +
        • + + + - (void) libs + + + + + + + + + readonly + + + + + + + + + +
          +

          Returns dirs that have been prepended to the load path by the +-I command line option.

          +
          + +
        • + + +
        • + + + - (void) output_stream + + + + + + + + + + + + + + + + +
          +

          Determines where RSpec will send its output.

          +
          + +
        • + + +
        • + + + - (void) pattern + + + + + + + + + + + + + + + + +
          +

          Load files matching this pattern (default: +'**{,//*}/*_spec.rb').

          +
          + +
        • + + +
        • + + + - (void) pending_color + + + + + + + + + + + + + + + + +
          +

          Color to use to print pending examples.

          +
          + +
        • + + +
        • + + + - (void) profile_examples + + + + + + + + + + + + + + private + + +
          +

          Defaults profile_examples to 10 examples when +@profile_examples is true.

          +
          + +
        • + + +
        • + + + - (void) requires + + + + + + + + + readonly + + + + + + + + + +
          +

          Indicates files configured to be required.

          +
          + +
        • + + +
        • + + + - (void) run_all_when_everything_filtered + + + + + + + + + + + + + + + + +
          +

          Run all examples if none match the configured filters (default: +false).

          +
          + +
        • + + +
        • + + + - (void) success_color + + + + + + + + + + + + + + + + +
          +

          Color to use to indicate success.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + +

        Methods included from Hooks

        +

        #after, #append_after, #around, #before, #prepend_before

        +
        +

        Constructor Details

        + +
        +

        + + - (Configuration) initialize + + + + + +

        +
        + +

        Returns a new instance of Configuration

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +299
        +300
        +301
        +302
        +303
        +304
        +305
        +306
        +307
        +308
        +309
        +310
        +311
        +312
        +313
        +314
        +315
        +316
        +317
        +318
        +319
        +320
        +321
        +322
        +323
        +324
        +325
        +326
        +327
        +328
        +329
        +330
        +331
        +332
        +333
        +334
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 299
        +
        +def initialize
        +  # rubocop:disable Style/GlobalVars
        +  @start_time = $_rspec_core_load_started_at || ::RSpec::Core::Time.now
        +  # rubocop:enable Style/GlobalVars
        +  @expectation_frameworks = []
        +  @include_extend_or_prepend_modules = []
        +  @mock_framework = nil
        +  @files_or_directories_to_run = []
        +  @color = false
        +  @pattern = '**{,/*/**}/*_spec.rb'
        +  @exclude_pattern = ''
        +  @failure_exit_code = 1
        +  @spec_files_loaded = false
        +
        +  @backtrace_formatter = BacktraceFormatter.new
        +
        +  @default_path = 'spec'
        +  @deprecation_stream = $stderr
        +  @output_stream = $stdout
        +  @reporter = nil
        +  @reporter_buffer = nil
        +  @filter_manager = FilterManager.new
        +  @static_config_filter_manager = FilterManager.new
        +  @ordering_manager = Ordering::ConfigurationManager.new
        +  @preferred_options = {}
        +  @failure_color = :red
        +  @success_color = :green
        +  @pending_color = :yellow
        +  @default_color = :white
        +  @fixed_color = :blue
        +  @detail_color = :cyan
        +  @profile_examples = false
        +  @requires = []
        +  @libs = []
        +  @derived_metadata_blocks = []
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (void) default_color + + + + + +

        +
        + +

        The default output color.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + color + + + (Symbol) + + + + — +
          +

          defaults to :white but can be set to one of the following: +[:black, :white, :red, :green, :yellow, :blue, :magenta, +:cyan]

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +253
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 253
        +
        +add_setting :default_color
        +
        +
        + + + +
        +

        + + - (void) default_path + + + + + +

        +
        + +
        + Note: +
        +

        Other scripts invoking rspec indirectly will ignore this +setting.

        +
        +
        + + +

        Path to use if no path is provided to the rspec command +(default: "spec"). Allows you to just type +rspec instead of rspec spec to run all the +examples in the spec directory.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +103
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 103
        +
        +add_setting :default_path
        +
        +
        + + + +
        +

        + + - (void) detail_color + + + + + +

        +
        + +

        Color used to print details.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + color + + + (Symbol) + + + + — +
          +

          defaults to :cyan but can be set to one of the following: +[:black, :white, :red, :green, :yellow, :blue, :magenta, +:cyan]

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +267
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 267
        +
        +add_setting :detail_color
        +
        +
        + + + +
        +

        + + - (void) drb + + + + + +

        +
        + +

        Run examples over DRb (default: false). RSpec doesn't +supply the DRb server, but you can use tools like spork.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +108
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 108
        +
        +add_setting :drb
        +
        +
        + + + +
        +

        + + - (void) drb_port + + + + + +

        +
        + +

        The drb_port (default: nil).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +112
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 112
        +
        +add_setting :drb_port
        +
        +
        + + + +
        +

        + + - (void) dry_run + + + + + +

        +
        + +

        Prints the formatter output of your suite without running any examples or +hooks.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +164
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 164
        +
        +add_setting :dry_run
        +
        +
        + + + +
        +

        + + - (void) error_stream + + + + + +

        +
        + +

        Default: $stderr.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +116
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 116
        +
        +add_setting :error_stream
        +
        +
        + + + +
        +

        + + - (void) exclude_pattern + + + + + +

        +
        + +

        Exclude files matching this pattern.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +209
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 209
        +
        +define_reader :exclude_pattern
        +
        +
        + + + +
        +

        + + - (void) fail_fast + + + + + +

        +
        + +

        Clean up and exit after the first failure (default: false).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +159
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 159
        +
        +add_setting :fail_fast
        +
        +
        + + + +
        +

        + + - (void) failure_color + + + + + +

        +
        + +

        Color to use to indicate failure.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + color + + + (Symbol) + + + + — +
          +

          defaults to :red but can be set to one of the following: +[:black, :white, :red, :green, :yellow, :blue, :magenta, +:cyan]

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +246
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 246
        +
        +add_setting :failure_color
        +
        +
        + + + +
        +

        + + - (void) failure_exit_code + + + + + +

        +
        + +

        The exit code to return if there are any failures (default: 1).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +168
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 168
        +
        +add_setting :failure_exit_code
        +
        +
        + + + +
        +

        + + - (Array) files_to_run + + + + + +

        +
        + +

        The spec files RSpec will run.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + + — +
          +

          specified files about to run

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +800
        +801
        +802
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 800
        +
        +def files_to_run
        +  @files_to_run ||= get_files_to_run(@files_or_directories_to_run)
        +end
        +
        +
        + + + +
        +

        + + - (void) fixed_color + + + + + +

        +
        + +

        Color used when a pending example is fixed.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + color + + + (Symbol) + + + + — +
          +

          defaults to :blue but can be set to one of the following: +[:black, :white, :red, :green, :yellow, :blue, :magenta, +:cyan]

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +260
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 260
        +
        +add_setting :fixed_color
        +
        +
        + + + +
        +

        + + - (void) libs + + + + + +

        +
        + +

        Returns dirs that have been prepended to the load path by the +-I command line option.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +177
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 177
        +
        +define_reader :libs
        +
        +
        + + + +
        +

        + + - (void) output_stream + + + + + +

        +
        + +

        Determines where RSpec will send its output. Default: $stdout.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +182
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 182
        +
        +define_reader :output_stream
        +
        +
        + + + +
        +

        + + - (void) pattern + + + + + +

        +
        + +

        Load files matching this pattern (default: +'**{,//*}/*_spec.rb').

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +199
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 199
        +
        +define_reader :pattern
        +
        +
        + + + +
        +

        + + - (void) pending_color + + + + + +

        +
        + +

        Color to use to print pending examples.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + color + + + (Symbol) + + + + — +
          +

          defaults to :yellow but can be set to one of the following: +[:black, :white, :red, :green, :yellow, :blue, :magenta, +:cyan]

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +239
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 239
        +
        +add_setting :pending_color
        +
        +
        + + + +
        +

        + + - (void) profile_examples + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Defaults profile_examples to 10 examples when +@profile_examples is true.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +220
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 220
        +
        +add_setting :profile_examples
        +
        +
        + + + +
        +

        + + - (void) requires + + + + + +

        +
        + +

        Indicates files configured to be required.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +172
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 172
        +
        +define_reader :requires
        +
        +
        + + + +
        +

        + + - (void) run_all_when_everything_filtered + + + + + +

        +
        + +

        Run all examples if none match the configured filters (default: +false).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +225
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 225
        +
        +add_setting :run_all_when_everything_filtered
        +
        +
        + + + +
        +

        + + - (void) success_color + + + + + +

        +
        + +

        Color to use to indicate success.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + color + + + (Symbol) + + + + — +
          +

          defaults to :green but can be set to one of the following: +[:black, :white, :red, :green, :yellow, :blue, :magenta, +:cyan]

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +232
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 232
        +
        +add_setting :success_color
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) add_formatter(formatter) + + + + Also known as: + formatter= + + + + +

        +
        + +

        Adds a formatter to the formatters collection. formatter can +be a string representing any of the built-in formatters (see +built_in_formatter), or a custom formatter class.

        + +

        Note

        + +

        For internal purposes, add_formatter also accepts the name of +a class and paths to use for output streams, but you should consider that a +private api that may change at any time without notice.

        + + +
        +
        +
        + + + + +
        + + + + +
        +
        +
        +
        +703
        +704
        +705
        +706
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 703
        +
        +def add_formatter(formatter_to_use, *paths)
        +  paths << output_stream if paths.empty?
        +  formatter_loader.add formatter_to_use, *paths
        +end
        +
        +
        + +
        +

        + + + - (void) add_setting(name) + + - (void) add_setting(name, opts) + + + + + + +

        +
        + +

        Adds a custom setting to the RSpec.configuration object.

        + +
        RSpec.configuration.add_setting :foo
        + +

        Used internally and by extension frameworks like rspec-rails, so they can +add config settings that are domain specific. For example:

        + +
        RSpec.configure do |c|
        +  c.add_setting :use_transactional_fixtures,
        +    :default => true,
        +    :alias_with => :use_transactional_examples
        +end
        +
        + +

        add_setting creates three methods on the configuration object, +a setter, a getter, and a predicate:

        + +
        RSpec.configuration.foo=(value)
        +RSpec.configuration.foo
        +RSpec.configuration.foo? # Returns true if foo returns anything but nil or false.
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
          +

          a customizable set of options

          +
          + +
        • + +
        + + + + + + +

        Options Hash (opts):

        +
          + +
        • + :default + (Symbol) + + + + + —
          +

          Set a default value for the generated getter and predicate methods:

          + +
          add_setting(:foo, :default => "default value")
          +
          +
          + +
        • + +
        • + :alias_with + (Symbol) + + + + + —
          +

          Use :alias_with to alias the setter, getter, and predicate to +another name, or names:

          + +
          add_setting(:foo, :alias_with => :bar)
          +add_setting(:foo, :alias_with => [:bar, :baz])
          +
          +
          + +
        • + +
        + + + +
        + + + + +
        +
        +
        +
        +397
        +398
        +399
        +400
        +401
        +402
        +403
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 397
        +
        +def add_setting(name, opts={})
        +  default = opts.delete(:default)
        +  (class << self; self; end).class_exec do
        +    add_setting(name, opts)
        +  end
        +  __send__("#{name}=", default) if default
        +end
        +
        +
        + +
        +

        + + - (void) alias_example_group_to(new_name, *args) + + + + + +

        +
        + +
        + Note: +
        +

        The defined aliased will also be added to the top level (e.g. +main and from within modules) if +expose_dsl_globally is set to true.

        +
        +
        + + +

        Creates a method that defines an example group with the provided metadata. +Can be used to define example group/metadata shortcuts.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.alias_example_group_to :describe_model, :type => :model
        +end
        +
        +shared_context_for "model tests", :type => :model do
        +  # define common model test helper methods, `let` declarations, etc
        +end
        +
        +# This lets you do this:
        +
        +RSpec.describe_model User do
        +end
        +
        +# ... which is the equivalent of
        +
        +RSpec.describe User, :type => :model do
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +868
        +869
        +870
        +871
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 868
        +
        +def alias_example_group_to(new_name, *args)
        +  extra_options = Metadata.build_hash_from(args)
        +  RSpec::Core::ExampleGroup.define_example_group_method(new_name, extra_options)
        +end
        +
        +
        + +
        +

        + + - (void) alias_example_to(name, *args) + + + + + +

        +
        + +
        + Note: +
        +

        The specific example alias below (pending) is already defined +for you.

        +
        +
        + +
        + Note: +
        +

        Use with caution. This extends the language used in your specs, but does +not add any additional documentation. We use this in RSpec to define +methods like focus and xit, but we also add docs +for those methods.

        +
        +
        + + +

        Creates a method that delegates to example including the +submitted args. Used internally to add variants of +example like pending:

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.alias_example_to :pending, :pending => true
        +end
        +
        +# This lets you do this:
        +
        +describe Thing do
        +  pending "does something" do
        +    thing = Thing.new
        +  end
        +end
        +
        +# ... which is the equivalent of
        +
        +describe Thing do
        +  it "does something", :pending => true do
        +    thing = Thing.new
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + + — +
          +

          example name alias

          +
          + +
        • + +
        • + + args + + + (Array<Symbol>, Hash) + + + + — +
          +

          metadata for the generated example

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +836
        +837
        +838
        +839
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 836
        +
        +def alias_example_to(name, *args)
        +  extra_options = Metadata.build_hash_from(args)
        +  RSpec::Core::ExampleGroup.define_example_method(name, extra_options)
        +end
        +
        +
        + +
        +

        + + - (void) alias_it_behaves_like_to(new_name, report_label = '') + + + + Also known as: + alias_it_should_behave_like_to + + + + +

        +
        + +
        + Note: +
        +

        Use with caution. This extends the language used in your specs, but does +not add any additional documentation. We use this in RSpec to define +it_should_behave_like (for backward compatibility), but we +also add docs for that method.

        +
        +
        + + +

        Define an alias for it_should_behave_like that allows different language +(like “it_has_behavior” or “it_behaves_like”) to be employed when including +shared examples.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.alias_it_behaves_like_to(:it_has_behavior, 'has behavior:')
        +end
        +
        +# allows the user to include a shared example group like:
        +
        +describe Entity do
        +  it_has_behavior 'sortability' do
        +    let(:sortable) { Entity.new }
        +  end
        +end
        +
        +# which is reported in the output as:
        +# Entity
        +#   has behavior: sortability
        +#     ...sortability examples here
        + +
        + + +
        + + + + +
        +
        +
        +
        +899
        +900
        +901
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 899
        +
        +def alias_it_behaves_like_to(new_name, report_label='')
        +  RSpec::Core::ExampleGroup.define_nested_shared_group_method(new_name, report_label)
        +end
        +
        +
        + +
        +

        + + - (void) backtrace_exclusion_patterns + + + + + +

        +
        + +

        Regexps used to exclude lines from backtraces.

        + +

        Excludes lines from ruby (and jruby) source, installed gems, anything in +any “bin” directory, and any of the RSpec libs (outside gem installs) by +default.

        + +

        You can modify the list via the getter, or replace it with the setter.

        + +

        To override this behaviour and display a full backtrace, use +--backtrace on the command line, in a .rspec +file, or in the rspec_options attribute of RSpec's rake +task.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +433
        +434
        +435
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 433
        +
        +def backtrace_exclusion_patterns
        +  @backtrace_formatter.exclusion_patterns
        +end
        +
        +
        + +
        +

        + + - (void) backtrace_exclusion_patterns=(patterns) + + + + + +

        +
        + +

        Set regular expressions used to exclude lines in backtrace.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + patterns + + + (Regexp) + + + + — +
          +

          set the backtrace exlusion pattern

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +439
        +440
        +441
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 439
        +
        +def backtrace_exclusion_patterns=(patterns)
        +  @backtrace_formatter.exclusion_patterns = patterns
        +end
        +
        +
        + +
        +

        + + - (void) backtrace_inclusion_patterns + + + + + +

        +
        + +

        Regexps used to include lines in backtraces.

        + +

        Defaults to [Regexp.new Dir.getwd].

        + +

        Lines that match an exclusion and an inclusion pattern will be +included.

        + +

        You can modify the list via the getter, or replace it with the setter.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +451
        +452
        +453
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 451
        +
        +def backtrace_inclusion_patterns
        +  @backtrace_formatter.inclusion_patterns
        +end
        +
        +
        + +
        +

        + + - (void) backtrace_inclusion_patterns=(patterns) + + + + + +

        +
        + +

        Set regular expressions used to include lines in backtrace.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +457
        +458
        +459
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 457
        +
        +def backtrace_inclusion_patterns=(patterns)
        +  @backtrace_formatter.inclusion_patterns = patterns
        +end
        +
        +
        + +
        +

        + + - (Boolean) color + + + + + +

        +
        + +

        Returns the configuration option for color, but should not be used to check +if color is supported.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +

        See Also:

        +
          + +
        • color_enabled?
        • + +
        + +
        + + + + +
        +
        +
        +
        +646
        +647
        +648
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 646
        +
        +def color
        +  value_for(:color) { @color }
        +end
        +
        +
        + +
        +

        + + - (void) color=(true_or_false) + + + + + +

        +
        + +

        Toggle output color.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +660
        +661
        +662
        +663
        +664
        +665
        +666
        +667
        +668
        +669
        +670
        +671
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 660
        +
        +def color=(true_or_false)
        +  return unless true_or_false
        +
        +  if RSpec::Support::OS.windows? && !ENV['ANSICON']
        +    RSpec.warning "You must use ANSICON 1.31 or later " \
        +                  "(http://adoxa.3eeweb.com/ansicon/) to use colour " \
        +                  "on Windows"
        +    @color = false
        +  else
        +    @color = true
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) color_enabled?(output = output_stream) + + + + + +

        +
        + +

        Check if color is enabled for a particular output.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + output + + + (IO) + + + (defaults to: output_stream) + + + — +
          +

          an output stream to use, defaults to the current output_stream

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +654
        +655
        +656
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 654
        +
        +def color_enabled?(output=output_stream)
        +  output_to_tty?(output) && color
        +end
        +
        +
        + +
        +

        + + - (void) default_formatter + + + + + +

        +
        + +

        The formatter that will be used if no formatter has been set. Defaults to +'progress'.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +711
        +712
        +713
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 711
        +
        +def default_formatter
        +  formatter_loader.default_formatter
        +end
        +
        +
        + +
        +

        + + - (void) default_formatter=(value) + + + + + +

        +
        + +

        Sets a fallback formatter to use if none other has been set.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.default_formatter = 'doc'
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +722
        +723
        +724
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 722
        +
        +def default_formatter=(value)
        +  formatter_loader.default_formatter = value
        +end
        +
        +
        + +
        +

        + + - (void) define_derived_metadata(*filters) {|metadata| ... } + + + + + +

        +
        + +

        Defines a callback that can assign derived metadata values.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  # Tag all groups and examples in the spec/unit directory with
        +  # :type => :unit
        +  config.(:file_path => %r{/spec/unit/}) do ||
        +    [:type] = :unit
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + filters + + + (Array<Symbol>, Hash) + + + + — +
          +

          metadata filters that determine which example or group metadata hashes the +callback will be triggered for. If none are given, the callback will be run +against the metadata hashes of all groups and examples.

          +
          + +
        • + +
        + +

        Yield Parameters:

        +
          + +
        • + + metadata + + + (Hash) + + + + — +
          +

          original metadata hash from an example or group. Mutate this in your block +as needed.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +1402
        +1403
        +1404
        +1405
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1402
        +
        +def (*filters, &block)
        +  meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
        +  @derived_metadata_blocks << [meta, block]
        +end
        +
        +
        + +
        +

        + + - (IO, String) deprecation_stream + + + + + +

        +
        + +

        Determines where deprecation warnings are printed. Defaults to +$stderr.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (IO, String) + + + + — +
          +

          IO to write to or filename to write to

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +141
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 141
        +
        +define_reader :deprecation_stream
        +
        +
        + +
        +

        + + - (void) deprecation_stream=(value) + + + + + +

        +
        + +

        Determines where deprecation warnings are printed.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + value + + + (IO, String) + + + + — +
          +

          IO to write to or filename to write to

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +154
        +155
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 145
        +
        +def deprecation_stream=(value)
        +  if @reporter && !value.equal?(@deprecation_stream)
        +    warn "RSpec's reporter has already been initialized with " \
        +      "#{deprecation_stream.inspect} as the deprecation stream, so your change to "\
        +      "`deprecation_stream` will be ignored. You should configure it earlier for " \
        +      "it to take effect, or use the `--deprecation-out` CLI option. " \
        +      "(Called from #{CallerFilter.first_non_rspec_line})"
        +  else
        +    @deprecation_stream = value
        +  end
        +end
        +
        +
        + +
        +

        + + - (void) disable_monkey_patching! + + + + + +

        +
        + +
        + Note: +
        +

        It configures rspec-mocks and rspec-expectations only if the user is using +those (either explicitly or implicitly by not setting +mock_with or expect_with to anything else).

        +
        +
        + +
        + Note: +
        +

        If the user uses this options with mock_with :mocha (or +similiar) they will still have monkey patching active in their test +environment from mocha.

        +
        +
        + + +

        Enables zero monkey patching mode for RSpec. It removes monkey patching of +the top-level DSL methods (describe, +shared_examples_for, etc) onto main and +Module, instead requiring you to prefix these methods with +RSpec.. It enables expect-only syntax for rspec-mocks and +rspec-expectations. It simply disables monkey patching on whatever pieces +of RSpec the user is using.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +# It disables all monkey patching.
        +RSpec.configure do |config|
        +  config.disable_monkey_patching!
        +end
        +
        +# Is an equivalent to
        +RSpec.configure do |config|
        +  config.expose_dsl_globally = false
        +
        +  config.mock_with :rspec do |mocks|
        +    mocks.syntax = :expect
        +    mocks.patch_marshal_to_support_partial_doubles = false
        +  end
        +
        +  config.mock_with :rspec do |expectations|
        +    expectations.syntax = :expect
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +1375
        +1376
        +1377
        +1378
        +1379
        +1380
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1375
        +
        +def disable_monkey_patching!
        +  self.expose_dsl_globally = false
        +  self.disable_monkey_patching = true
        +  conditionally_disable_mocks_monkey_patching
        +  conditionally_disable_expectations_monkey_patching
        +end
        +
        +
        + +
        +

        + + - (void) exclusion_filter + + + + + +

        +
        + +

        Returns the exclusion_filter. If none has been set, returns an +empty hash.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1014
        +1015
        +1016
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1014
        +
        +def exclusion_filter
        +  filter_manager.exclusions
        +end
        +
        +
        + +
        +

        + + - (void) exclusion_filter=(filter) + + + + + +

        +
        + +

        Clears and reassigns the exclusion_filter. Set to +nil if you don't want any exclusion filter at all.

        + +

        Warning

        + +

        This overrides any exclusion filters/tags set on the command line or in +configuration files.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1007
        +1008
        +1009
        +1010
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1007
        +
        +def exclusion_filter=(filter)
        +  meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
        +  filter_manager.exclude_only meta
        +end
        +
        +
        + +
        +

        + + - (void) expect_with(*frameworks) + + + + + +

        +
        + +

        Sets the expectation framework module(s) to be included in each example +group.

        + +

        frameworks can be :rspec, +:test_unit, :minitest, a custom module, or any +combination thereof:

        + +
        config.expect_with :rspec
        +config.expect_with :test_unit
        +config.expect_with :minitest
        +config.expect_with :rspec, :minitest
        +config.expect_with OtherExpectationFramework
        + +

        RSpec will translate :rspec, :minitest, and +:test_unit into the appropriate modules.

        + +

        Configuration

        + +

        If the module responds to configuration, +expect_with will yield the configuration object +if given a block:

        + +
        config.expect_with OtherExpectationFramework do |custom_config|
        +  custom_config.custom_setting = true
        +end
        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +593
        +594
        +595
        +596
        +597
        +598
        +599
        +600
        +601
        +602
        +603
        +604
        +605
        +606
        +607
        +608
        +609
        +610
        +611
        +612
        +613
        +614
        +615
        +616
        +617
        +618
        +619
        +620
        +621
        +622
        +623
        +624
        +625
        +626
        +627
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 593
        +
        +def expect_with(*frameworks)
        +  modules = frameworks.map do |framework|
        +    case framework
        +    when Module
        +      framework
        +    when :rspec
        +      require 'rspec/expectations'
        +      self.expecting_with_rspec = true
        +      ::RSpec::Matchers
        +    when :test_unit
        +      require 'rspec/core/test_unit_assertions_adapter'
        +      ::RSpec::Core::TestUnitAssertionsAdapter
        +    when :minitest
        +      require 'rspec/core/minitest_assertions_adapter'
        +      ::RSpec::Core::MinitestAssertionsAdapter
        +    else
        +      raise ArgumentError, "#{framework.inspect} is not supported"
        +    end
        +  end
        +
        +  if (modules - @expectation_frameworks).any?
        +    assert_no_example_groups_defined(:expect_with)
        +  end
        +
        +  if block_given?
        +    raise "expect_with only accepts a block with a single argument. " \
        +          "Call expect_with #{modules.length} times, " \
        +          "once with each argument, instead." if modules.length > 1
        +    raise "#{modules.first} must respond to `configuration` so that " \
        +          "expect_with can yield it." unless modules.first.respond_to?(:configuration)
        +    yield modules.first.configuration
        +  end
        +
        +  @expectation_frameworks.push(*modules)
        +end
        +
        +
        + +
        +

        + + - (void) expectation_framework=(framework) + + + + + +

        +
        + +

        Delegates to expect_with(framework).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +566
        +567
        +568
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 566
        +
        +def expectation_framework=(framework)
        +  expect_with(framework)
        +end
        +
        +
        + +
        +

        + + - (void) expectation_frameworks + + + + + +

        +
        + +

        Returns the configured expectation framework adapter module(s)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +554
        +555
        +556
        +557
        +558
        +559
        +560
        +561
        +562
        +563
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 554
        +
        +def expectation_frameworks
        +  if @expectation_frameworks.empty?
        +    begin
        +      expect_with :rspec
        +    rescue LoadError
        +      expect_with Module.new
        +    end
        +  end
        +  @expectation_frameworks
        +end
        +
        +
        + +
        +

        + + - (void) expose_current_running_example_as(method_name) + + + + + +

        +
        + +

        Exposes the current running example via the named helper method. RSpec 2.x +exposed this via example, but in RSpec 3.0, the example is +instead exposed via an arg yielded to it, before, +let, etc. However, some extension gems (such as Capybara) +depend on the RSpec 2.x's example method, so this config +option can be used to maintain compatibility.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.expose_current_running_example_as :example
        +end
        +
        +describe MyClass do
        +  before do
        +    # `example` can be used here because of the above config.
        +    do_something if example.[:type] == "foo"
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + method_name + + + (Symbol) + + + + — +
          +

          the name of the helper method

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +1313
        +1314
        +1315
        +1316
        +1317
        +1318
        +1319
        +1320
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1313
        +
        +def expose_current_running_example_as(method_name)
        +  ExposeCurrentExample.module_exec do
        +    extend RSpec::SharedContext
        +    let(method_name) { |ex| ex }
        +  end
        +
        +  include ExposeCurrentExample
        +end
        +
        +
        + +
        +

        + + - (void) expose_dsl_globally=(value) + + + + + +

        +
        + +

        Use this to expose the core RSpec DSL via Module and the +main object. It will be set automatically but you can override +it to remove the DSL. Default: true

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 128
        +
        +def expose_dsl_globally=(value)
        +  if value
        +    Core::DSL.expose_globally!
        +    Core::SharedExampleGroup::TopLevelDSL.expose_globally!
        +  else
        +    Core::DSL.remove_globally!
        +    Core::SharedExampleGroup::TopLevelDSL.remove_globally!
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) expose_dsl_globally? + + + + + +

        +
        + +

        Indicates if the DSL has been exposed off of modules and main. +Default: true

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 120
        +
        +def expose_dsl_globally?
        +  Core::DSL.exposed_globally?
        +end
        +
        +
        + +
        +

        + + - (void) extend(mod, *filters) + + + + + +

        +
        + +

        Tells RSpec to extend example groups with mod. Methods defined +in mod are exposed to example groups (not examples). Use +filters to constrain the groups to extend.

        + +

        Similar to include, but behavior is added to example groups, +which are classes, rather than the examples, which are instances of those +classes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module UiHelpers
        +  def run_in_browser
        +    # ...
        +  end
        +end
        +
        +RSpec.configure do |config|
        +  config.extend(UiHelpers, :type => :request)
        +end
        +
        +describe "edit profile", :type => :request do
        +  run_in_browser
        +
        +  it "does stuff in the client" do
        +    # ...
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +1086
        +1087
        +1088
        +1089
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1086
        +
        +def extend(mod, *filters)
        +  meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
        +  include_extend_or_prepend_modules << [:extend, mod, meta]
        +end
        +
        +
        + +
        +

        + + - (void) filter_gems_from_backtrace(*gem_names) + + + + + +

        +
        + +
        + Note: +
        +

        The patterns this adds will match the named gems in their common locations +(e.g. system gems, vendored with bundler, installed as a :git dependency +with bundler, etc) but is not guaranteed to work for all possible gem +locations. For example, if you have the gem source in a directory with a +completely unrelated name, and use bundler's :path option, this will +not filter it.

        +
        +
        + + +

        Adds #backtrace_exclusion_patterns that will filter lines from the named +gems from backtraces.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.filter_gems_from_backtrace "rack", "rake"
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + gem_names + + + (Array<String>) + + + + — +
          +

          Names of the gems to filter

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +477
        +478
        +479
        +480
        +481
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 477
        +
        +def filter_gems_from_backtrace(*gem_names)
        +  gem_names.each do |name|
        +    @backtrace_formatter.filter_gem(name)
        +  end
        +end
        +
        +
        + +
        +

        + + - (void) filter_run_excluding(*args) + + + + + +

        +
        + +

        Adds key/value pairs to the exclusion_filter. If +args includes any symbols that are not part of the hash, each +symbol is treated as a key in the hash with the value true.

        + +

        Note

        + +

        Filters set using this method can be overridden from the command line or +config files (e.g. .rspec).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # Given this declaration.
        +describe "something", :foo => 'bar' do
        +  # ...
        +end
        +
        +# Any of the following will exclude that group.
        +config.filter_run_excluding :foo => 'bar'
        +config.filter_run_excluding :foo => /^ba/
        +config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
        +config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# Given a proc with an arity of 1, the lambda is passed the value
        +# related to the key, e.g.
        +config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
        +
        +# Given a proc with an arity of 2, the lambda is passed the value
        +# related to the key, and the metadata itself e.g.
        +config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +filter_run_excluding :foo # same as filter_run_excluding :foo => true
        + +
        + + +
        + + + + +
        +
        +
        +
        +994
        +995
        +996
        +997
        +998
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 994
        +
        +def filter_run_excluding(*args)
        +  meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
        +  filter_manager.exclude_with_low_priority meta
        +  static_config_filter_manager.exclude_with_low_priority Metadata.deep_hash_dup(meta)
        +end
        +
        +
        + +
        +

        + + - (void) filter_run_including(*args) + + + + Also known as: + filter_run + + + + +

        +
        + +

        Adds key/value pairs to the inclusion_filter. If +args includes any symbols that are not part of the hash, each +symbol is treated as a key in the hash with the value true.

        + +

        Note

        + +

        Filters set using this method can be overridden from the command line or +config files (e.g. .rspec).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # Given this declaration.
        +describe "something", :foo => 'bar' do
        +  # ...
        +end
        +
        +# Any of the following will include that group.
        +config.filter_run_including :foo => 'bar'
        +config.filter_run_including :foo => /^ba/
        +config.filter_run_including :foo => lambda {|v| v == 'bar'}
        +config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# Given a proc with an arity of 1, the lambda is passed the value
        +# related to the key, e.g.
        +config.filter_run_including :foo => lambda {|v| v == 'bar'}
        +
        +# Given a proc with an arity of 2, the lambda is passed the value
        +# related to the key, and the metadata itself e.g.
        +config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +filter_run_including :foo # same as filter_run_including :foo => true
        + +
        + + +
        + + + + +
        +
        +
        +
        +934
        +935
        +936
        +937
        +938
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 934
        +
        +def filter_run_including(*args)
        +  meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
        +  filter_manager.include_with_low_priority meta
        +  static_config_filter_manager.include_with_low_priority Metadata.deep_hash_dup(meta)
        +end
        +
        +
        + +
        +

        + + - (void) format_docstrings(&block) + + + + + +

        +
        + +

        Formats the docstring output using the block provided.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # This will strip the descriptions of both examples and example
        +# groups.
        +RSpec.configure do |config|
        +  config.format_docstrings { |s| s.strip }
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +1205
        +1206
        +1207
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1205
        +
        +def format_docstrings(&block)
        +  @format_docstrings_block = block_given? ? block : DEFAULT_FORMATTER
        +end
        +
        +
        + +
        +

        + + - (Array) formatters + + + + + +

        +
        + +

        Returns a duplicate of the formatters currently loaded in the +FormatterLoader for introspection.

        + +

        Note as this is a duplicate, any mutations will be disregarded.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + + — +
          +

          the formatters currently loaded

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +732
        +733
        +734
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 732
        +
        +def formatters
        +  formatter_loader.formatters.dup
        +end
        +
        +
        + +
        +

        + + - (void) full_backtrace=(true_or_false) + + + + + +

        +
        + +

        Toggle full backtrace.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +637
        +638
        +639
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 637
        +
        +def full_backtrace=(true_or_false)
        +  @backtrace_formatter.full_backtrace = true_or_false
        +end
        +
        +
        + +
        +

        + + - (Boolean) full_backtrace? + + + + + +

        +
        + +

        Check if full backtrace is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          is full backtrace enabled

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +631
        +632
        +633
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 631
        +
        +def full_backtrace?
        +  @backtrace_formatter.full_backtrace?
        +end
        +
        +
        + +
        +

        + + - (Array) full_description + + + + + +

        +
        + +

        Returns full description filter

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + + — +
          +

          full description filter

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +688
        +689
        +690
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 688
        +
        +def full_description
        +  filter.fetch :full_description, nil
        +end
        +
        +
        + +
        +

        + + - (void) full_description=(description) + + + + + +

        +
        + +

        Run examples matching on description in all files to run.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + description + + + (String, Regexp) + + + + — +
          +

          the pattern to filter on

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +683
        +684
        +685
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 683
        +
        +def full_description=(description)
        +  filter_run :full_description => Regexp.union(*Array(description).map { |d| Regexp.new(d) })
        +end
        +
        +
        + +
        +

        + + - (void) include(mod, *filters) + + + + + +

        +
        + +

        Tells RSpec to include mod in example groups. Methods defined +in mod are exposed to examples (not example groups). Use +filters to constrain the groups in which to include the +module.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module AuthenticationHelpers
        +  def (user)
        +    # ...
        +  end
        +end
        +
        +module UserHelpers
        +  def users(username)
        +    # ...
        +  end
        +end
        +
        +RSpec.configure do |config|
        +  config.include(UserHelpers) # included in all modules
        +  config.include(AuthenticationHelpers, :type => :request)
        +end
        +
        +describe "edit profile", :type => :request do
        +  it "can be viewed by owning user" do
        +     users(:jdoe)
        +    get "/profiles/jdoe"
        +    assert_select ".username", :text => 'jdoe'
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +1051
        +1052
        +1053
        +1054
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1051
        +
        +def include(mod, *filters)
        +  meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
        +  include_extend_or_prepend_modules << [:include, mod, meta]
        +end
        +
        +
        + +
        +

        + + - (void) inclusion_filter + + + + Also known as: + filter + + + + +

        +
        + +

        Returns the inclusion_filter. If none has been set, returns an +empty hash.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +958
        +959
        +960
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 958
        +
        +def inclusion_filter
        +  filter_manager.inclusions
        +end
        +
        +
        + +
        +

        + + - (void) inclusion_filter=(filter) + + + + Also known as: + filter= + + + + +

        +
        + +

        Clears and reassigns the inclusion_filter. Set to +nil if you don't want any inclusion filter at all.

        + +

        Warning

        + +

        This overrides any inclusion filters/tags set on the command line or in +configuration files.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +949
        +950
        +951
        +952
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 949
        +
        +def inclusion_filter=(filter)
        +  meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
        +  filter_manager.include_only meta
        +end
        +
        +
        + +
        +

        + + - (void) mock_framework + + + + + +

        +
        + +

        Returns the configured mock framework adapter module.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +406
        +407
        +408
        +409
        +410
        +411
        +412
        +413
        +414
        +415
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 406
        +
        +def mock_framework
        +  if @mock_framework.nil?
        +    begin
        +      mock_with :rspec
        +    rescue LoadError
        +      mock_with :nothing
        +    end
        +  end
        +  @mock_framework
        +end
        +
        +
        + +
        +

        + + - (void) mock_framework=(framework) + + + + + +

        +
        + +

        Delegates to mock_framework=(framework).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +418
        +419
        +420
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 418
        +
        +def mock_framework=(framework)
        +  mock_with framework
        +end
        +
        +
        + +
        +

        + + - (void) mock_with(framework) + + + + + +

        +
        + +

        Sets the mock framework adapter module.

        + +

        framework can be a Symbol or a Module.

        + +

        Given any of :rspec, :mocha, +:flexmock, or :rr, configures the named +framework.

        + +

        Given :nothing, configures no framework. Use this if you +don't use any mocking framework to save a little bit of overhead.

        + +

        Given a Module, includes that module in every example group. The module +should adhere to RSpec's mock framework adapter API:

        + +
        setup_mocks_for_rspec
        +  - called before each example
        +
        +verify_mocks_for_rspec
        +  - called after each example if the example hasn't yet failed.
        +    Framework should raise an exception when expectations fail
        +
        +teardown_mocks_for_rspec
        +  - called after verify_mocks_for_rspec (even if there are errors)
        + +

        If the module responds to configuration and +mock_with receives a block, it will yield the configuration +object to the block e.g.

        + +
        config.mock_with OtherMockFrameworkAdapter do |mod_config|
        +  mod_config.custom_setting = true
        +end
        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +521
        +522
        +523
        +524
        +525
        +526
        +527
        +528
        +529
        +530
        +531
        +532
        +533
        +534
        +535
        +536
        +537
        +538
        +539
        +540
        +541
        +542
        +543
        +544
        +545
        +546
        +547
        +548
        +549
        +550
        +551
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 521
        +
        +def mock_with(framework)
        +  framework_module =
        +    if framework.is_a?(Module)
        +      framework
        +    else
        +      const_name = MOCKING_ADAPTERS.fetch(framework) do
        +        raise ArgumentError,
        +              "Unknown mocking framework: #{framework.inspect}. " \
        +              "Pass a module or one of #{MOCKING_ADAPTERS.keys.inspect}"
        +      end
        +
        +      RSpec::Support.require_rspec_core "mocking_adapters/#{const_name.to_s.downcase}"
        +      RSpec::Core::MockingAdapters.const_get(const_name)
        +    end
        +
        +  new_name, old_name = [framework_module, @mock_framework].map do |mod|
        +    mod.respond_to?(:framework_name) ?  mod.framework_name : :unnamed
        +  end
        +
        +  unless new_name == old_name
        +    assert_no_example_groups_defined(:mock_framework)
        +  end
        +
        +  if block_given?
        +    raise "#{framework_module} must respond to `configuration` so that " \
        +          "mock_with can yield it." unless framework_module.respond_to?(:configuration)
        +    yield framework_module.configuration
        +  end
        +
        +  @mock_framework = framework_module
        +end
        +
        +
        + +
        +

        + + - (void) order= + + + + + +

        +
        + +

        Sets the default global order and, if order is +'rand:<seed>', also sets the seed.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1248
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1248
        +
        +delegate_to_ordering_manager :order=
        +
        +
        + +
        +

        + + - (void) prepend(mod, *filters) + + + + + +

        + + + + +
        +
        +
        +
        +1124
        +1125
        +1126
        +1127
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1124
        +
        +def prepend(mod, *filters)
        +  meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
        +  include_extend_or_prepend_modules << [:prepend, mod, meta]
        +end
        +
        +
        + +
        +

        + + - (void) raise_errors_for_deprecations! + + + + + +

        +
        + +

        Turns deprecation warnings into errors, in order to surface the full +backtrace of the call site. This can be useful when you need more context +to address a deprecation than the single-line call site normally provided.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.raise_errors_for_deprecations!
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +1335
        +1336
        +1337
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1335
        +
        +def raise_errors_for_deprecations!
        +  self.deprecation_stream = Formatters::DeprecationFormatter::RaiseErrorStream.new
        +end
        +
        +
        + +
        +

        + + - (void) register_ordering {|list| ... } + + + + + +

        +
        + +
        + Note: +
        +

        Pass the symbol :global to set the ordering strategy that will +be used to order the top-level example groups and any example groups that +do not have declared :order metadata.

        +
        +
        + + +

        Registers a named ordering strategy that can later be used to order an +example group's subgroups by adding :order => +<name> metadata to the example group.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |rspec|
        +  rspec.register_ordering :reverse do |list|
        +    list.reverse
        +  end
        +end
        +
        +describe MyClass, :order => :reverse do
        +  # ...
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (Symbol) + + + + — +
          +

          The name of the ordering.

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + + + + + +
          +

          Block that will order the given examples or example groups

          +
          + +
        • + +
        +

        Yield Parameters:

        + +

        Yield Returns:

        + + +
        + + + + +
        +
        +
        +
        +1276
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1276
        +
        +delegate_to_ordering_manager :register_ordering
        +
        +
        + +
        +

        + + - (void) safe_prepend(mod, host) + + + + + +

        + + + + +
        +
        +
        +
        +1148
        +1149
        +1150
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1148
        +
        +def safe_prepend(mod, host)
        +  host.__send__(:prepend, mod) unless host < mod
        +end
        +
        +
        + +
        +

        + + - (void) seed + + + + + +

        +
        + +

        Seed for random ordering (default: generated randomly each run).

        + +

        When you run specs with --order random, RSpec generates a +random seed for the randomization and prints it to the +output_stream (assuming you're using RSpec's built-in +formatters). If you discover an ordering dependency (i.e. examples fail +intermittently depending on order), set this (on Configuration or on the +command line with --seed) to run using the same seed while you +debug the issue.

        + +

        We recommend, actually, that you use the command line approach so you +don't accidentally leave the seed encoded.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1242
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1242
        +
        +delegate_to_ordering_manager :seed
        +
        +
        + +
        +

        + + - (void) seed= + + + + + +

        +
        + +

        Sets the seed value and sets the default global ordering to random.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1228
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1228
        +
        +delegate_to_ordering_manager :seed=
        +
        +
        + +
        +

        + + - (void) treat_symbols_as_metadata_keys_with_true_values=(_value) + + + + + +

        +
        + +

        Deprecated. This config option was added in RSpec 2 to pave the way for +this being the default behavior in RSpec 3. Now this option is a no-op.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +272
        +273
        +274
        +275
        +276
        +277
        +278
        +279
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 272
        +
        +def (_value)
        +  RSpec.deprecate(
        +    "RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values=",
        +    :message => "RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values= " \
        +                "is deprecated, it is now set to true as default and " \
        +                "setting it to false has no effect."
        +  )
        +end
        +
        +
        + +
        +

        + + - (void) warnings=(value) + + + + + +

        +
        + +

        Set Ruby warnings on or off.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1282
        +1283
        +1284
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1282
        +
        +def warnings=(value)
        +  $VERBOSE = !!value
        +end
        +
        +
        + +
        +

        + + - (Boolean) warnings? + + + + + +

        +
        + +

        Returns Whether or not ruby warnings are enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not ruby warnings are enabled.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +1287
        +1288
        +1289
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1287
        +
        +def warnings?
        +  $VERBOSE
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/ConfigurationOptions.html b/source/documentation/3.2/rspec-core/RSpec/Core/ConfigurationOptions.html new file mode 100644 index 000000000..2edd5d97a --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/ConfigurationOptions.html @@ -0,0 +1,530 @@ + + + + + + Class: RSpec::Core::ConfigurationOptions + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::ConfigurationOptions + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/configuration_options.rb
        + +
        +
        + +

        Overview

        +
        + +

        Responsible for utilizing externally provided configuration options, +whether via the command line, .rspec, ~/.rspec, +.rspec-local or a custom options file.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Hash) options + + + + + + + + + readonly + + + + + + + + + +
          +

          The final merged options, drawn from all external sources.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ConfigurationOptions) initialize(args) + + + + + +

        +
        + +

        Returns a new instance of ConfigurationOptions

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + args + + + (Array<String>) + + + + — +
          +

          command line arguments

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/configuration_options.rb', line 12
        +
        +def initialize(args)
        +  @args = args.dup
        +  organize_options
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Hash) options (readonly) + + + + + +

        +
        + +

        Returns the final merged options, drawn from all external sources

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Hash) + + + + — +
          +

          the final merged options, drawn from all external sources

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/core/configuration_options.rb', line 37
        +
        +def options
        +  @options
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) configure(config) + + + + + +

        +
        + +

        Updates the provided RSpec::Core::Configuration instance based on the provided +external configuration options.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + config + + + (Configuration) + + + + — +
          +

          the configuration instance to update

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/core/configuration_options.rb', line 21
        +
        +def configure(config)
        +  process_options_into config
        +  configure_filter_manager config.filter_manager
        +  load_formatters_into config
        +end
        +
        +
        + +
        +

        + + - (void) configure_filter_manager(filter_manager) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Updates the provided FilterManager based on the filter options.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + filter_manager + + + (FilterManager) + + + + — +
          +

          instance to update

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/configuration_options.rb', line 30
        +
        +def configure_filter_manager(filter_manager)
        +  @filter_manager_options.each do |command, value|
        +    filter_manager.__send__ command, value
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/DSL.html b/source/documentation/3.2/rspec-core/RSpec/Core/DSL.html new file mode 100644 index 000000000..89c48c8a0 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/DSL.html @@ -0,0 +1,322 @@ + + + + + + Module: RSpec::Core::DSL + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::DSL + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/dsl.rb
        + +
        +
        + +

        Overview

        +
        + +

        DSL defines methods to group examples, most notably describe, +and exposes them as class methods of RSpec. They can also be exposed +globally (on main and instances of Module) +through the Configuration option expose_dsl_globally.

        + +

        By default the methods describe, context and +example_group are exposed. These methods define a named +context for one or more examples. The given block is evaluated in the +context of a generated subclass of ExampleGroup.

        + +

        Examples:

        + +
        RSpec.describe "something" do
        +  context "when something is a certain way" do
        +    it "does something" do
        +      # example code goes here
        +    end
        +  end
        +end
        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (void) expose_globally! + + + + + + + + + + + private + + +
          +

          Adds the describe method to Module and the top level binding.

          +
          + +
        • + + +
        • + + + + (void) remove_globally! + + + + + + + + + + + private + + +
          +

          Removes the describe method from Module and the top level binding.

          +
          + +
        • + + +
        + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (void) expose_globally! + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Adds the describe method to Module and the top level binding.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/dsl.rb', line 54
        +
        +def self.expose_globally!
        +  return if exposed_globally?
        +
        +  example_group_aliases.each do |method_name|
        +    expose_example_group_alias_globally(method_name)
        +  end
        +
        +  @exposed_globally = true
        +end
        +
        +
        + +
        +

        + + + (void) remove_globally! + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Removes the describe method from Module and the top level binding.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/core/dsl.rb', line 66
        +
        +def self.remove_globally!
        +  return unless exposed_globally?
        +
        +  example_group_aliases.each do |method_name|
        +    change_global_dsl { undef_method method_name }
        +  end
        +
        +  @exposed_globally = false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Example.html b/source/documentation/3.2/rspec-core/RSpec/Core/Example.html new file mode 100644 index 000000000..72f55b844 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Example.html @@ -0,0 +1,1430 @@ + + + + + + Class: RSpec::Core::Example + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Example + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example.rb
        + +
        +
        + +

        Overview

        +
        + +
        + Note: +
        +

        Example blocks are evaluated in the context of an instance of an +ExampleGroup, not in the context of an instance of +Example.

        +
        +
        + + +

        Wrapper for an instance of a subclass of ExampleGroup. An instance of +RSpec::Core::Example is returned by example definition methods +such as it and is yielded to the it, +before, after, around, +let and +subject blocks.

        + +

        This allows us to provide rich metadata about each individual example +without adding tons of methods directly to the ExampleGroup that users may +inadvertantly redefine.

        + +

        Useful for configuring logging and/or taking some action based on the state +of an example's metadata.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |config|
        +  config.before do |example|
        +    log example.description
        +  end
        +
        +  config.after do |example|
        +    log example.description
        +  end
        +
        +  config.around do |example|
        +    log example.description
        +    example.run
        +  end
        +end
        +
        +shared_examples "auditable" do
        +  it "does something" do
        +    log "#{example.full_description}: #{auditable.inspect}"
        +    auditable.should do_something
        +  end
        +end
        + +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + + + Classes: ExecutionResult, Procsy + + +

        + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (void) exception + + + + + + + + + readonly + + + + + + + + + +
          +

          Returns the first exception raised in the context of running this example +(nil if no exception is raised).

          +
          + +
        • + + +
        • + + + - (void) metadata + + + + + + + + + readonly + + + + + + + + + +
          +

          Returns the metadata object associated with this example.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Example) initialize(example_group_class, description, user_metadata, example_block = nil) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Creates a new instance of Example.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group_class + + + (Class) + + + + — +
          +

          the subclass of ExampleGroup in which this Example is declared

          +
          + +
        • + +
        • + + description + + + (String) + + + + — +
          +

          the String passed to the it method (or alias)

          +
          + +
        • + +
        • + + user_metadata + + + (Hash) + + + + — +
          +

          additional args passed to it to be used as metadata

          +
          + +
        • + +
        • + + example_block + + + (Proc) + + + (defaults to: nil) + + + — +
          +

          the block of code that represents the example

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +
        +
        # File 'lib/rspec/core/example.rb', line 127
        +
        +def initialize(example_group_class, description, , example_block=nil)
        +  @example_group_class = example_group_class
        +  @example_block       = example_block
        +
        +  @metadata = Metadata::ExampleHash.create(
        +    @example_group_class., , description, example_block
        +  )
        +
        +  @example_group_instance = @exception = nil
        +  @clock = RSpec::Core::Time
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (void) exception (readonly) + + + + + +

        +
        + +

        Returns the first exception raised in the context of running this example +(nil if no exception is raised).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/core/example.rb', line 99
        +
        +def exception
        +  @exception
        +end
        +
        +
        + + + +
        +

        + + - (void) metadata (readonly) + + + + + +

        +
        + +

        Returns the metadata object associated with this example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/core/example.rb', line 104
        +
        +def 
        +  @metadata
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) description + + + + + +

        +
        + +

        Returns the string submitted to example or its aliases (e.g. +specify, it, etc). If no string is submitted +(e.g. it { is_expected.to do_something }) it returns the +message generated by the matcher if there is one, otherwise returns a +message including the location of the example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core/example.rb', line 76
        +
        +def description
        +  description = if [:description].to_s.empty?
        +                  location_description
        +                else
        +                  [:description]
        +                end
        +
        +  RSpec.configuration.format_docstrings_block.call(description)
        +end
        +
        +
        + +
        +

        + + - (void) example_group + + + + + +

        +
        + +

        Returns the example group class that provides the context for running this +example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +141
        +142
        +143
        +
        +
        # File 'lib/rspec/core/example.rb', line 141
        +
        +def example_group
        +  @example_group_class
        +end
        +
        +
        + +
        +

        + + - (ExecutionResult) execution_result + + + + + +

        +
        + +

        Returns represents the result of running this example.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (ExecutionResult) + + + + — +
          +

          represents the result of running this example.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +53
        +
        +
        # File 'lib/rspec/core/example.rb', line 53
        +
        + :execution_result
        +
        +
        + +
        +

        + + - (String) file_path + + + + + +

        +
        + +

        Returns the relative path to the file where this example was defined.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the relative path to the file where this example was defined.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +56
        +
        +
        # File 'lib/rspec/core/example.rb', line 56
        +
        + :file_path
        +
        +
        + +
        +

        + + - (String) full_description + + + + + +

        +
        + +

        Returns the full description (including the docstrings of all parent +example groups).

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the full description (including the docstrings of all parent example +groups).

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +59
        +
        +
        # File 'lib/rspec/core/example.rb', line 59
        +
        + :full_description
        +
        +
        + +
        +

        + + - (void) inspect_output + + + + + +

        +
        + +

        Returns a description of the example that always includes the location.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/core/example.rb', line 87
        +
        +def inspect_output
        +  inspect_output = "\"#{description}\""
        +  unless [:description].to_s.empty?
        +    inspect_output << " (#{location})"
        +  end
        +  inspect_output
        +end
        +
        +
        + +
        +

        + + - (String) location + + + + + +

        +
        + +

        Returns the exact source location of this example in a form like +./path/to/spec.rb:17

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the exact source location of this example in a form like +./path/to/spec.rb:17

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +62
        +
        +
        # File 'lib/rspec/core/example.rb', line 62
        +
        + :location
        +
        +
        + +
        +

        + + - (Boolean) pending + + + + Also known as: + pending? + + + + +

        +
        + +

        Returns flag that indicates that the example is not expected to pass. It +will be run and will either have a pending result (if a failure occurs) or +a failed result (if no failure occurs).

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          flag that indicates that the example is not expected to pass. It will be +run and will either have a pending result (if a failure occurs) or a failed +result (if no failure occurs).

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +66
        +
        +
        # File 'lib/rspec/core/example.rb', line 66
        +
        + :pending
        +
        +
        + +
        +

        + + - (void) run(example_group_instance, reporter) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        instance_execs the block passed to the constructor in the context of the +instance of RSpec::Core::ExampleGroup.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group_instance + + + + + + + — +
          +

          the instance of an ExampleGroup subclass

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +152
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +165
        +166
        +167
        +168
        +169
        +170
        +171
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +182
        +183
        +184
        +185
        +186
        +187
        +188
        +189
        +190
        +191
        +192
        +193
        +194
        +195
        +196
        +197
        +
        +
        # File 'lib/rspec/core/example.rb', line 152
        +
        +def run(example_group_instance, reporter)
        +  @example_group_instance = example_group_instance
        +  RSpec.current_example = self
        +
        +  start(reporter)
        +  Pending.mark_pending!(self, pending) if pending?
        +
        +  begin
        +    if skipped?
        +      Pending.mark_pending! self, skip
        +    elsif !RSpec.configuration.dry_run?
        +      with_around_example_hooks do
        +        begin
        +          run_before_example
        +          @example_group_instance.instance_exec(self, &@example_block)
        +
        +          if pending?
        +            Pending.mark_fixed! self
        +
        +            raise Pending::PendingExampleFixedError,
        +                  'Expected example to fail since it is pending, but it passed.',
        +                  [location]
        +          end
        +        rescue Pending::SkipDeclaredInExample
        +          # no-op, required metadata has already been set by the `skip`
        +          # method.
        +        rescue Exception => e
        +          set_exception(e)
        +        ensure
        +          run_after_example
        +        end
        +      end
        +    end
        +  rescue Exception => e
        +    set_exception(e)
        +  ensure
        +    ExampleGroup.instance_variables_for_example(@example_group_instance).each do |ivar|
        +      @example_group_instance.instance_variable_set(ivar, nil)
        +    end
        +    @example_group_instance = nil
        +  end
        +
        +  finish(reporter)
        +ensure
        +  RSpec.current_example = nil
        +end
        +
        +
        + +
        +

        + + - (Boolean) skip + + + + Also known as: + skipped? + + + + +

        +
        + +

        Returns flag that will cause the example to not run. The ExecutionResult +status will be :pending.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          flag that will cause the example to not run. The ExecutionResult status +will be :pending.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +69
        +
        +
        # File 'lib/rspec/core/example.rb', line 69
        +
        + :skip
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Example/ExecutionResult.html b/source/documentation/3.2/rspec-core/RSpec/Core/Example/ExecutionResult.html new file mode 100644 index 000000000..b7d5df49b --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Example/ExecutionResult.html @@ -0,0 +1,957 @@ + + + + + + Class: RSpec::Core::Example::ExecutionResult + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Example::ExecutionResult + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example.rb
        + +
        +
        + +

        Overview

        +
        + +

        Represents the result of executing an example. Behaves like a hash for +backwards compatibility.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Exception?) exception + + + + + + + + + + + + + + + + +
          +

          The failure, if there was one.

          +
          + +
        • + + +
        • + + + - (Time) finished_at + + + + + + + + + + + + + + + + +
          +

          When the example finished.

          +
          + +
        • + + +
        • + + + - (Exception?) pending_exception + + + + + + + + + + + + + + + + +
          +

          The exception triggered while executing the pending example.

          +
          + +
        • + + +
        • + + + - (Boolean) pending_fixed + + + + (also: #pending_fixed?) + + + + + + + + + + + + + + +
          +

          For examples tagged with :pending, this indicates whether or +not it now passes.

          +
          + +
        • + + +
        • + + + - (String?) pending_message + + + + + + + + + + + + + + + + +
          +

          The reason the example was pending, or nil if the example was not pending.

          +
          + +
        • + + +
        • + + + - (Float) run_time + + + + + + + + + + + + + + + + +
          +

          How long the example took in seconds.

          +
          + +
        • + + +
        • + + + - (Time) started_at + + + + + + + + + + + + + + + + +
          +

          When the example started.

          +
          + +
        • + + +
        • + + + - (Symbol) status + + + + + + + + + + + + + + + + +
          +

          :passed, :failed or :pending.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Exception?) exception + + + + + +

        +
        + +

        Returns The failure, if there was one.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Exception, nil) + + + + — +
          +

          The failure, if there was one.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +441
        +442
        +443
        +
        +
        # File 'lib/rspec/core/example.rb', line 441
        +
        +def exception
        +  @exception
        +end
        +
        +
        + + + +
        +

        + + - (Time) finished_at + + + + + +

        +
        + +

        Returns When the example finished.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Time) + + + + — +
          +

          When the example finished.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +447
        +448
        +449
        +
        +
        # File 'lib/rspec/core/example.rb', line 447
        +
        +def finished_at
        +  @finished_at
        +end
        +
        +
        + + + +
        +

        + + - (Exception?) pending_exception + + + + + +

        +
        + +

        Returns The exception triggered while executing the pending example. If no +exception was triggered it would no longer get a status of +:pending unless it was tagged with :skip.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Exception, nil) + + + + — +
          +

          The exception triggered while executing the pending example. If no +exception was triggered it would no longer get a status of +:pending unless it was tagged with :skip.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +460
        +461
        +462
        +
        +
        # File 'lib/rspec/core/example.rb', line 460
        +
        +def pending_exception
        +  @pending_exception
        +end
        +
        +
        + + + +
        +

        + + - (Boolean) pending_fixed + + + + Also known as: + pending_fixed? + + + + +

        +
        + +

        Returns For examples tagged with :pending, this indicates +whether or not it now passes.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          For examples tagged with :pending, this indicates whether or +not it now passes.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +464
        +465
        +466
        +
        +
        # File 'lib/rspec/core/example.rb', line 464
        +
        +def pending_fixed
        +  @pending_fixed
        +end
        +
        +
        + + + +
        +

        + + - (String?) pending_message + + + + + +

        +
        + +

        Returns The reason the example was pending, or nil if the example was not +pending.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String, nil) + + + + — +
          +

          The reason the example was pending, or nil if the example was not pending.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +454
        +455
        +456
        +
        +
        # File 'lib/rspec/core/example.rb', line 454
        +
        +def pending_message
        +  @pending_message
        +end
        +
        +
        + + + +
        +

        + + - (Float) run_time + + + + + +

        +
        + +

        Returns How long the example took in seconds.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Float) + + + + — +
          +

          How long the example took in seconds.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +450
        +451
        +452
        +
        +
        # File 'lib/rspec/core/example.rb', line 450
        +
        +def run_time
        +  @run_time
        +end
        +
        +
        + + + +
        +

        + + - (Time) started_at + + + + + +

        +
        + +

        Returns When the example started.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Time) + + + + — +
          +

          When the example started.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +444
        +445
        +446
        +
        +
        # File 'lib/rspec/core/example.rb', line 444
        +
        +def started_at
        +  @started_at
        +end
        +
        +
        + + + +
        +

        + + - (Symbol) status + + + + + +

        +
        + +

        Returns :passed, :failed or +:pending.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Symbol) + + + + — +
          +

          :passed, :failed or :pending.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +438
        +439
        +440
        +
        +
        # File 'lib/rspec/core/example.rb', line 438
        +
        +def status
        +  @status
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) record_finished(status, finished_at) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Records the finished status of the example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +470
        +471
        +472
        +473
        +474
        +
        +
        # File 'lib/rspec/core/example.rb', line 470
        +
        +def record_finished(status, finished_at)
        +  self.status      = status
        +  self.finished_at = finished_at
        +  self.run_time    = (finished_at - started_at).to_f
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Example/Procsy.html b/source/documentation/3.2/rspec-core/RSpec/Core/Example/Procsy.html new file mode 100644 index 000000000..1db99699e --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Example/Procsy.html @@ -0,0 +1,550 @@ + + + + + + Class: RSpec::Core::Example::Procsy + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Example::Procsy + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example.rb
        + +
        +
        + +

        Overview

        +
        + +
        + Note: +
        +

        This class also exposes the instance methods of RSpec::Core::Example, proxying them +through to the wrapped RSpec::Core::Example instance.

        +
        +
        + + +

        Wraps both a Proc and an RSpec::Core::Example for use in around hooks. In around hooks we need to yield this special kind of object +(rather than the raw RSpec::Core::Example) because when there are multiple +around hooks we have to wrap them recursively.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |c|
        +  c.around do |ex| # Procsy which wraps the example
        +    if ex.[:key] == :some_value && some_global_condition
        +      raise "some message"
        +    end
        +    ex.run         # run delegates to ex.call.
        +  end
        +end
        + +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (void) call(*args, &block) + + + + (also: #run) + + + + + + + + + + + +
          +

          Calls the proc and notes that the example has been executed.

          +
          + +
        • + + +
        • + + + - (Boolean) executed? + + + + + + + + + + + + + +
          +

          Indicates whether or not the around hook has executed the example.

          +
          + +
        • + + +
        • + + + - (Procsy) initialize(example, &block) + + + + + + + constructor + + + + + + + + +
          +

          A new instance of Procsy.

          +
          + +
        • + + +
        • + + + - (void) to_proc + + + + + + + + + + + + + +
          +

          Provides a wrapped proc that will update our executed? state +when executed.

          +
          + +
        • + + +
        + + +
        +

        Constructor Details

        + +
        +

        + + - (Procsy) initialize(example, &block) + + + + + +

        +
        + +

        Returns a new instance of Procsy

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +246
        +247
        +248
        +249
        +250
        +
        +
        # File 'lib/rspec/core/example.rb', line 246
        +
        +def initialize(example, &block)
        +  @example  = example
        +  @proc     = block
        +  @executed = false
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (void) example (readonly) + + + + + +

        +
        + +

        The RSpec::Core::Example instance.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +219
        +220
        +221
        +
        +
        # File 'lib/rspec/core/example.rb', line 219
        +
        +def example
        +  @example
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) call(*args, &block) + + + + Also known as: + run + + + + +

        +
        + +

        Calls the proc and notes that the example has been executed.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +234
        +235
        +236
        +237
        +
        +
        # File 'lib/rspec/core/example.rb', line 234
        +
        +def call(*args, &block)
        +  @executed = true
        +  @proc.call(*args, &block)
        +end
        +
        +
        + +
        +

        + + - (Boolean) executed? + + + + + +

        +
        + +

        Indicates whether or not the around hook has executed the example.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +258
        +259
        +260
        +
        +
        # File 'lib/rspec/core/example.rb', line 258
        +
        +def executed?
        +  @executed
        +end
        +
        +
        + +
        +

        + + - (void) to_proc + + + + + +

        +
        + +

        Provides a wrapped proc that will update our executed? state +when executed.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +242
        +243
        +244
        +
        +
        # File 'lib/rspec/core/example.rb', line 242
        +
        +def to_proc
        +  method(:call).to_proc
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/ExampleGroup.html b/source/documentation/3.2/rspec-core/RSpec/Core/ExampleGroup.html new file mode 100644 index 000000000..cfe205ff1 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/ExampleGroup.html @@ -0,0 +1,6316 @@ + + + + + + Class: RSpec::Core::ExampleGroup + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::ExampleGroup + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        Hooks, MemoizedHelpers::ClassMethods, SharedExampleGroup
        + + + + +
        Includes:
        +
        MemoizedHelpers, Pending
        + + + + + +
        Defined in:
        +
        lib/rspec/core/example_group.rb
        + +
        +
        + +

        Overview

        +
        + +

        ExampleGroup and Example are the main structural elements of rspec-core. +Consider this example:

        + +
        describe Thing do
        +  it "does something" do
        +  end
        +end
        + +

        The object returned by describe Thing is a subclass of +ExampleGroup. The object returned by it "does +something" is an instance of Example, which serves as a wrapper +for an instance of the ExampleGroup in which it is declared.

        + +

        Example group bodies (e.g. describe or context +blocks) are evaluated in the context of a new subclass of ExampleGroup. +Individual examples are evaluated in the context of an instance of the +specific ExampleGroup subclass to which they belong.

        + +

        Besides the class methods defined here, there are other interesting macros +defined in Hooks, MemoizedHelpers::ClassMethods and +SharedExampleGroup. There are additional instance methods available to +your examples defined in MemoizedHelpers and Pending.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + + + + + + +

        + Metadata + (collapse) +

        + +
          + +
        • + + + + (String) description + + + + + + + + + + + + + +
          +

          The current example group description.

          +
          + +
        • + + +
        • + + + + (void) metadata + + + + + + + + + + + + + +
          +

          The Metadata object associated with this group.

          +
          + +
        • + + +
        • + + + - (void) described_class + + + + + + + + + + + + + +
          +

          Returns the class or module passed to the describe method (or +alias).

          +
          + +
        • + + +
        + +

        + Defining Examples + (collapse) +

        + + + +

        + Defining Example Groups + (collapse) +

        + +
          + +
        • + + + + (void) context + + + + + + + + + + + + + +
          +

          An alias of example_group.

          +
          + +
        • + + +
        • + + + + (void) describe + + + + + + + + + + + + + +
          +

          An alias of example_group.

          +
          + +
        • + + +
        • + + + + (void) example_group + + + + + + + + + + + + + +
          +

          Generates a subclass of this example group which inherits everything except +the examples themselves.

          +
          + +
        • + + +
        • + + + + (void) fcontext + + + + + + + + + + + + + +
          +

          Shortcut to define an example group with :focus => true.

          +
          + +
        • + + +
        • + + + + (void) fdescribe + + + + + + + + + + + + + +
          +

          Shortcut to define an example group with :focus => true.

          +
          + +
        • + + +
        • + + + + (void) xcontext + + + + + + + + + + + + + +
          +

          Shortcut to temporarily make an example group skipped.

          +
          + +
        • + + +
        • + + + + (void) xdescribe + + + + + + + + + + + + + +
          +

          Shortcut to temporarily make an example group skipped.

          +
          + +
        • + + +
        + +

        + Including Shared Example Groups + (collapse) +

        + +
          + +
        • + + + + (void) include_context(name, *args, &block) + + + + + + + + + + + + + +
          +

          Includes shared content mapped to name directly in the group +in which it is declared, as opposed to it_behaves_like, which +creates a nested group.

          +
          + +
        • + + +
        • + + + + (void) include_examples(name, *args, &block) + + + + + + + + + + + + + +
          +

          Includes shared content mapped to name directly in the group +in which it is declared, as opposed to it_behaves_like, which +creates a nested group.

          +
          + +
        • + + +
        • + + + + (void) it_behaves_like + + + + + + + + + + + + + +
          +

          Generates a nested example group and includes the shared content mapped to +name in the nested group.

          +
          + +
        • + + +
        • + + + + (void) it_should_behave_like + + + + + + + + + + + + + +
          +

          Generates a nested example group and includes the shared content mapped to +name in the nested group.

          +
          + +
        • + + +
        + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from SharedExampleGroup

        +

        shared_examples

        + + + + + + + + + +

        Methods included from MemoizedHelpers::ClassMethods

        +

        let, let!, subject, subject!

        + + + + + + + + + +

        Methods included from Hooks

        +

        after, append_after, around, before, prepend_before

        + + + + + + + + + +

        Methods included from Pending

        +

        #pending, #skip

        + + + + + + + + + +

        Methods included from MemoizedHelpers

        +

        #is_expected, #should, #should_not, #subject

        +
        +

        Constructor Details

        + +
        +

        + + - (ExampleGroup) initialize(inspect_output = nil) + + + + + +

        +
        + +

        Returns a new instance of ExampleGroup

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +572
        +573
        +574
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 572
        +
        +def initialize(inspect_output=nil)
        +  @__inspect_output = inspect_output || '(no description provided)'
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + + (void) context + + + (void) context(&example_group_definition) + + + (void) context(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        An alias of example_group. Generally used when grouping +examples contextually (e.g. “with xyz”, “when xyz” or “if xyz”). Generates +a subclass of this example group which inherits everything except the +examples themselves.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.describe "something" do # << This describe method is defined in
        +                              # << RSpec::Core::DSL, included in the
        +                              # << global namespace (optional)
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  context "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) context(&example_group_definition) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) context(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The group's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the group.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the group. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +260
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 260
        +
        +define_example_group_method :context
        +
        +
        + +
        +

        + + + + (void) describe + + + (void) describe(&example_group_definition) + + + (void) describe(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        An alias of example_group. Generally used when grouping +examples by a thing you are describing (e.g. an object, class or method). +Generates a subclass of this example group which inherits everything except +the examples themselves.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.describe "something" do # << This describe method is defined in
        +                              # << RSpec::Core::DSL, included in the
        +                              # << global namespace (optional)
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  describe "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) describe(&example_group_definition) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) describe(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The group's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the group.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the group. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +255
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 255
        +
        +define_example_group_method :describe
        +
        +
        + +
        +

        + + + (String) description + + + + + +

        +
        + +

        Returns the current example group description

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the current example group description

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 66
        +
        +def self.description
        +  description = [:description]
        +  RSpec.configuration.format_docstrings_block.call(description)
        +end
        +
        +
        + +
        +

        + + + + (void) example + + + (void) example(&example_implementation) + + + (void) example(doc_string, *metadata_keys, metadata = {}) + + + (void) example(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Defines an example within a group.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        example do
        +end
        +
        +example "does something" do
        +end
        +
        +example "does something", :slow, :uses_js do
        +end
        +
        +example "does something", :with => 'additional metadata' do
        +end
        +
        +example "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) example(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) example(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) example(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +136
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 136
        +
        +define_example_method :example
        +
        +
        + +
        +

        + + + + (void) example_group + + + (void) example_group(&example_group_definition) + + + (void) example_group(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Generates a subclass of this example group which inherits everything except +the examples themselves.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.describe "something" do # << This describe method is defined in
        +                              # << RSpec::Core::DSL, included in the
        +                              # << global namespace (optional)
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  example_group "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) example_group(&example_group_definition) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) example_group(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The group's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the group.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the group. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +250
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 250
        +
        +define_example_group_method :example_group
        +
        +
        + +
        +

        + + + + (void) fcontext + + + (void) fcontext(&example_group_definition) + + + (void) fcontext(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example group with :focus => true. +Generates a subclass of this example group which inherits everything except +the examples themselves.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.describe "something" do # << This describe method is defined in
        +                              # << RSpec::Core::DSL, included in the
        +                              # << global namespace (optional)
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  fcontext "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) fcontext(&example_group_definition) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) fcontext(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The group's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the group.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the group. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +276
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 276
        +
        +define_example_group_method :fcontext,  :focus => true
        +
        +
        + +
        +

        + + + + (void) fdescribe + + + (void) fdescribe(&example_group_definition) + + + (void) fdescribe(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example group with :focus => true. +Generates a subclass of this example group which inherits everything except +the examples themselves.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.describe "something" do # << This describe method is defined in
        +                              # << RSpec::Core::DSL, included in the
        +                              # << global namespace (optional)
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  fdescribe "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) fdescribe(&example_group_definition) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) fdescribe(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The group's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the group.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the group. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +272
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 272
        +
        +define_example_group_method :fdescribe, :focus => true
        +
        +
        + +
        +

        + + + + (void) fexample + + + (void) fexample(&example_implementation) + + + (void) fexample(doc_string, *metadata_keys, metadata = {}) + + + (void) fexample(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :focus => true.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        fexample do
        +end
        +
        +fexample "does something" do
        +end
        +
        +fexample "does something", :slow, :uses_js do
        +end
        +
        +fexample "does something", :with => 'additional metadata' do
        +end
        +
        +fexample "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) fexample(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) fexample(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) fexample(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +155
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 155
        +
        +define_example_method :fexample, :focus => true
        +
        +
        + +
        +

        + + + + (void) fit + + + (void) fit(&example_implementation) + + + (void) fit(doc_string, *metadata_keys, metadata = {}) + + + (void) fit(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :focus => true.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        fit do
        +end
        +
        +fit "does something" do
        +end
        +
        +fit "does something", :slow, :uses_js do
        +end
        +
        +fit "does something", :with => 'additional metadata' do
        +end
        +
        +fit "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) fit(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) fit(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) fit(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +158
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 158
        +
        +define_example_method :fit,      :focus => true
        +
        +
        + +
        +

        + + + + (void) focus + + + (void) focus(&example_implementation) + + + (void) focus(doc_string, *metadata_keys, metadata = {}) + + + (void) focus(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :focus => true.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        focus do
        +end
        +
        +focus "does something" do
        +end
        +
        +focus "does something", :slow, :uses_js do
        +end
        +
        +focus "does something", :with => 'additional metadata' do
        +end
        +
        +focus "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) focus(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) focus(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) focus(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +152
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 152
        +
        +define_example_method :focus,    :focus => true
        +
        +
        + +
        +

        + + + + (void) fspecify + + + (void) fspecify(&example_implementation) + + + (void) fspecify(doc_string, *metadata_keys, metadata = {}) + + + (void) fspecify(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :focus => true.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        fspecify do
        +end
        +
        +fspecify "does something" do
        +end
        +
        +fspecify "does something", :slow, :uses_js do
        +end
        +
        +fspecify "does something", :with => 'additional metadata' do
        +end
        +
        +fspecify "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) fspecify(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) fspecify(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) fspecify(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +161
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 161
        +
        +define_example_method :fspecify, :focus => true
        +
        +
        + +
        +

        + + + (void) include_context(name, *args, &block) + + + + + +

        +
        + +

        Includes shared content mapped to name directly in the group +in which it is declared, as opposed to it_behaves_like, which +creates a nested group. If given a block, that block is also eval'd in +the current context.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +313
        +314
        +315
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 313
        +
        +def self.include_context(name, *args, &block)
        +  find_and_eval_shared("context", name, caller.first, *args, &block)
        +end
        +
        +
        + +
        +

        + + + (void) include_examples(name, *args, &block) + + + + + +

        +
        + +

        Includes shared content mapped to name directly in the group +in which it is declared, as opposed to it_behaves_like, which +creates a nested group. If given a block, that block is also eval'd in +the current context.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +323
        +324
        +325
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 323
        +
        +def self.include_examples(name, *args, &block)
        +  find_and_eval_shared("examples", name, caller.first, *args, &block)
        +end
        +
        +
        + +
        +

        + + + + (void) it + + + (void) it(&example_implementation) + + + (void) it(doc_string, *metadata_keys, metadata = {}) + + + (void) it(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Defines an example within a group. This is the primary API to define a code +example.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        it do
        +end
        +
        +it "does something" do
        +end
        +
        +it "does something", :slow, :uses_js do
        +end
        +
        +it "does something", :with => 'additional metadata' do
        +end
        +
        +it "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) it(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) it(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) it(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +139
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 139
        +
        +define_example_method :it
        +
        +
        + +
        +

        + + + (void) it_behaves_like + + + + + +

        +
        + +

        Generates a nested example group and includes the shared content mapped to +name in the nested group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +302
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 302
        +
        +define_nested_shared_group_method :it_behaves_like, "behaves like"
        +
        +
        + +
        +

        + + + (void) it_should_behave_like + + + + + +

        +
        + +

        Generates a nested example group and includes the shared content mapped to +name in the nested group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +305
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 305
        +
        +define_nested_shared_group_method :it_should_behave_like
        +
        +
        + +
        +

        + + + (void) metadata + + + + + +

        +
        + +

        The Metadata object associated with this group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 46
        +
        +def self.
        +  @metadata if defined?(@metadata)
        +end
        +
        +
        + +
        +

        + + + + (void) pending + + + (void) pending(&example_implementation) + + + (void) pending(doc_string, *metadata_keys, metadata = {}) + + + (void) pending(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :pending => true

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        pending do
        +end
        +
        +pending "does something" do
        +end
        +
        +pending "does something", :slow, :uses_js do
        +end
        +
        +pending "does something", :with => 'additional metadata' do
        +end
        +
        +pending "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) pending(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) pending(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) pending(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +176
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 176
        +
        +define_example_method :pending,  :pending => true
        +
        +
        + +
        +

        + + + (void) run(reporter) + + + + + +

        +
        + +

        Runs all the examples in this group.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +467
        +468
        +469
        +470
        +471
        +472
        +473
        +474
        +475
        +476
        +477
        +478
        +479
        +480
        +481
        +482
        +483
        +484
        +485
        +486
        +487
        +488
        +489
        +490
        +491
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 467
        +
        +def self.run(reporter)
        +  if RSpec.world.wants_to_quit
        +    RSpec.world.clear_remaining_example_groups if top_level?
        +    return
        +  end
        +  reporter.example_group_started(self)
        +
        +  begin
        +    instance = new('before(:context) hook')
        +    run_before_context_hooks(instance)
        +    result_for_this_group = run_examples(reporter)
        +    results_for_descendants = ordering_strategy.order(children).map { |child| child.run(reporter) }.all?
        +    result_for_this_group && results_for_descendants
        +  rescue Pending::SkipDeclaredInExample => ex
        +    for_filtered_examples(reporter) { |example| example.skip_with_exception(reporter, ex) }
        +  rescue Exception => ex
        +    RSpec.world.wants_to_quit = true if fail_fast?
        +    for_filtered_examples(reporter) { |example| example.fail_with_exception(reporter, ex) }
        +  ensure
        +    instance = new('after(:context) hook')
        +    run_after_context_hooks(instance)
        +    before_context_ivars.clear
        +    reporter.example_group_finished(self)
        +  end
        +end
        +
        +
        + +
        +

        + + + + (void) skip + + + (void) skip(&example_implementation) + + + (void) skip(doc_string, *metadata_keys, metadata = {}) + + + (void) skip(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :skip => true

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        skip do
        +end
        +
        +skip "does something" do
        +end
        +
        +skip "does something", :slow, :uses_js do
        +end
        +
        +skip "does something", :with => 'additional metadata' do
        +end
        +
        +skip "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) skip(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) skip(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) skip(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +173
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 173
        +
        +define_example_method :skip,     :skip => true
        +
        +
        + +
        +

        + + + + (void) specify + + + (void) specify(&example_implementation) + + + (void) specify(doc_string, *metadata_keys, metadata = {}) + + + (void) specify(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Defines an example within a group. Useful for when your docstring does not +read well off of it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.describe MyClass do
        +  specify "#do_something is deprecated" do
        +    # ...
        +  end
        +end
        + + +
        specify do
        +end
        +
        +specify "does something" do
        +end
        +
        +specify "does something", :slow, :uses_js do
        +end
        +
        +specify "does something", :with => 'additional metadata' do
        +end
        +
        +specify "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) specify(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) specify(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) specify(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +148
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 148
        +
        +define_example_method :specify
        +
        +
        + +
        +

        + + + + (void) xcontext + + + (void) xcontext(&example_group_definition) + + + (void) xcontext(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to temporarily make an example group skipped. Generates a subclass +of this example group which inherits everything except the examples +themselves.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.describe "something" do # << This describe method is defined in
        +                              # << RSpec::Core::DSL, included in the
        +                              # << global namespace (optional)
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  xcontext "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) xcontext(&example_group_definition) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) xcontext(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The group's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the group.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the group. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +268
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 268
        +
        +define_example_group_method :xcontext,  :skip => "Temporarily skipped with xcontext"
        +
        +
        + +
        +

        + + + + (void) xdescribe + + + (void) xdescribe(&example_group_definition) + + + (void) xdescribe(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to temporarily make an example group skipped. Generates a subclass +of this example group which inherits everything except the examples +themselves.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.describe "something" do # << This describe method is defined in
        +                              # << RSpec::Core::DSL, included in the
        +                              # << global namespace (optional)
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  xdescribe "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) xdescribe(&example_group_definition) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) xdescribe(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The group's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the group.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the group. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_group_definition + + + (Block) + + + + — +
            +

            The definition of the example group.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +264
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 264
        +
        +define_example_group_method :xdescribe, :skip => "Temporarily skipped with xdescribe"
        +
        +
        + +
        +

        + + + + (void) xexample + + + (void) xexample(&example_implementation) + + + (void) xexample(doc_string, *metadata_keys, metadata = {}) + + + (void) xexample(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :skip => 'Temporarily +skipped with xexample'.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        xexample do
        +end
        +
        +xexample "does something" do
        +end
        +
        +xexample "does something", :slow, :uses_js do
        +end
        +
        +xexample "does something", :with => 'additional metadata' do
        +end
        +
        +xexample "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) xexample(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) xexample(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) xexample(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +164
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 164
        +
        +define_example_method :xexample, :skip => 'Temporarily skipped with xexample'
        +
        +
        + +
        +

        + + + + (void) xit + + + (void) xit(&example_implementation) + + + (void) xit(doc_string, *metadata_keys, metadata = {}) + + + (void) xit(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :skip => 'Temporarily +skipped with xit'.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        xit do
        +end
        +
        +xit "does something" do
        +end
        +
        +xit "does something", :slow, :uses_js do
        +end
        +
        +xit "does something", :with => 'additional metadata' do
        +end
        +
        +xit "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) xit(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) xit(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) xit(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +167
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 167
        +
        +define_example_method :xit,      :skip => 'Temporarily skipped with xit'
        +
        +
        + +
        +

        + + + + (void) xspecify + + + (void) xspecify(&example_implementation) + + + (void) xspecify(doc_string, *metadata_keys, metadata = {}) + + + (void) xspecify(doc_string, *metadata_keys, metadata = {}, &example_implementation) + + + + + + +

        +
        + +

        Shortcut to define an example with :skip => 'Temporarily +skipped with xspecify'.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        xspecify do
        +end
        +
        +xspecify "does something" do
        +end
        +
        +xspecify "does something", :slow, :uses_js do
        +end
        +
        +xspecify "does something", :with => 'additional metadata' do
        +end
        +
        +xspecify "does something" do |ex|
        +  # ex is the Example object that contains metadata about the example
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + + (void) xspecify(&example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) xspecify(doc_string, *metadata_keys, metadata = {}) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + + (void) xspecify(doc_string, *metadata_keys, metadata = {}, &example_implementation) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doc_string + + + (String) + + + + — +
            +

            The example's doc string.

            +
            + +
          • + +
          • + + metadata + + + (Hash) + + + (defaults to: {}) + + + — +
            +

            Metadata for the example.

            +
            + +
          • + +
          • + + metadata_keys + + + (Array<Symbol>) + + + + — +
            +

            Metadata tags for the example. Will be transformed into hash entries with +true values.

            +
            + +
          • + +
          • + + example_implementation + + + (Block) + + + + — +
            +

            The implementation of the example.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +170
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 170
        +
        +define_example_method :xspecify, :skip => 'Temporarily skipped with xspecify'
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) described_class + + + + + +

        +
        + +

        Returns the class or module passed to the describe method (or +alias). Returns nil if the subject is not a class or module.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        describe Thing do
        +  it "does something" do
        +    described_class == Thing
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 80
        +
        +def described_class
        +  self.class.described_class
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters.html new file mode 100644 index 000000000..b2c2d4a77 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters.html @@ -0,0 +1,354 @@ + + + + + + Module: RSpec::Core::Formatters + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Formatters + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters.rb,
        + lib/rspec/core/formatters/helpers.rb,
        lib/rspec/core/formatters/protocol.rb,
        lib/rspec/core/formatters/html_printer.rb,
        lib/rspec/core/formatters/console_codes.rb,
        lib/rspec/core/formatters/json_formatter.rb,
        lib/rspec/core/formatters/html_formatter.rb,
        lib/rspec/core/formatters/base_formatter.rb,
        lib/rspec/core/formatters/profile_formatter.rb,
        lib/rspec/core/formatters/snippet_extractor.rb,
        lib/rspec/core/formatters/progress_formatter.rb,
        lib/rspec/core/formatters/base_text_formatter.rb,
        lib/rspec/core/formatters/deprecation_formatter.rb,
        lib/rspec/core/formatters/documentation_formatter.rb
        +
        + +
        +
        + +

        Overview

        +
        + +

        Built-in Formatters

        +
        • +

          progress (default) - Prints dots for passing examples, F for +failures, * for pending.

          +
        • +

          documentation - Prints the docstrings passed to describe and +it methods (and their aliases).

          +
        • +

          html

          +
        • +

          json - Useful for archiving data for subsequent analysis.

          +
        + +

        The progress formatter is the default, but you can choose any one or more +of the other formatters by passing with the --format (or +-f for short) command-line option, e.g.

        + +
        rspec --format documentation
        + +

        You can also send the output of multiple formatters to different streams, +e.g.

        + +
        rspec --format documentation --format html --out results.html
        + +

        This example sends the output of the documentation formatter to +$stdout, and the output of the html formatter to results.html.

        + +

        Custom Formatters

        + +

        You can tell RSpec to use a custom formatter by passing its path and name +to the rspec commmand. For example, if you define +MyCustomFormatter in path/to/my_custom_formatter.rb, you would type this +command:

        + +
        rspec --require path/to/my_custom_formatter.rb --format MyCustomFormatter
        +
        + +

        The reporter calls every formatter with this protocol:

        +
        • +

          To start

          +
        • +

          start(StartNotification)

          +
        • +

          Once per example group

          +
        • +

          example_group_started(GroupNotification)

          +
        • +

          Once per example

          +
        • +

          example_started(ExampleNotification)

          +
        • +

          One of these per example, depending on outcome

          +
        • +

          example_passed(ExampleNotification)

          +
        • +

          example_failed(FailedExampleNotification)

          +
        • +

          example_pending(ExampleNotification)

          +
        • +

          Optionally at any time

          +
        • +

          message(MessageNotification)

          +
        • +

          At the end of the suite

          +
        • +

          stop(ExamplesNotification)

          +
        • +

          start_dump(NullNotification)

          +
        • +

          dump_pending(ExamplesNotification)

          +
        • +

          dump_failures(ExamplesNotification)

          +
        • +

          dump_summary(SummaryNotification)

          +
        • +

          seed(SeedNotification)

          +
        • +

          close(NullNotification)

          +
        + +

        Only the notifications to which you subscribe your formatter will be called +on your formatter. To subscribe your formatter use: +RSpec::Core::Formatters#register e.g.

        + +

        RSpec::Core::Formatters.register FormatterClassName, :example_passed, +:example_failed

        + +

        We recommend you implement the methods yourself; for simplicity we provide +the default formatter output via our notification objects but if you prefer +you can subclass RSpec::Core::Formatters::BaseTextFormatter +and override the methods you wish to enhance.

        + + +
        +
        +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + Modules: ConsoleCodes, Helpers + + + + Classes: BaseFormatter, BaseTextFormatter, Loader, ProfileFormatter, Protocol, SnippetExtractor + + +

        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (void) register(formatter_class, *notifications) + + + + + +

        +
        + +

        Register the formatter class

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + formatter_class + + + (Class) + + + + — +
          +

          formatter class to register

          +
          + +
        • + +
        • + + notifications + + + (Symbol, ...) + + + + — +
          +

          one or more notifications to be registered to the specified formatter

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 81
        +
        +def self.register(formatter_class, *notifications)
        +  Loader.formatters[formatter_class] = notifications
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/BaseFormatter.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/BaseFormatter.html new file mode 100644 index 000000000..9c021973e --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/BaseFormatter.html @@ -0,0 +1,677 @@ + + + + + + Class: RSpec::Core::Formatters::BaseFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::BaseFormatter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/base_formatter.rb
        + +
        +
        + +

        Overview

        +
        + +

        RSpec's built-in formatters are all subclasses of +RSpec::Core::Formatters::BaseTextFormatter.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        +

        Direct Known Subclasses

        +

        BaseTextFormatter

        +
        + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (void) example_group + + + + + + + + + + + + + + + + +
          +

          Returns the value of attribute example_group.

          +
          + +
        • + + +
        • + + + - (void) output + + + + + + + + + readonly + + + + + + + + + +
          +

          Returns the value of attribute output.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (BaseFormatter) initialize(output) + + + + + +

        +
        + +

        Returns a new instance of BaseFormatter

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + output + + + (IO) + + + + — +
          +

          the formatter output

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 23
        +
        +def initialize(output)
        +  @output = output || StringIO.new
        +  @example_group = nil
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (void) example_group + + + + + +

        +
        + +

        Returns the value of attribute example_group

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 17
        +
        +def example_group
        +  @example_group
        +end
        +
        +
        + + + +
        +

        + + - (void) output (readonly) + + + + + +

        +
        + +

        Returns the value of attribute output

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 18
        +
        +def output
        +  @output
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) close(_notification) + + + + + +

        +
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + _notification + + + (NullNotification) + + + + — +
          +

          (Ignored)

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 50
        +
        +def close(_notification)
        +  restore_sync_output
        +end
        +
        +
        + +
        +

        + + - (void) example_group_started(notification) + + + + + +

        +
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (GroupNotification) + + + + — +
          +

          containing example_group subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 42
        +
        +def example_group_started(notification)
        +  @example_group = notification.group
        +end
        +
        +
        + +
        +

        + + - (void) start(notification) + + + + + +

        +
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (StartNotification) + + + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 32
        +
        +def start(notification)
        +  start_sync_output
        +  @example_count = notification.count
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html new file mode 100644 index 000000000..6aa65f05c --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html @@ -0,0 +1,533 @@ + + + + + + Class: RSpec::Core::Formatters::BaseTextFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::BaseTextFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseFormatter + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/base_text_formatter.rb
        + +
        +
        + +

        Overview

        +
        + +

        Base for all of RSpec's built-in formatters. See +RSpec::Core::Formatters::BaseFormatter to learn more about all of the +methods called by the reporter.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #example_group, #output

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #example_group_started, #initialize, #start

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Formatters::BaseFormatter

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) close(_notification) + + + + + +

        +
        + +

        Invoked at the very end, close allows the formatter to clean +up resources, e.g. open streams, etc.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + _notification + + + (NullNotification) + + + + — +
          +

          (Ignored)

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 65
        +
        +def close(_notification)
        +  return unless IO === output
        +  return if output.closed?
        +
        +  output.puts
        +
        +  output.close unless output == $stdout
        +end
        +
        +
        + +
        +

        + + - (void) dump_failures(notification) + + + + + +

        +
        + +

        Dumps detailed information about each example failure.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (NullNotification) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 31
        +
        +def dump_failures(notification)
        +  return if notification.failure_notifications.empty?
        +  output.puts notification.fully_formatted_failed_examples
        +end
        +
        +
        + +
        +

        + + - (void) dump_summary(summary) + + + + + +

        +
        + +

        This method is invoked after the dumping of examples and failures. Each +parameter is assigned to a corresponding attribute.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + summary + + + (SummaryNotification) + + + + — +
          +

          containing duration, example_count, failure_count and pending_count

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 43
        +
        +def dump_summary(summary)
        +  output.puts summary.fully_formatted
        +end
        +
        +
        + +
        +

        + + - (void) message(notification) + + + + + +

        +
        + +

        Used by the reporter to send messages to the output stream.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (MessageNotification) + + + + — +
          +

          containing message

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 22
        +
        +def message(notification)
        +  output.puts notification.message
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/ConsoleCodes.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/ConsoleCodes.html new file mode 100644 index 000000000..dc250fef2 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/ConsoleCodes.html @@ -0,0 +1,387 @@ + + + + + + Module: RSpec::Core::Formatters::ConsoleCodes + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Formatters::ConsoleCodes + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/console_codes.rb
        + +
        +
        + +

        Overview

        +
        + +

        ConsoleCodes provides helpers for formatting console output with ANSI +codes, e.g. color's and bold.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Fixnum) console_code_for(code_or_symbol) + + + + + +

        +
        + +

        Fetches the correct code for the supplied symbol, or checks that a code is +valid. Defaults to white (37).

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + code_or_symbol + + + (Symbol, Fixnum) + + + + — +
          +

          Symbol or code to check

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Fixnum) + + + + — +
          +

          a console code

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/core/formatters/console_codes.rb', line 30
        +
        +def console_code_for(code_or_symbol)
        +  if RSpec.configuration.respond_to?(:#{code_or_symbol}_color")
        +    console_code_for configuration_color(code_or_symbol)
        +  elsif VT100_CODE_VALUES.key?(code_or_symbol)
        +    code_or_symbol
        +  else
        +    VT100_CODES.fetch(code_or_symbol) do
        +      console_code_for(:white)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (String) wrap(text, code_or_symbol) + + + + + +

        +
        + +

        Wraps a piece of text in ANSI codes with the supplied code. Will only apply +the control code if RSpec.configuration.color_enabled? returns +true.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + text + + + (String) + + + + — +
          +

          the text to wrap

          +
          + +
        • + +
        • + + code_or_symbol + + + (Symbol, Fixnum) + + + + — +
          +

          the desired control code

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the wrapped text

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core/formatters/console_codes.rb', line 49
        +
        +def wrap(text, code_or_symbol)
        +  if RSpec.configuration.color_enabled?
        +    "\e[#{console_code_for(code_or_symbol)}m#{text}\e[0m"
        +  else
        +    text
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Helpers.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Helpers.html new file mode 100644 index 000000000..707add311 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Helpers.html @@ -0,0 +1,533 @@ + + + + + + Module: RSpec::Core::Formatters::Helpers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Formatters::Helpers + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/helpers.rb
        + +
        +
        + +

        Overview

        +
        + +

        Formatters helpers.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (String) format_duration(duration) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Formats seconds into a human-readable string.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        format_duration(1) #=>  "1 minute 1 second"
        +format_duration(135.14) #=> "2 minutes 15.14 seconds"
        + +
        +

        Parameters:

        +
          + +
        • + + duration + + + (Float, Fixnum) + + + + — +
          +

          in seconds

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          human-readable time

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 22
        +
        +def self.format_duration(duration)
        +  precision = case
        +              when duration < 1 then    SUB_SECOND_PRECISION
        +              when duration < 120 then  DEFAULT_PRECISION
        +              when duration < 300 then  1
        +              else                  0
        +              end
        +
        +  if duration > 60
        +    minutes = (duration.to_i / 60).to_i
        +    seconds = duration - minutes * 60
        +
        +    "#{pluralize(minutes, 'minute')} #{pluralize(format_seconds(seconds, precision), 'second')}"
        +  else
        +    pluralize(format_seconds(duration, precision), 'second')
        +  end
        +end
        +
        +
        + +
        +

        + + + (String) format_seconds(float, precision = nil) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Formats seconds to have 5 digits of precision with trailing zeros removed +if the number is less than 1 or with 2 digits of precision if the number is +greater than zero.

        + +

        The precision used is set in SUB_SECOND_PRECISION and +DEFAULT_PRECISION.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        format_seconds(0.000006) #=> "0.00001"
        +format_seconds(0.020000) #=> "0.02"
        +format_seconds(1.00000000001) #=> "1"
        + +
        +

        Parameters:

        +
          + +
        • + + float + + + (Float) + + + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          formatted float

          +
          + +
        • + +
        + +

        See Also:

        +
          + +
        • #strip_trailing_zeroes
        • + +
        + +
        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 58
        +
        +def self.format_seconds(float, precision=nil)
        +  precision ||= (float < 1) ? SUB_SECOND_PRECISION : DEFAULT_PRECISION
        +  formatted = "%.#{precision}f" % float
        +  strip_trailing_zeroes(formatted)
        +end
        +
        +
        + +
        +

        + + + (String) pluralize(count, string) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Pluralize a word based on a count.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + count + + + (Fixnum) + + + + — +
          +

          number of objects

          +
          + +
        • + +
        • + + string + + + (String) + + + + — +
          +

          word to be pluralized

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          pluralized word

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 83
        +
        +def self.pluralize(count, string)
        +  "#{count} #{string}#{'s' unless count.to_f == 1}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Loader.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Loader.html new file mode 100644 index 000000000..eebcc68ab --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Loader.html @@ -0,0 +1,601 @@ + + + + + + Class: RSpec::Core::Formatters::Loader + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::Loader + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        RSpec::Core::Formatters::Loader is an internal class for +managing formatters used by a particular configuration. It is not expected +to be used directly, but only through the configuration interface.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (String) default_formatter + + + + + + + + + + + + + + private + + +
          +

          The default formatter to setup, defaults to progress.

          +
          + +
        • + + +
        • + + + - (Array) formatters + + + + + + + + + readonly + + + + + + + private + + +
          +

          The loaded formatters.

          +
          + +
        • + + +
        • + + + - (Reporter) reporter + + + + + + + + + readonly + + + + + + + private + + +
          +

          The reporter.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (void) formatters + + + + + + + + + + + private + + +
          +

          Internal formatters are stored here when loaded.

          +
          + +
        • + + +
        + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Loader) initialize(reporter) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of Loader

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +103
        +104
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 100
        +
        +def initialize(reporter)
        +  @formatters = []
        +  @reporter = reporter
        +  self.default_formatter = 'progress'
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (String) default_formatter + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns the default formatter to setup, defaults to progress

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the default formatter to setup, defaults to progress

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 113
        +
        +def default_formatter
        +  @default_formatter
        +end
        +
        +
        + + + +
        +

        + + - (Array) formatters (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns the loaded formatters

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + + — +
          +

          the loaded formatters

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 107
        +
        +def formatters
        +  @formatters
        +end
        +
        +
        + + + +
        +

        + + - (Reporter) reporter (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns the reporter

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Reporter) + + + + — +
          +

          the reporter

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 110
        +
        +def reporter
        +  @reporter
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (void) formatters + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Internal formatters are stored here when loaded.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 95
        +
        +def self.formatters
        +  @formatters ||= {}
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/ProfileFormatter.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/ProfileFormatter.html new file mode 100644 index 000000000..766835465 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/ProfileFormatter.html @@ -0,0 +1,316 @@ + + + + + + Class: RSpec::Core::Formatters::ProfileFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::ProfileFormatter + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/profile_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Formatter for providing profile output.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ProfileFormatter) initialize(output) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of ProfileFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/core/formatters/profile_formatter.rb', line 11
        +
        +def initialize(output)
        +  @output = output
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) dump_profile(profile) + + + + + +

        +
        + +

        This method is invoked after the dumping the summary if profiling is +enabled.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + profile + + + (ProfileNotification) + + + + — +
          +

          containing duration, slowest_examples and slowest_example_groups

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/core/formatters/profile_formatter.rb', line 25
        +
        +def dump_profile(profile)
        +  dump_profile_slowest_examples(profile)
        +  dump_profile_slowest_example_groups(profile)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Protocol.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Protocol.html new file mode 100644 index 000000000..d39dcd28f --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/Protocol.html @@ -0,0 +1,1485 @@ + + + + + + Class: RSpec::Core::Formatters::Protocol + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::Protocol + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/protocol.rb
        + +
        +
        + +

        Overview

        +
        + +

        This class isn't loaded at runtime but serves to document all of the +notifications implemented as part of the standard interface. The reporter +will issue these during a normal test suite run, but a formatter will only +receive those notifications it has registered itself to receive. To +register a formatter call:

        + +

        ::RSpec::Core::Formatters.register class, :list, :of, +:notifications

        + +

        e.g.

        + +

        ::RSpec::Core::Formatters.register self, :start, +:example_started

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Suite Notifications + (collapse) +

        + +
          + +
        • + + + - (void) close + + + + + + + + + + + + + +
          +

          Invoked at the very end, close allows the formatter to clean +up resources, e.g.

          +
          + +
        • + + +
        • + + + - (void) dump_failures + + + + + + + + + + + + + +
          +

          Dumps detailed information about each example failure.

          +
          + +
        • + + +
        • + + + - (void) dump_pending + + + + + + + + + + + + + +
          +

          Outputs a report of pending examples.

          +
          + +
        • + + +
        • + + + - (void) dump_profile + + + + + + + + + + + + + +
          +

          This method is invoked after the dumping the summary if profiling is +enabled.

          +
          + +
        • + + +
        • + + + - (void) dump_summary + + + + + + + + + + + + + +
          +

          This method is invoked after the dumping of examples and failures.

          +
          + +
        • + + +
        • + + + - (void) message + + + + + + + + + + + + + +
          +

          Used by the reporter to send messages to the output stream.

          +
          + +
        • + + +
        • + + + - (void) start + + + + + + + + + + + + + +
          +

          This method is invoked before any examples are run, right after they have +all been collected.

          +
          + +
        • + + +
        • + + + - (void) start_dump + + + + + + + + + + + + + +
          +

          This method is invoked after all of the examples have executed.

          +
          + +
        • + + +
        • + + + - (void) stop + + + + + + + + + + + + + +
          +

          Invoked after all examples have executed, before dumping post-run reports.

          +
          + +
        • + + +
        + +

        + Group Notifications + (collapse) +

        + + + +

        + Example Notifications + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (void) initialize + + + + + +

        +
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + output + + + (IO) + + + + — +
          +

          the formatter output

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 20
        +
        +
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) close + + + + + +

        +
        + +

        Invoked at the very end, close allows the formatter to clean +up resources, e.g. open streams, etc.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (NullNotification) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 169
        +
        +
        +
        +
        + +
        +

        + + - (void) dump_failures + + + + + +

        +
        + +

        Dumps detailed information about each example failure.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (NullNotification) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 124
        +
        +
        +
        +
        + +
        +

        + + - (void) dump_pending + + + + + +

        +
        + +

        Outputs a report of pending examples. This gets invoked after the summary +if option is set to do so.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (NullNotification) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 152
        +
        +
        +
        +
        + +
        +

        + + - (void) dump_profile + + + + + +

        +
        + +

        This method is invoked after the dumping the summary if profiling is +enabled.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + profile + + + (ProfileNotification) + + + + — +
          +

          containing duration, slowest_examples and slowest_example_groups

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 142
        +
        +
        +
        +
        + +
        +

        + + - (void) dump_summary + + + + + +

        +
        + +

        This method is invoked after the dumping of examples and failures. Each +parameter is assigned to a corresponding attribute.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + summary + + + (SummaryNotification) + + + + — +
          +

          containing duration, example_count, failure_count and pending_count

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 132
        +
        +
        +
        +
        + +
        +

        + + - (void) example_failed + + + + + +

        +
        + +

        Invoked when an example fails.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (ExampleNotification) + + + + — +
          +

          containing example subclass of RSpec::Core::Example

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 87
        +
        +
        +
        +
        + +
        +

        + + - (void) example_group_finished + + + + + +

        +
        + +

        Invoked at the end of the execution of each example group.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (GroupNotification) + + + + — +
          +

          containing example_group subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 51
        +
        +
        +
        +
        + +
        +

        + + - (void) example_group_started + + + + + +

        +
        + +

        This method is invoked at the beginning of the execution of each example +group.

        + +

        The next method to be invoked after this is #example_passed, +#example_pending, or #example_group_finished.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (GroupNotification) + + + + — +
          +

          containing example_group subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 38
        +
        +
        +
        +
        + +
        +

        + + - (void) example_passed + + + + + +

        +
        + +

        Invoked when an example passes.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (ExampleNotification) + + + + — +
          +

          containing example subclass of RSpec::Core::Example

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 69
        +
        +
        +
        +
        + +
        +

        + + - (void) example_pending + + + + + +

        +
        + +

        Invoked when an example is pending.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (ExampleNotification) + + + + — +
          +

          containing example subclass of RSpec::Core::Example

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 78
        +
        +
        +
        +
        + +
        +

        + + - (void) example_started + + + + + +

        +
        + +

        Invoked at the beginning of the execution of each example.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (ExampleNotification) + + + + — +
          +

          containing example subclass of RSpec::Core::Example

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 60
        +
        +
        +
        +
        + +
        +

        + + - (void) message + + + + + +

        +
        + +

        Used by the reporter to send messages to the output stream.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (MessageNotification) + + + + — +
          +

          containing message

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 96
        +
        +
        +
        +
        + +
        +

        + + - (void) start + + + + + +

        +
        + +

        This method is invoked before any examples are run, right after they have +all been collected. This can be useful for special formatters that need to +provide progress on feedback (graphical ones).

        + +

        This will only be invoked once, and the next one to be invoked is +#example_group_started.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (StartNotification) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 25
        +
        +
        +
        +
        + +
        +

        + + - (void) start_dump + + + + + +

        +
        + +

        This method is invoked after all of the examples have executed. The next +method to be invoked after this one is #dump_failures (BaseTextFormatter +then calls #dump_failures once for each failed example).

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (NullNotification) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 113
        +
        +
        +
        +
        + +
        +

        + + - (void) stop + + + + + +

        +
        + +

        Invoked after all examples have executed, before dumping post-run reports.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + notification + + + (NullNotification) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/core/formatters/protocol.rb', line 104
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html new file mode 100644 index 000000000..1053d1717 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html @@ -0,0 +1,681 @@ + + + + + + Class: RSpec::Core::Formatters::SnippetExtractor + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::SnippetExtractor + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/snippet_extractor.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Extracts code snippets by looking at the backtrace of the passed error and +applies synax highlighting and line numbers using html.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) lines_around(file, line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Extract lines of code centered around a particular line within a source +file.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + file + + + (String) + + + + — +
          +

          filename

          +
          + +
        • + +
        • + + line + + + (Fixnum) + + + + — +
          +

          line number

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          lines around the target line within the file (2 above and 1 below).

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 75
        +
        +def lines_around(file, line)
        +  if File.file?(file)
        +    lines = File.read(file).split("\n")
        +    min = [0, line - 3].max
        +    max = [line + 1, lines.length - 1].min
        +    selected_lines = []
        +    selected_lines.join("\n")
        +    lines[min..max].join("\n")
        +  else
        +    "# Couldn't get snippet for #{file}"
        +  end
        +rescue SecurityError
        +  "# Couldn't get snippet for #{file}"
        +end
        +
        +
        + +
        +

        + + - (String) post_process(highlighted, offending_line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Adds line numbers to all lines and highlights the line where the failure +occurred using html span tags.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + highlighted + + + (String) + + + + — +
          +

          syntax-highlighted snippet surrounding the offending line of code

          +
          + +
        • + +
        • + + offending_line + + + (Fixnum) + + + + — +
          +

          line where failure occured

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          completed snippet

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 99
        +
        +def post_process(highlighted, offending_line)
        +  new_lines = []
        +  highlighted.split("\n").each_with_index do |line, i|
        +    new_line = "<span class=\"linenum\">#{offending_line + i - 2}</span>#{line}"
        +    new_line = "<span class=\"offending\">#{new_line}</span>" if i == 2
        +    new_lines << new_line
        +  end
        +  new_lines.join("\n")
        +end
        +
        +
        + +
        +

        + + - (String) snippet(backtrace) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Extract lines of code corresponding to a backtrace.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + backtrace + + + (String) + + + + — +
          +

          the backtrace from a test failure

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          highlighted code snippet indicating where the test failure occured

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 41
        +
        +def snippet(backtrace)
        +  raw_code, line = snippet_for(backtrace[0])
        +  highlighted = @@converter.convert(raw_code)
        +  post_process(highlighted, line)
        +end
        +
        +
        + +
        +

        + + - (String) snippet_for(error_line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Create a snippet from a line of code.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + error_line + + + (String) + + + + — +
          +

          file name with line number (i.e. 'foo_spec.rb:12')

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          lines around the target line within the file

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 56
        +
        +def snippet_for(error_line)
        +  if error_line =~ /(.*):(\d+)/
        +    file = Regexp.last_match[1]
        +    line = Regexp.last_match[2].to_i
        +    [lines_around(file, line), line]
        +  else
        +    ["# Couldn't get snippet for #{error_line}", 1]
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Hooks.html b/source/documentation/3.2/rspec-core/RSpec/Core/Hooks.html new file mode 100644 index 000000000..93bb28111 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Hooks.html @@ -0,0 +1,1230 @@ + + + + + + Module: RSpec::Core::Hooks + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Hooks + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Configuration, ExampleGroup, World
        + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides before, after and around +hooks as a means of supporting common setup and teardown. This module is +extended onto ExampleGroup, making the methods available from any +describe or context block and included in +Configuration, making them available off of the configuration object to +define global setup or teardown logic.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (void) after(*args, &block) + + + + (also: #prepend_after) + + + + + + + + + + + +
          +

          Declare a block of code to be run after each example (using +:example) or once after all examples n the context (using +:context).

          +
          + +
        • + + +
        • + + + - (void) append_after(*args, &block) + + + + + + + + + + + + + +
          +

          Adds block to the back of the list of after +blocks in the same scope (:example, :context, or +:suite).

          +
          + +
        • + + +
        • + + + - (void) around(*args) {|Example| ... } + + + + + + + + + + + + + +
          +

          Declare a block of code, parts of which will be run before and parts after +the example.

          +
          + +
        • + + +
        • + + + - (void) before(*args, &block) + + + + (also: #append_before) + + + + + + + + + + + +
          +

          Declare a block of code to be run before each example (using +:example) or once before any example (using +:context).

          +
          + +
        • + + +
        • + + + - (void) prepend_before(*args, &block) + + + + + + + + + + + + + +
          +

          Adds block to the front of the list of before +blocks in the same scope (:example, :context, or +:suite).

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + + - (void) after(&block) + + - (void) after(scope, &block) + + - (void) after(scope, conditions, &block) + + - (void) after(conditions, &block) + + + + + Also known as: + prepend_after + + + + +

        +
        + +
        + Note: +
        +

        The :example and :context scopes are also +available as :each and :all, respectively. Use +whichever you prefer.

        +
        +
        + + +

        Declare a block of code to be run after each example (using +:example) or once after all examples n the context (using +:context). See #before for more information about ordering.

        + +

        Exceptions

        + +

        after hooks are guaranteed to run even when there are +exceptions in before hooks or examples. When an exception is +raised in an after block, the exception is captured for later reporting, +and subsequent after blocks are run.

        + +

        Order

        + +

        after hooks are stored in three scopes, which are run in +order: :example, :context, and +:suite. They can also be declared in several different places: +RSpec.configure, a parent group, the current group. They are +run in the following order:

        + +
        after(:example) # Declared in the current group.
        +after(:example) # Declared in a parent group.
        +after(:example) # Declared in RSpec.configure.
        +after(:context) # Declared in the current group.
        +after(:context) # Declared in a parent group.
        +after(:context) # Declared in RSpec.configure.
        +after(:suite)   # Declared in RSpec.configure.
        + +

        This is the reverse of the order in which before hooks are +run. Similarly, if more than one after is declared within any +one scope, they are run in reverse order of that in which they are +declared.

        + + +
        +
        +
        + +

        Overloads:

        +
          + + + +
        • + - (void) after(scope, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + scope + + + (Symbol) + + + + — +
            +

            :example, :context, or :suite +(defaults to :example)

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (void) after(scope, conditions, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + scope + + + (Symbol) + + + + — +
            +

            :example, :context, or :suite +(defaults to :example)

            +
            + +
          • + +
          • + + conditions + + + (Hash) + + + + — +
            +

            constrains this hook to examples matching these conditions e.g. +after(:example, :ui => true) { ... } will only run with +examples or groups declared with :ui => true.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (void) after(conditions, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + conditions + + + (Hash) + + + + — +
            +

            constrains this hook to examples matching these conditions e.g. +after(:example, :ui => true) { ... } will only run with +examples or groups declared with :ui => true.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +258
        +259
        +260
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 258
        +
        +def after(*args, &block)
        +  hooks.register :prepend, :after, *args, &block
        +end
        +
        +
        + +
        +

        + + - (void) append_after(*args, &block) + + + + + +

        +
        + +

        Adds block to the back of the list of after +blocks in the same scope (:example, :context, or +:suite).

        + +

        See #after for scoping semantics.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +268
        +269
        +270
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 268
        +
        +def append_after(*args, &block)
        +  hooks.register :append, :after, *args, &block
        +end
        +
        +
        + +
        +

        + + + - (void) around(&block) + + - (void) around(scope, &block) + + - (void) around(scope, conditions, &block) + + - (void) around(conditions, &block) + + + + + + +

        +
        + +
        + Note: +
        +

        the syntax of around is similar to that of before +and after but the semantics are quite different. +before and after hooks are run in the context of +of the examples with which they are associated, whereas around +hooks are actually responsible for running the examples. Consequently, +around hooks do not have direct access to resources that are +made available within the examples and their associated before +and after hooks.

        +
        +
        + +
        + Note: +
        +

        :example/:each is the only supported scope.

        +
        +
        + + +

        Declare a block of code, parts of which will be run before and parts after +the example. It is your responsibility to run the example:

        + +
        around(:example) do |ex|
        +  # Do some stuff before.
        +  ex.run
        +  # Do some stuff after.
        +end
        +
        + +

        The yielded example aliases run with call, which +lets you treat it like a Proc. This is especially handy when +working with libaries that manage their own setup and teardown using a +block or proc syntax, e.g.

        + +
        around(:example) {|ex| Database.transaction(&ex)}
        +around(:example) {|ex| FakeFS(&ex)}
        +
        + + +
        +
        +
        + +

        Overloads:

        +
          + + + +
        • + - (void) around(scope, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + scope + + + (Symbol) + + + + — +
            +

            :example (defaults to :example) present for +syntax parity with before and after, but +:example/:each is the only supported value.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (void) around(scope, conditions, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + scope + + + (Symbol) + + + + — +
            +

            :example (defaults to :example) present for +syntax parity with before and after, but +:example/:each is the only supported value.

            +
            + +
          • + +
          • + + conditions + + + (Hash) + + + + — +
            +

            constrains this hook to examples matching these conditions e.g. +around(:example, :ui => true) { ... } will only run with +examples or groups declared with :ui => true.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (void) around(conditions, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + conditions + + + (Hash) + + + + — +
            +

            constrains this hook to examples matching these conditions e.g. +around(:example, :ui => true) { ... } will only run with +examples or groups declared with :ui => true.

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +
          +

          the example to run

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +319
        +320
        +321
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 319
        +
        +def around(*args, &block)
        +  hooks.register :prepend, :around, *args, &block
        +end
        +
        +
        + +
        +

        + + + - (void) before(&block) + + - (void) before(scope, &block) + + - (void) before(scope, conditions, &block) + + - (void) before(conditions, &block) + + + + + Also known as: + append_before + + + + +

        +
        + +
        + Note: +
        +

        The :example and :context scopes are also +available as :each and :all, respectively. Use +whichever you prefer.

        +
        +
        + + +

        Declare a block of code to be run before each example (using +:example) or once before any example (using +:context). These are usually declared directly in the +ExampleGroup to which they apply, but they can also be shared across +multiple groups.

        + +

        You can also use before(:suite) to run a block of code before +any example groups are run. This should be declared in RSpec.configure.

        + +

        Instance variables declared in before(:example) or +before(:context) are accessible within each example.

        + +

        Order

        + +

        before hooks are stored in three scopes, which are run in +order: :suite, :context, and +:example. They can also be declared in several different +places: RSpec.configure, a parent group, the current group. +They are run in the following order:

        + +
        before(:suite)    # Declared in RSpec.configure.
        +before(:context)  # Declared in RSpec.configure.
        +before(:context)  # Declared in a parent group.
        +before(:context)  # Declared in the current group.
        +before(:example)  # Declared in RSpec.configure.
        +before(:example)  # Declared in a parent group.
        +before(:example)  # Declared in the current group.
        + +

        If more than one before is declared within any one scope, they +are run in the order in which they are declared.

        + +

        Conditions

        + +

        When you add a conditions hash to before(:example) or +before(:context), RSpec will only apply that hook to groups or +examples that match the conditions. e.g.

        + +
        RSpec.configure do |config|
        +  config.before(:example, :authorized => true) do
        +     :authorized_user
        +  end
        +end
        +
        +describe Something, :authorized => true do
        +  # The before hook will run in before each example in this group.
        +end
        +
        +describe SomethingElse do
        +  it "does something", :authorized => true do
        +    # The before hook will run before this example.
        +  end
        +
        +  it "does something else" do
        +    # The hook will not run before this example.
        +  end
        +end
        +
        + +

        Warning: before(:suite, :with => :conditions)

        + +

        The conditions hash is used to match against specific examples. Since +before(:suite) is not run in relation to any specific example +or group, conditions passed along with :suite are effectively +ignored.

        + +

        Exceptions

        + +

        When an exception is raised in a before block, RSpec skips any +subsequent before blocks and the example, but runs all of the +after(:example) and after(:context) hooks.

        + +

        Warning: implicit before blocks

        + +

        before hooks can also be declared in shared contexts which get +included implicitly either by you or by extension libraries. Since RSpec +runs these in the order in which they are declared within each scope, load +order matters, and can lead to confusing results when one before block +depends on state that is prepared in another before block that gets run +later.

        + +

        Warning: before(:context)

        + +

        It is very tempting to use before(:context) to speed things +up, but we recommend that you avoid this as there are a number of gotchas, +as well as things that simply don't work.

        + +

        Context

        + +

        before(:context) is run in an example that is generated to +provide group context for the block.

        + +

        Instance variables

        + +

        Instance variables declared in before(:context) are shared +across all the examples in the group. This means that each example can +change the state of a shared object, resulting in an ordering dependency +that can make it difficult to reason about failures.

        + +

        Unsupported RSpec constructs

        + +

        RSpec has several constructs that reset state between each example +automatically. These are not intended for use from within +before(:context):

        +
        • +

          let declarations

          +
        • +

          subject declarations

          +
        • +

          Any mocking, stubbing or test double declaration

          +
        + +

        other frameworks

        + +

        Mock object frameworks and database transaction managers (like +ActiveRecord) are typically designed around the idea of setting up before +an example, running that one example, and then tearing down. This means +that mocks and stubs can (sometimes) be declared in +before(:context), but get torn down before the first real +example is ever run.

        + +

        You can create database-backed model objects in a +before(:context) in rspec-rails, but it will not be wrapped in +a transaction for you, so you are on your own to clean up in an +after(:context) block.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        +

        before(:example) declared in an ExampleGroup

        +

        + +
        
        +describe Thing do
        +  before(:example) do
        +    @thing = Thing.new
        +  end
        +
        +  it "does something" do
        +    # Here you can access @thing.
        +  end
        +end
        + + +

        +

        before(:context) declared in an ExampleGroup

        +

        + +
        
        +describe Parser do
        +  before(:context) do
        +    File.open(file_to_parse, 'w') do |f|
        +      f.write <<-CONTENT
        +        stuff in the file
        +      CONTENT
        +    end
        +  end
        +
        +  it "parses the file" do
        +    Parser.parse(file_to_parse)
        +  end
        +
        +  after(:context) do
        +    File.delete(file_to_parse)
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + + +
        • + - (void) before(scope, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + scope + + + (Symbol) + + + + — +
            +

            :example, :context, or :suite +(defaults to :example)

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (void) before(scope, conditions, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + scope + + + (Symbol) + + + + — +
            +

            :example, :context, or :suite +(defaults to :example)

            +
            + +
          • + +
          • + + conditions + + + (Hash) + + + + — +
            +

            constrains this hook to examples matching these conditions e.g. +before(:example, :ui => true) { ... } will only run with +examples or groups declared with :ui => true.

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (void) before(conditions, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + conditions + + + (Hash) + + + + — +
            +

            constrains this hook to examples matching these conditions e.g. +before(:example, :ui => true) { ... } will only run with +examples or groups declared with :ui => true.

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +187
        +188
        +189
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 187
        +
        +def before(*args, &block)
        +  hooks.register :append, :before, *args, &block
        +end
        +
        +
        + +
        +

        + + - (void) prepend_before(*args, &block) + + + + + +

        +
        + +

        Adds block to the front of the list of before +blocks in the same scope (:example, :context, or +:suite).

        + +

        See #before for scoping semantics.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +197
        +198
        +199
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 197
        +
        +def prepend_before(*args, &block)
        +  hooks.register :prepend, :before, *args, &block
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/MemoizedHelpers.html b/source/documentation/3.2/rspec-core/RSpec/Core/MemoizedHelpers.html new file mode 100644 index 000000000..0a58de317 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/MemoizedHelpers.html @@ -0,0 +1,603 @@ + + + + + + Module: RSpec::Core::MemoizedHelpers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MemoizedHelpers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/memoized_helpers.rb
        + +
        +
        + +

        Overview

        +
        + +

        This module is included in ExampleGroup, making the methods available to +be called from within example blocks.

        + + +
        +
        +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + Modules: ClassMethods + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) is_expected + + + + + +

        +
        + +
        + Note: +
        +

        This only works if you are using rspec-expectations.

        +
        +
        + + +

        Wraps the subject in expect to make it the target +of an expectation. Designed to read nicely for one-liners.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe [1, 2, 3] do
        +  it { is_expected.to be_an Array }
        +  it { is_expected.not_to include 4 }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 118
        +
        +def is_expected
        +  expect(subject)
        +end
        +
        +
        + +
        +

        + + - (void) should(matcher = nil, message = nil) + + + + + +

        +
        + +
        + Note: +
        +

        This only works if you are using rspec-expectations.

        +
        +
        + +
        + Note: +
        +

        If you are using RSpec's newer expect-based syntax you may want to use +is_expected.to instead of should.

        +
        +
        + + +

        When should is called with no explicit receiver, the call is +delegated to the object returned by subject. Combined with an +implicit subject this supports very concise expressions.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Person do
        +  it { should be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 80
        +
        +def should(matcher=nil, message=nil)
        +  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(subject, matcher, message)
        +end
        +
        +
        + +
        +

        + + - (void) should_not(matcher = nil, message = nil) + + + + + +

        +
        + +
        + Note: +
        +

        This only works if you are using rspec-expectations.

        +
        +
        + +
        + Note: +
        +

        If you are using RSpec's newer expect-based syntax you may want to use +is_expected.to_not instead of should_not.

        +
        +
        + + +

        Just like should, should_not delegates to the +subject (implicit or explicit) of the example group.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Person do
        +  it { should_not be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 99
        +
        +def should_not(matcher=nil, message=nil)
        +  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(subject, matcher, message)
        +end
        +
        +
        + +
        +

        + + - (void) subject + + + + + +

        +
        + +
        + Note: +
        +

        subject was contributed by Joe Ferris to support the one-liner +syntax embraced by shoulda matchers:

        + +
        describe Widget do
        +  it { is_expected.to validate_presence_of(:name) }
        +  # or
        +  it { should validate_presence_of(:name) }
        +end
        + +

        While the examples below demonstrate how to use subject +explicitly in examples, we recommend that you define a method with an +intention revealing name instead.

        +
        +
        + +
        + Note: +
        +

        Because subject is designed to create state that is reset +between each example, and before(:context) is designed to +setup state that is shared across all examples in an example +group, subject is not intended to be used in a +before(:context) hook.

        +
        +
        + + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +# Explicit declaration of subject.
        +describe Person do
        +  subject { Person.new(:birthdate => 19.years.ago) }
        +  it "should be eligible to vote" do
        +    subject.should be_eligible_to_vote
        +    # ^ ^ explicit reference to subject not recommended
        +  end
        +end
        +
        +# Implicit subject => { Person.new }.
        +describe Person do
        +  it "should be eligible to vote" do
        +    subject.should be_eligible_to_vote
        +    # ^ ^ explicit reference to subject not recommended
        +  end
        +end
        +
        +# One-liner syntax - expectation is set on the subject.
        +describe Person do
        +  it { is_expected.to be_eligible_to_vote }
        +  # or
        +  it { should be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 55
        +
        +def subject
        +  __memoized.fetch(:subject) do
        +    __memoized[:subject] = begin
        +      described = described_class || self.class..fetch(:description_args).first
        +      Class === described ? described.new : described
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html b/source/documentation/3.2/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html new file mode 100644 index 000000000..ef47d983d --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html @@ -0,0 +1,693 @@ + + + + + + Module: RSpec::Core::MemoizedHelpers::ClassMethods + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MemoizedHelpers::ClassMethods + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/memoized_helpers.rb
        + +
        +
        + +

        Overview

        +
        + +

        This module is extended onto ExampleGroup, making the methods available +to be called from within example group blocks. You can think of them as +being analagous to class macros.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (void) let(name, &block) + + + + + + + + + + + + + +
          +

          Generates a method whose return value is memoized after the first call.

          +
          + +
        • + + +
        • + + + - (void) let!(name, &block) + + + + + + + + + + + + + +
          +

          Just like let, except the block is invoked by an implicit +before hook.

          +
          + +
        • + + +
        • + + + - (void) subject(name = nil, &block) + + + + + + + + + + + + + +
          +

          Declares a subject for an example group which can then be +wrapped with expect using is_expected to make it +the target of an expectation in a concise, one-line example.

          +
          + +
        • + + +
        • + + + - (void) subject!(name = nil, &block) + + + + + + + + + + + + + +
          +

          Just like subject, except the block is invoked by an implicit +before hook.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) let(name, &block) + + + + + +

        +
        + +
        + Note: +
        +

        let can enhance readability when used sparingly (1,2, +or maybe 3 declarations) in any given example group, but that can quickly +degrade with overuse. YMMV.

        +
        +
        + +
        + Note: +
        +

        let uses an ||= conditional that has the +potential to behave in surprising ways in examples that spawn separate +threads, though we have yet to see this in practice. You've been +warned.

        +
        +
        + +
        + Note: +
        +

        Because let is designed to create state that is reset between +each example, and before(:context) is designed to setup state +that is shared across all examples in an example group, +let is not intended to be used in a +before(:context) hook.

        +
        +
        + + +

        Generates a method whose return value is memoized after the first call. +Useful for reducing duplication between examples that assign values to the +same local variable.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Thing do
        +  let(:thing) { Thing.new }
        +
        +  it "does something" do
        +    # First invocation, executes block, memoizes and returns result.
        +    thing.do_something
        +
        +    # Second invocation, returns the memoized value.
        +    thing.should be_something
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +231
        +232
        +233
        +234
        +235
        +236
        +237
        +238
        +239
        +240
        +241
        +242
        +243
        +244
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 231
        +
        +def let(name, &block)
        +  # We have to pass the block directly to `define_method` to
        +  # allow it to use method constructs like `super` and `return`.
        +  raise "#let or #subject called without a block" if block.nil?
        +  MemoizedHelpers.module_for(self).__send__(:define_method, name, &block)
        +
        +  # Apply the memoization. The method has been defined in an ancestor
        +  # module so we can use `super` here to get the value.
        +  if block.arity == 1
        +    define_method(name) { __memoized.fetch(name) { |k| __memoized[k] = super(RSpec.current_example, &nil) } }
        +  else
        +    define_method(name) { __memoized.fetch(name) { |k| __memoized[k] = super(&nil) } }
        +  end
        +end
        +
        +
        + +
        +

        + + - (void) let!(name, &block) + + + + + +

        +
        + +

        Just like let, except the block is invoked by an implicit +before hook. This serves a dual purpose of setting up state +and providing a memoized reference to that state.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +class Thing
        +  def self.count
        +    @count ||= 0
        +  end
        +
        +  def self.count=(val)
        +    @count += val
        +  end
        +
        +  def self.reset_count
        +    @count = 0
        +  end
        +
        +  def initialize
        +    self.class.count += 1
        +  end
        +end
        +
        +describe Thing do
        +  after(:example) { Thing.reset_count }
        +
        +  context "using let" do
        +    let(:thing) { Thing.new }
        +
        +    it "is not invoked implicitly" do
        +      Thing.count.should eq(0)
        +    end
        +
        +    it "can be invoked explicitly" do
        +      thing
        +      Thing.count.should eq(1)
        +    end
        +  end
        +
        +  context "using let!" do
        +    let!(:thing) { Thing.new }
        +
        +    it "is invoked implicitly" do
        +      Thing.count.should eq(1)
        +    end
        +
        +    it "returns memoized version on first invocation" do
        +      thing
        +      Thing.count.should eq(1)
        +    end
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +299
        +300
        +301
        +302
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 299
        +
        +def let!(name, &block)
        +  let(name, &block)
        +  before { __send__(name) }
        +end
        +
        +
        + +
        +

        + + - (void) subject(name = nil, &block) + + + + + +

        +
        + +

        Declares a subject for an example group which can then be +wrapped with expect using is_expected to make it +the target of an expectation in a concise, one-line example.

        + +

        Given a name, defines a method with that name which returns +the subject. This lets you declare the subject once and access +it implicitly in one-liners and explicitly using an intention revealing +name.

        + +

        When given a name, calling super in the block is +not supported.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe CheckingAccount, "with $50" do
        +  subject { CheckingAccount.new(Money.new(50, :USD)) }
        +  it { is_expected.to have_a_balance_of(Money.new(50, :USD)) }
        +  it { is_expected.not_to be_overdrawn }
        +end
        +
        +describe CheckingAccount, "with a non-zero starting balance" do
        +  subject(:account) { CheckingAccount.new(Money.new(50, :USD)) }
        +  it { is_expected.not_to be_overdrawn }
        +  it "has a balance equal to the starting balance" do
        +    .balance.should eq(Money.new(50, :USD))
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (String, Symbol) + + + (defaults to: nil) + + + — +
          +

          used to define an accessor with an intention revealing name

          +
          + +
        • + +
        • + + block + + + + + + + — +
          +

          defines the value to be returned by subject in examples

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +338
        +339
        +340
        +341
        +342
        +343
        +344
        +345
        +346
        +347
        +348
        +349
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 338
        +
        +def subject(name=nil, &block)
        +  if name
        +    let(name, &block)
        +    alias_method :subject, name
        +
        +    self::NamedSubjectPreventSuper.__send__(:define_method, name) do
        +      raise NotImplementedError, "`super` in named subjects is not supported"
        +    end
        +  else
        +    let(:subject, &block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (void) subject!(name = nil, &block) + + + + + +

        +
        + +

        Just like subject, except the block is invoked by an implicit +before hook. This serves a dual purpose of setting up state +and providing a memoized reference to that state.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +class Thing
        +  def self.count
        +    @count ||= 0
        +  end
        +
        +  def self.count=(val)
        +    @count += val
        +  end
        +
        +  def self.reset_count
        +    @count = 0
        +  end
        +
        +  def initialize
        +    self.class.count += 1
        +  end
        +end
        +
        +describe Thing do
        +  after(:example) { Thing.reset_count }
        +
        +  context "using subject" do
        +    subject { Thing.new }
        +
        +    it "is not invoked implicitly" do
        +      Thing.count.should eq(0)
        +    end
        +
        +    it "can be invoked explicitly" do
        +      subject
        +      Thing.count.should eq(1)
        +    end
        +  end
        +
        +  context "using subject!" do
        +    subject!(:thing) { Thing.new }
        +
        +    it "is invoked implicitly" do
        +      Thing.count.should eq(1)
        +    end
        +
        +    it "returns memoized version on first invocation" do
        +      subject
        +      Thing.count.should eq(1)
        +    end
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +404
        +405
        +406
        +407
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 404
        +
        +def subject!(name=nil, &block)
        +  subject(name, &block)
        +  before { subject }
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Metadata.html b/source/documentation/3.2/rspec-core/RSpec/Core/Metadata.html new file mode 100644 index 000000000..b28f701dd --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Metadata.html @@ -0,0 +1,314 @@ + + + + + + Module: RSpec::Core::Metadata + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Metadata + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/metadata.rb
        + +
        +
        + +

        Overview

        +
        + +

        Each ExampleGroup class and Example instance owns an instance of Metadata, +which is Hash extended to support lazy evaluation of values associated with +keys that may or may not be used by any example or group.

        + +

        In addition to metadata that is used internally, this also stores +user-supplied metadata, e.g.

        + +
        describe Something, :type => :ui do
        +  it "does something", :slow => true do
        +    # ...
        +  end
        +end
        +
        + +

        :type => :ui is stored in the Metadata owned by the example +group, and :slow => true is stored in the Metadata owned by +the example. These can then be used to select which examples are run using +the --tag option on the command line, or several methods on +Configuration used to filter a run (e.g. +filter_run_including, filter_run_excluding, etc).

        + + +
        +
        + +

        Constant Summary

        + +
        + +
        RELATIVE_PATH_REGEX = +
        +
        + +

        Matches strings either at the beginning of the input or prefixed with a +whitespace, containing the current path, either postfixed with the +separator, or at the end of the string. Match groups are the character +before and the character after the string if any.

        + +

        rubular.com/r/fT0gmX6VJX rubular.com/r/duOrD4i3wb rubular.com/r/sbAMHFrOx1

        + + +
        +
        +
        + + +
        +
        +
        /(\A|\s)#{File.expand_path('.')}(#{File::SEPARATOR}|\s|\Z)/
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (String) relative_path(line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns relative path to line

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + line + + + (String) + + + + — +
          +

          current code line

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          relative path to line

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 42
        +
        +def self.relative_path(line)
        +  line = line.sub(RELATIVE_PATH_REGEX, "\\1.\\2".freeze)
        +  line = line.sub(/\A([^:]+:\d+)$/, '\\1'.freeze)
        +  return nil if line == '-e:1'.freeze
        +  line
        +rescue SecurityError
        +  nil
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/MetadataFilter.html b/source/documentation/3.2/rspec-core/RSpec/Core/MetadataFilter.html new file mode 100644 index 000000000..252a17f92 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/MetadataFilter.html @@ -0,0 +1,120 @@ + + + + + + Module: RSpec::Core::MetadataFilter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MetadataFilter + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/metadata_filter.rb
        + +
        +
        + +

        Overview

        +
        + +

        Contains metadata filtering logic. This has been extracted from the +metadata classes because it operates ON a metadata hash but does not manage +any of the state in the hash. We're moving towards having metadata be a +raw hash (not a custom subclass), so externalizing this filtering logic +helps us move in that direction.

        + + +
        +
        +
        + + +
        + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications.html new file mode 100644 index 000000000..62076686b --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications.html @@ -0,0 +1,127 @@ + + + + + + Module: RSpec::Core::Notifications + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Notifications + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        Notifications are value objects passed to formatters to provide them with +information about a particular event of interest.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: DeprecationNotification, ExampleNotification, ExamplesNotification, FailedExampleNotification, GroupNotification, MessageNotification, NullNotification, PendingExampleFixedNotification, ProfileNotification, SeedNotification, StartNotification, SummaryNotification + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/DeprecationNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/DeprecationNotification.html new file mode 100644 index 000000000..70c4fbe1a --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/DeprecationNotification.html @@ -0,0 +1,498 @@ + + + + + + Class: RSpec::Core::Notifications::DeprecationNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::DeprecationNotification + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The DeprecationNotification is issued by the reporter when a +deprecated part of RSpec is encountered. It represents information about +the deprecated call site.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (String) call_site + + + + + + + + + + + + + + + + +
          +

          An optional call site from which the deprecation was issued.

          +
          + +
        • + + +
        • + + + - (String) deprecated + + + + + + + + + + + + + + + + +
          +

          A custom message about the deprecation (alias of message).

          +
          + +
        • + + +
        • + + + - (String) message + + + + + + + + + + + + + + + + +
          +

          A custom message about the deprecation.

          +
          + +
        • + + +
        • + + + - (String) replacement + + + + + + + + + + + + + + + + +
          +

          An optional replacement for the deprecation.

          +
          + +
        • + + +
        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (String) call_site + + + + + +

        +
        + +

        An optional call site from which the deprecation was issued

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the current value of call_site

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +514
        +515
        +516
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 514
        +
        +def call_site
        +  @call_site
        +end
        +
        +
        + + + +
        +

        + + - (String) deprecated + + + + + +

        +
        + +

        A custom message about the deprecation (alias of message)

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the current value of deprecated

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +514
        +515
        +516
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 514
        +
        +def deprecated
        +  @deprecated
        +end
        +
        +
        + + + +
        +

        + + - (String) message + + + + + +

        +
        + +

        A custom message about the deprecation

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the current value of message

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +514
        +515
        +516
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 514
        +
        +def message
        +  @message
        +end
        +
        +
        + + + +
        +

        + + - (String) replacement + + + + + +

        +
        + +

        An optional replacement for the deprecation

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the current value of replacement

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +514
        +515
        +516
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 514
        +
        +def replacement
        +  @replacement
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ExampleNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ExampleNotification.html new file mode 100644 index 000000000..5ea6f4f4e --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ExampleNotification.html @@ -0,0 +1,248 @@ + + + + + + Class: RSpec::Core::Notifications::ExampleNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::ExampleNotification + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The ExampleNotification represents notifications sent by the +reporter which contain information about the current (or soon to be) +example. It is used by formatters to access information about that example.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        def example_started(notification)
        +  puts "Hey I started #{notification.example.description}"
        +end
        + +
        + + +
        +

        Direct Known Subclasses

        +

        FailedExampleNotification

        +
        + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (RSpec::Core::Example) example + + + + + +

        +
        + +

        the current example

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 35
        +
        +def example
        +  @example
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ExamplesNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ExamplesNotification.html new file mode 100644 index 000000000..4bdaad8c1 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ExamplesNotification.html @@ -0,0 +1,861 @@ + + + + + + Class: RSpec::Core::Notifications::ExamplesNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::ExamplesNotification + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The ExamplesNotification represents notifications sent by the +reporter which contain information about the suites examples.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        def stop(notification)
        +  puts "Hey I ran #{notification.examples.size}"
        +end
        + +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ExamplesNotification) initialize(reporter) + + + + + +

        +
        + +

        Returns a new instance of ExamplesNotification

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 58
        +
        +def initialize(reporter)
        +  @reporter = reporter
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Array(RSpec::Core::Example)) examples + + + + + +

        +
        + +

        Returns list of examples

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 63
        +
        +def examples
        +  @reporter.examples
        +end
        +
        +
        + +
        +

        + + - (Array(RSpec::Core::Example)) failed_examples + + + + + +

        +
        + +

        Returns list of failed examples

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 68
        +
        +def failed_examples
        +  @reporter.failed_examples
        +end
        +
        +
        + +
        +

        + + - (Array(Rspec::Core::Notifications::FailedExampleNotification] +returns failed examples as notifications) failure_notifications + + + + + +

        +
        + +

        Array(Rspec::Core::Notifications::FailedExampleNotification] returns failed +examples as notifications

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array(Rspec::Core::Notifications::FailedExampleNotification] +returns failed examples as notifications) + + + + — +
          +

          Array(Rspec::Core::Notifications::FailedExampleNotification] returns failed +examples as notifications

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +85
        +86
        +87
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 85
        +
        +def failure_notifications
        +  @failed_notifications ||= format_examples(failed_examples)
        +end
        +
        +
        + +
        +

        + + - (String) fully_formatted_failed_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) + + + + + +

        +
        + +

        Returns The list of failed examples, fully formatted in the way that +RSpec's built-in formatters emit.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The list of failed examples, fully formatted in the way that RSpec's +built-in formatters emit.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 91
        +
        +def fully_formatted_failed_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
        +  formatted = "\nFailures:\n"
        +
        +  failure_notifications.each_with_index do |failure, index|
        +    formatted << failure.fully_formatted(index.next, colorizer)
        +  end
        +
        +  formatted
        +end
        +
        +
        + +
        +

        + + - (String) fully_formatted_pending_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) + + + + + +

        +
        + +

        Returns The list of pending examples, fully formatted in the way that +RSpec's built-in formatters emit.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The list of pending examples, fully formatted in the way that RSpec's +built-in formatters emit.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 103
        +
        +def fully_formatted_pending_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
        +  formatted = "\nPending:\n"
        +
        +  pending_examples.each do |example|
        +    formatted_caller = RSpec.configuration.backtrace_formatter.backtrace_line(example.location)
        +
        +    formatted <<
        +      "  #{colorizer.wrap(example.full_description, :pending)}\n" \
        +      "    # #{colorizer.wrap(example.execution_result.pending_message, :detail)}\n" \
        +      "    # #{colorizer.wrap(formatted_caller, :detail)}\n"
        +  end
        +
        +  formatted
        +end
        +
        +
        + +
        +

        + + - (Array(Rspec::Core::Notifications::ExampleNotification] +returns examples as notifications) notifications + + + + + +

        +
        + +

        Array(Rspec::Core::Notifications::ExampleNotification] returns examples as +notifications

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array(Rspec::Core::Notifications::ExampleNotification] +returns examples as notifications) + + + + — +
          +

          Array(Rspec::Core::Notifications::ExampleNotification] returns examples as +notifications

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 79
        +
        +def notifications
        +  @notifications ||= format_examples(examples)
        +end
        +
        +
        + +
        +

        + + - (Array(RSpec::Core::Example)) pending_examples + + + + + +

        +
        + +

        Returns list of pending examples

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 73
        +
        +def pending_examples
        +  @reporter.pending_examples
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/FailedExampleNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/FailedExampleNotification.html new file mode 100644 index 000000000..2376ad516 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/FailedExampleNotification.html @@ -0,0 +1,937 @@ + + + + + + Class: RSpec::Core::Notifications::FailedExampleNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::FailedExampleNotification + + + +

        + +
        + +
        Inherits:
        +
        + ExampleNotification + +
          +
        • Object
        • + + + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The FailedExampleNotification extends +ExampleNotification with things useful for failed specs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        def example_failed(notification)
        +  puts "Hey I failed :("
        +  puts "Here's my stack trace"
        +  puts notification.exception.backtrace.join("\n")
        +end
        + +
        + + +

        See Also:

        + + +
        +

        Direct Known Subclasses

        +

        PendingExampleFixedNotification

        +
        + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (RSpec::Core::Example) example + + + + + +

        +
        + +

        the current example

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 139
        +
        +def example
        +  @example
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Array(String)) colorized_formatted_backtrace(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) + + + + + +

        +
        + +

        Returns the failures colorized formatted backtrace.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + colorizer + + + (#wrap) + + + (defaults to: ::RSpec::Core::Formatters::ConsoleCodes) + + + — +
          +

          An object to colorize the message_lines by

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array(String)) + + + + — +
          +

          the examples colorized backtrace lines

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +180
        +181
        +182
        +183
        +184
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 180
        +
        +def colorized_formatted_backtrace(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
        +  formatted_backtrace.map do |backtrace_info|
        +    colorizer.wrap "# #{backtrace_info}", RSpec.configuration.detail_color
        +  end
        +end
        +
        +
        + +
        +

        + + - (Array(String)) colorized_message_lines(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) + + + + + +

        +
        + +

        Returns the message generated for this failure colorized line by line.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + colorizer + + + (#wrap) + + + (defaults to: ::RSpec::Core::Formatters::ConsoleCodes) + + + — +
          +

          An object to colorize the message_lines by

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array(String)) + + + + — +
          +

          The example failure message colorized

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +163
        +164
        +165
        +166
        +167
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 163
        +
        +def colorized_message_lines(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
        +  add_shared_group_lines(failure_lines, colorizer).map do |line|
        +    colorizer.wrap line, RSpec.configuration.failure_color
        +  end
        +end
        +
        +
        + +
        +

        + + - (String) description + + + + + +

        +
        + +

        Returns The example description

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The example description

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +148
        +149
        +150
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 148
        +
        +def description
        +  example.full_description
        +end
        +
        +
        + +
        +

        + + - (Exception) exception + + + + + +

        +
        + +

        Returns The example failure

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Exception) + + + + — +
          +

          The example failure

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +143
        +144
        +145
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 143
        +
        +def exception
        +  example.execution_result.exception
        +end
        +
        +
        + +
        +

        + + - (Array(String)) formatted_backtrace + + + + + +

        +
        + +

        Returns the failures formatted backtrace.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array(String)) + + + + — +
          +

          the examples backtrace lines

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 172
        +
        +def formatted_backtrace
        +  backtrace_formatter.format_backtrace(exception.backtrace, example.)
        +end
        +
        +
        + +
        +

        + + - (String) fully_formatted(failure_number, colorizer = ::RSpec::Core::Formatters::ConsoleCodes) + + + + + +

        +
        + +

        Returns The failure information fully formatted in the way that RSpec's +built-in formatters emit.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The failure information fully formatted in the way that RSpec's +built-in formatters emit.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +188
        +189
        +190
        +191
        +192
        +193
        +194
        +195
        +196
        +197
        +198
        +199
        +200
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 188
        +
        +def fully_formatted(failure_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
        +  formatted = "\n  #{failure_number}) #{description}\n"
        +
        +  colorized_message_lines(colorizer).each do |line|
        +    formatted << RSpec::Support::EncodedString.new("     #{line}\n", encoding_of(formatted))
        +  end
        +
        +  colorized_formatted_backtrace(colorizer).each do |line|
        +    formatted << RSpec::Support::EncodedString.new("     #{line}\n", encoding_of(formatted))
        +  end
        +
        +  formatted
        +end
        +
        +
        + +
        +

        + + - (Array(String)) message_lines + + + + + +

        +
        + +

        Returns the message generated for this failure line by line.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array(String)) + + + + — +
          +

          The example failure message

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +155
        +156
        +157
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 155
        +
        +def message_lines
        +  add_shared_group_lines(failure_lines, NullColorizer)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/GroupNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/GroupNotification.html new file mode 100644 index 000000000..c2544273a --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/GroupNotification.html @@ -0,0 +1,245 @@ + + + + + + Class: RSpec::Core::Notifications::GroupNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::GroupNotification + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The GroupNotification represents notifications sent by the +reporter which contain information about the currently running (or soon to +be) example group. It is used by formatters to access information about +that group.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        def example_group_started(notification)
        +  puts "Hey I started #{notification.group.description}"
        +end
        + +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (RSpec::Core::ExampleGroup) group + + + + + +

        +
        + +

        the current group

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +311
        +312
        +313
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 311
        +
        +def group
        +  @group
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/MessageNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/MessageNotification.html new file mode 100644 index 000000000..179539f56 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/MessageNotification.html @@ -0,0 +1,233 @@ + + + + + + Class: RSpec::Core::Notifications::MessageNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::MessageNotification + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The MessageNotification encapsulates generic messages that the +reporter sends to formatters.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (String) message + + + + + +

        +
        + +

        the message

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the current value of message

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +317
        +318
        +319
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 317
        +
        +def message
        +  @message
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/NullNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/NullNotification.html new file mode 100644 index 000000000..e0371ece1 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/NullNotification.html @@ -0,0 +1,133 @@ + + + + + + Class: RSpec::Core::Notifications::NullNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::NullNotification + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        NullNotification represents a placeholder value for +notifications that currently require no information, but we may wish to +extend in future.

        + + +
        +
        +
        + + +
        + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/PendingExampleFixedNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/PendingExampleFixedNotification.html new file mode 100644 index 000000000..bb5081a20 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/PendingExampleFixedNotification.html @@ -0,0 +1,550 @@ + + + + + + Class: RSpec::Core::Notifications::PendingExampleFixedNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::PendingExampleFixedNotification + + + +

        + +
        + +
        Inherits:
        +
        + FailedExampleNotification + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The PendingExampleFixedNotification extends +ExampleNotification with things useful for specs that pass +when they are expected to fail.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from FailedExampleNotification

        +

        #colorized_formatted_backtrace, #exception, #formatted_backtrace, #fully_formatted

        + + + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (RSpec::Core::Example) example + + + + + +

        +
        + +

        the current example

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +275
        +276
        +277
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 275
        +
        +def example
        +  @example
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Array(String)) colorized_message_lines(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) + + + + + +

        +
        + +

        Returns the message generated for this failure colorized line by line.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + colorizer + + + (#wrap) + + + (defaults to: ::RSpec::Core::Formatters::ConsoleCodes) + + + — +
          +

          An object to colorize the message_lines by

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array(String)) + + + + — +
          +

          The example failure message colorized

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +296
        +297
        +298
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 296
        +
        +def colorized_message_lines(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
        +  message_lines.map { |line| colorizer.wrap(line, RSpec.configuration.fixed_color) }
        +end
        +
        +
        + +
        +

        + + - (String) description + + + + + +

        +
        + +

        Returns the examples description.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The example description

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +281
        +282
        +283
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 281
        +
        +def description
        +  "#{example.full_description} FIXED"
        +end
        +
        +
        + +
        +

        + + - (Array(String)) message_lines + + + + + +

        +
        + +

        Returns the message generated for this failure line by line.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array(String)) + + + + — +
          +

          The example failure message

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +288
        +289
        +290
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 288
        +
        +def message_lines
        +  ["Expected pending '#{example.execution_result.pending_message}' to fail. No Error was raised."]
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ProfileNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ProfileNotification.html new file mode 100644 index 000000000..a4b1d33fa --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/ProfileNotification.html @@ -0,0 +1,410 @@ + + + + + + Class: RSpec::Core::Notifications::ProfileNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::ProfileNotification + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The ProfileNotification holds information about the results of +running a test suite when profiling is enabled. It is used by formatters to +provide information at the end of the test run for profiling information.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Float) duration + + + + + +

        +
        + +

        the time taken (in seconds) to run the suite

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Float) + + + + — +
          +

          the current value of duration

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +446
        +447
        +448
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 446
        +
        +def duration
        +  @duration
        +end
        +
        +
        + + + +
        +

        + + - (Array(RSpec::Core::Example)) examples + + + + + +

        +
        + +

        the examples run

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +446
        +447
        +448
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 446
        +
        +def examples
        +  @examples
        +end
        +
        +
        + + + +
        +

        + + - (Fixnum) number_of_examples + + + + + +

        +
        + +

        the number of examples to profile

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Fixnum) + + + + — +
          +

          the current value of number_of_examples

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +446
        +447
        +448
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 446
        +
        +def number_of_examples
        +  @number_of_examples
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/SeedNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/SeedNotification.html new file mode 100644 index 000000000..c64e4b4b6 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/SeedNotification.html @@ -0,0 +1,321 @@ + + + + + + Class: RSpec::Core::Notifications::SeedNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::SeedNotification + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The SeedNotification holds the seed used to randomize examples +and whether that seed has been used or not.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Fixnum) seed + + + + + + + + + + + + + + + + +
          +

          the seed used to randomize ordering.

          +
          + +
        • + + +
        • + + + - (Boolean) used + + + + + + + + + + + + + + + + +
          +

          whether the seed has been used or not.

          +
          + +
        • + + +
        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Fixnum) seed + + + + + +

        +
        + +

        the seed used to randomize ordering

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Fixnum) + + + + — +
          +

          the current value of seed

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +324
        +325
        +326
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 324
        +
        +def seed
        +  @seed
        +end
        +
        +
        + + + +
        +

        + + - (Boolean) used + + + + + +

        +
        + +

        whether the seed has been used or not

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          the current value of used

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +324
        +325
        +326
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 324
        +
        +def used
        +  @used
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/StartNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/StartNotification.html new file mode 100644 index 000000000..5bf12aaee --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/StartNotification.html @@ -0,0 +1,322 @@ + + + + + + Class: RSpec::Core::Notifications::StartNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::StartNotification + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The StartNotification represents a notification sent by the +reporter when the suite is started. It contains the expected amount of +examples to be executed, and the load time of RSpec.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Fixnum) count + + + + + + + + + + + + + + + + +
          +

          the number counted.

          +
          + +
        • + + +
        • + + + - (Float) load_time + + + + + + + + + + + + + + + + +
          +

          the number of seconds taken to boot RSpec and load the spec files.

          +
          + +
        • + + +
        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Fixnum) count + + + + + +

        +
        + +

        the number counted

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Fixnum) + + + + — +
          +

          the current value of count

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 23
        +
        +def count
        +  @count
        +end
        +
        +
        + + + +
        +

        + + - (Float) load_time + + + + + +

        +
        + +

        the number of seconds taken to boot RSpec and load the spec files

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Float) + + + + — +
          +

          the current value of load_time

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 23
        +
        +def load_time
        +  @load_time
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/SummaryNotification.html b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/SummaryNotification.html new file mode 100644 index 000000000..4a24390fc --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Notifications/SummaryNotification.html @@ -0,0 +1,586 @@ + + + + + + Class: RSpec::Core::Notifications::SummaryNotification + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Notifications::SummaryNotification + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/notifications.rb
        + +
        +
        + +

        Overview

        +
        + +

        The SummaryNotification holds information about the results of +running a test suite. It is used by formatters to provide information at +the end of the test run.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Float) duration + + + + + +

        +
        + +

        the time taken (in seconds) to run the suite

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Float) + + + + — +
          +

          the current value of duration

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +349
        +350
        +351
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 349
        +
        +def duration
        +  @duration
        +end
        +
        +
        + + + +
        +

        + + - (Array(RSpec::Core::Example)) examples + + + + + +

        +
        + +

        the examples run

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +349
        +350
        +351
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 349
        +
        +def examples
        +  @examples
        +end
        +
        +
        + + + +
        +

        + + - (Array(RSpec::Core::Example)) failed_examples + + + + + +

        +
        + +

        the failed examples

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array(RSpec::Core::Example)) + + + + — +
          +

          the current value of failed_examples

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +349
        +350
        +351
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 349
        +
        +def failed_examples
        +  @failed_examples
        +end
        +
        +
        + + + +
        +

        + + - (Float) load_time + + + + + +

        +
        + +

        the number of seconds taken to boot RSpec and load the spec files

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Float) + + + + — +
          +

          the current value of load_time

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +349
        +350
        +351
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 349
        +
        +def load_time
        +  @load_time
        +end
        +
        +
        + + + +
        +

        + + - (Array(RSpec::Core::Example)) pending_examples + + + + + +

        +
        + +

        the pending examples

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array(RSpec::Core::Example)) + + + + — +
          +

          the current value of pending_examples

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +349
        +350
        +351
        +
        +
        # File 'lib/rspec/core/notifications.rb', line 349
        +
        +def pending_examples
        +  @pending_examples
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Pending.html b/source/documentation/3.2/rspec-core/RSpec/Core/Pending.html new file mode 100644 index 000000000..f88f35160 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Pending.html @@ -0,0 +1,469 @@ + + + + + + Module: RSpec::Core::Pending + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Pending + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/pending.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides methods to mark examples as pending. These methods are available +to be called from within any example or hook.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: SkipDeclaredInExample + + +

        + +

        Constant Summary

        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + + - (void) pending + + - (void) pending(message) + + + + + + +

        +
        + +
        + Note: +
        +

        before(:example) hooks are eval'd when you use the +pending method within an example. If you want to declare an +example pending and bypass the before hooks as +well, you can pass :pending => true to the it +method:

        + +
        it "does something", :pending => true do
        +  # ...
        +end
        +
        + +

        or pass :pending => "something else getting +finished" to add a message to the summary report:

        + +
        it "does something", :pending => "something else getting finished" do
        +  # ...
        +end
        +
        +
        +
        + + +

        Marks an example as pending. The rest of the example will still be +executed, and if it passes the example will fail to indicate that the +pending can be removed.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        describe "an example" do
        +  # reported as "Pending: no reason given"
        +  it "is pending with no message" do
        +    pending
        +    raise "broken"
        +  end
        +
        +  # reported as "Pending: something else getting finished"
        +  it "is pending with a custom message" do
        +    pending("something else getting finished")
        +    raise "broken"
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + (defaults to: nil) + + + — +
          +

          optional message to add to the summary report.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +
        +
        # File 'lib/rspec/core/pending.rb', line 70
        +
        +def pending(message=nil)
        +  current_example = RSpec.current_example
        +
        +  if block_given?
        +    raise ArgumentError, <<-EOS.gsub(/^\s+\|/, '')
        +      |The semantics of `RSpec::Core::Pending#pending` have changed in
        +      |RSpec 3. In RSpec 2.x, it caused the example to be skipped. In
        +      |RSpec 3, the rest of the example is still run but is expected to
        +      |fail, and will be marked as a failure (rather than as pending) if
        +      |the example passes.
        +      |
        +      |Passing a block within an example is now deprecated. Marking the
        +      |example as pending provides the same behavior in RSpec 3 which was
        +      |provided only by the block in RSpec 2.x.
        +      |
        +      |Move the code in the block provided to `pending` into the rest of
        +      |the example body.
        +      |
        +      |Called from #{CallerFilter.first_non_rspec_line}.
        +      |
        +    EOS
        +  elsif current_example
        +    Pending.mark_pending! current_example, message
        +  else
        +    raise "`pending` may not be used outside of examples, such as in " \
        +          "before(:context). Maybe you want `skip`?"
        +  end
        +end
        +
        +
        + +
        +

        + + + - (void) skip + + - (void) skip(message) + + + + + + +

        +
        + +

        Marks an example as pending and skips execution.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        describe "an example" do
        +  # reported as "Pending: no reason given"
        +  it "is skipped with no message" do
        +    skip
        +  end
        +
        +  # reported as "Pending: something else getting finished"
        +  it "is skipped with a custom message" do
        +    skip "something else getting finished"
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + (defaults to: nil) + + + — +
          +

          optional message to add to the summary report.

          +
          + +
        • + +
        + +

        Raises:

        + + +
        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +
        +
        # File 'lib/rspec/core/pending.rb', line 118
        +
        +def skip(message=nil)
        +  current_example = RSpec.current_example
        +
        +  Pending.mark_skipped!(current_example, message) if current_example
        +
        +  raise SkipDeclaredInExample.new(message)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Pending/SkipDeclaredInExample.html b/source/documentation/3.2/rspec-core/RSpec/Core/Pending/SkipDeclaredInExample.html new file mode 100644 index 000000000..7303e654b --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Pending/SkipDeclaredInExample.html @@ -0,0 +1,299 @@ + + + + + + Exception: RSpec::Core::Pending::SkipDeclaredInExample + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Exception: RSpec::Core::Pending::SkipDeclaredInExample + + + +

        + +
        + +
        Inherits:
        +
        + StandardError + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/pending.rb
        + +
        +
        + +

        Overview

        +
        + +

        Raised in the middle of an example to indicate that it should be marked as +skipped.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (void) argument + + + + + + + + + readonly + + + + + + + + + +
          +

          Returns the value of attribute argument.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (SkipDeclaredInExample) initialize(argument) + + + + + +

        +
        + +

        Returns a new instance of SkipDeclaredInExample

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/core/pending.rb', line 11
        +
        +def initialize(argument)
        +  @argument = argument
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (void) argument (readonly) + + + + + +

        +
        + +

        Returns the value of attribute argument

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/core/pending.rb', line 9
        +
        +def argument
        +  @argument
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/RakeTask.html b/source/documentation/3.2/rspec-core/RSpec/Core/RakeTask.html new file mode 100644 index 000000000..5b0a50129 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/RakeTask.html @@ -0,0 +1,928 @@ + + + + + + Class: RSpec::Core::RakeTask + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::RakeTask + + + +

        + +
        + +
        Inherits:
        +
        + Rake::TaskLib + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Rake::DSL
        + + + + + +
        Defined in:
        +
        lib/rspec/core/rake_task.rb
        + +
        +
        + +

        Overview

        +
        + +

        RSpec rake task

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Rakefile
        • + +
        + +
        +

        Constant Summary

        + +
        + +
        DEFAULT_RSPEC_PATH = +
        +
        + +

        Default path to the RSpec executable.

        + + +
        +
        +
        + + +
        +
        +
        File.expand_path('../../../../exe/rspec', __FILE__)
        + +
        DEFAULT_PATTERN = +
        +
        + +

        Default pattern for spec files.

        + + +
        +
        +
        + + +
        +
        +
        'spec/**{,/*/**}/*_spec.rb'
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (void) exclude_pattern + + + + + + + + + + + + + + + + +
          +

          Files matching this pattern will be excluded.

          +
          + +
        • + + +
        • + + + - (void) fail_on_error + + + + + + + + + + + + + + + + +
          +

          Whether or not to fail Rake when an error occurs (typically when examples +fail).

          +
          + +
        • + + +
        • + + + - (void) failure_message + + + + + + + + + + + + + + + + +
          +

          A message to print to stderr when there are failures.

          +
          + +
        • + + +
        • + + + - (void) name + + + + + + + + + + + + + + + + +
          +

          Name of task.

          +
          + +
        • + + +
        • + + + - (void) pattern + + + + + + + + + + + + + + + + +
          +

          Files matching this pattern will be loaded.

          +
          + +
        • + + +
        • + + + - (void) rspec_opts + + + + + + + + + + + + + + + + +
          +

          Command line options to pass to RSpec.

          +
          + +
        • + + +
        • + + + - (void) rspec_path + + + + + + + + + + + + + + + + +
          +

          Path to RSpec.

          +
          + +
        • + + +
        • + + + - (void) ruby_opts + + + + + + + + + + + + + + + + +
          +

          Command line options to pass to ruby.

          +
          + +
        • + + +
        • + + + - (void) verbose + + + + + + + + + + + + + + + + +
          +

          Use verbose output.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (RakeTask) initialize(*args, &task_block) + + + + + +

        +
        + +

        Returns a new instance of RakeTask

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 51
        +
        +def initialize(*args, &task_block)
        +  @name          = args.shift || :spec
        +  @ruby_opts     = nil
        +  @rspec_opts    = nil
        +  @verbose       = true
        +  @fail_on_error = true
        +  @rspec_path    = DEFAULT_RSPEC_PATH
        +  @pattern       = DEFAULT_PATTERN
        +
        +  define(args, &task_block)
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (void) exclude_pattern + + + + + +

        +
        + +

        Files matching this pattern will be excluded. Defaults to nil.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 28
        +
        +def exclude_pattern
        +  @exclude_pattern
        +end
        +
        +
        + + + +
        +

        + + - (void) fail_on_error + + + + + +

        +
        + +

        Whether or not to fail Rake when an error occurs (typically when examples +fail). Defaults to true.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 32
        +
        +def fail_on_error
        +  @fail_on_error
        +end
        +
        +
        + + + +
        +

        + + - (void) failure_message + + + + + +

        +
        + +

        A message to print to stderr when there are failures.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 35
        +
        +def failure_message
        +  @failure_message
        +end
        +
        +
        + + + +
        +

        + + - (void) name + + + + + +

        +
        + +

        Name of task. Defaults to :spec.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 20
        +
        +def name
        +  @name
        +end
        +
        +
        + + + +
        +

        + + - (void) pattern + + + + + +

        +
        + +

        Files matching this pattern will be loaded. Defaults to +'spec/**{,//*}/*_spec.rb'.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 24
        +
        +def pattern
        +  @pattern
        +end
        +
        +
        + + + +
        +

        + + - (void) rspec_opts + + + + + +

        +
        + +

        Command line options to pass to RSpec. Defaults to nil.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 49
        +
        +def rspec_opts
        +  @rspec_opts
        +end
        +
        +
        + + + +
        +

        + + - (void) rspec_path + + + + + +

        +
        + +

        Path to RSpec. Defaults to the absolute path to the rspec binary from the +loaded rspec-core gem.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 46
        +
        +def rspec_path
        +  @rspec_path
        +end
        +
        +
        + + + +
        +

        + + - (void) ruby_opts + + + + + +

        +
        + +

        Command line options to pass to ruby. Defaults to nil.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 42
        +
        +def ruby_opts
        +  @ruby_opts
        +end
        +
        +
        + + + +
        +

        + + - (void) verbose + + + + + +

        +
        + +

        Use verbose output. If this is set to true, the task will print the +executed spec command to stdout. Defaults to true.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 39
        +
        +def verbose
        +  @verbose
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Reporter.html b/source/documentation/3.2/rspec-core/RSpec/Core/Reporter.html new file mode 100644 index 000000000..63b7011a1 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Reporter.html @@ -0,0 +1,468 @@ + + + + + + Class: RSpec::Core::Reporter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Reporter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/reporter.rb
        + +
        +
        + +

        Overview

        +
        + +

        A reporter will send notifications to listeners, usually formatters for the +spec suite run.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Reporter) initialize(configuration) + + + + + +

        +
        + +

        Returns a new instance of Reporter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 5
        +
        +def initialize(configuration)
        +  @configuration = configuration
        +  @listeners = Hash.new { |h, k| h[k] = Set.new }
        +  @examples = []
        +  @failed_examples = []
        +  @pending_examples = []
        +  @duration = @start = @load_time = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) register_listener(listener, *notifications) + + + + + +

        +
        + +

        Registers a listener to a list of notifications. The reporter will send +notification of events to all registered listeners.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + listener + + + (Object) + + + + — +
          +

          An obect that wishes to be notified of reporter events

          +
          + +
        • + +
        • + + notifications + + + (Array) + + + + — +
          +

          Array of symbols represents the events a listener wishes to subscribe too

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 31
        +
        +def register_listener(listener, *notifications)
        +  notifications.each do |notification|
        +    @listeners[notification.to_sym] << listener
        +  end
        +  true
        +end
        +
        +
        + +
        +

        + + + - (void) report(count, &block) + + - (void) report(count, &block) + + + + + + +

        +
        + +

        Initializes the report run and yields itself for further reporting. The +block is required, so that the reporter can manage cleaning up after the +run.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +reporter.report(group.examples.size) do |r|
        +  example_groups.map {|g| g.run(r) }
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + expected_example_count + + + (Integer) + + + + — +
          +

          the number of examples being run

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Block) + + + + — +
          +

          block yields itself for further reporting.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 59
        +
        +def report(expected_example_count)
        +  start(expected_example_count)
        +  begin
        +    yield self
        +  ensure
        +    finish
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Runner.html b/source/documentation/3.2/rspec-core/RSpec/Core/Runner.html new file mode 100644 index 000000000..4ccf79dbb --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Runner.html @@ -0,0 +1,929 @@ + + + + + + Class: RSpec::Core::Runner + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Runner + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/runner.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides the main entry point to run a suite of RSpec examples.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Runner) initialize(options, configuration = RSpec.configuration, world = RSpec.world) + + + + + +

        +
        + +

        Returns a new instance of Runner

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +74
        +75
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/core/runner.rb', line 74
        +
        +def initialize(options, configuration=RSpec.configuration, world=RSpec.world)
        +  @options       = options
        +  @configuration = configuration
        +  @world         = world
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (void) autorun + + + + + +

        +
        + +
        + Note: +
        +

        This is not generally needed. The rspec command takes care of +running examples for you without involving an at_exit hook. +This is only needed if you are running specs using the ruby +command, and even then, the normal way to invoke this is by requiring +rspec/autorun.

        +
        +
        + + +

        Register an at_exit hook that runs the suite when the process +exits.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/core/runner.rb', line 12
        +
        +def self.autorun
        +  if autorun_disabled?
        +    RSpec.deprecate("Requiring `rspec/autorun` when running RSpec via the `rspec` command")
        +    return
        +  elsif installed_at_exit? || running_in_drb?
        +    return
        +  end
        +
        +  at_exit do
        +    # Don't bother running any specs and just let the program terminate
        +    # if we got here due to an unrescued exception (anything other than
        +    # SystemExit, which is raised when somebody calls Kernel#exit).
        +    next unless $!.nil? || $!.is_a?(SystemExit)
        +
        +    # We got here because either the end of the program was reached or
        +    # somebody called Kernel#exit. Run the specs and then override any
        +    # existing exit status with RSpec's exit status if any specs failed.
        +    invoke
        +  end
        +  @installed_at_exit = true
        +end
        +
        +
        + +
        +

        + + + (void) invoke + + + + + +

        +
        + +

        Runs the suite of specs and exits the process with an appropriate exit +code.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/core/runner.rb', line 36
        +
        +def self.invoke
        +  disable_autorun!
        +  status = run(ARGV, $stderr, $stdout).to_i
        +  exit(status) if status != 0
        +end
        +
        +
        + +
        +

        + + + (Fixnum) run(args, err = $stderr, out = $stdout) + + + + + +

        +
        + +

        Run a suite of RSpec examples. Does not exit.

        + +

        This is used internally by RSpec to run a suite, but is available for use +by any other automation tool.

        + +

        If you want to run this multiple times in the same process, and you want +files like spec_helper.rb to be reloaded, be sure to load +load instead of require.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + args + + + (Array) + + + + — +
          +

          command-line-supported arguments

          +
          + +
        • + +
        • + + err + + + (IO) + + + (defaults to: $stderr) + + + — +
          +

          error stream

          +
          + +
        • + +
        • + + out + + + (IO) + + + (defaults to: $stdout) + + + — +
          +

          output stream

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Fixnum) + + + + — +
          +

          exit status code. 0 if all specs passed, or the configured failure exit +code (1 by default) if specs failed.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +
        +
        # File 'lib/rspec/core/runner.rb', line 57
        +
        +def self.run(args, err=$stderr, out=$stdout)
        +  trap_interrupt
        +  options = ConfigurationOptions.new(args)
        +
        +  if options.options[:drb]
        +    require 'rspec/core/drb'
        +    begin
        +      DRbRunner.new(options).run(err, out)
        +    rescue DRb::DRbConnError
        +      err.puts "No DRb server is running. Running in local process instead ..."
        +      new(options).run(err, out)
        +    end
        +  else
        +    new(options).run(err, out)
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) run(err, out) + + + + + +

        +
        + +

        Configures and runs a spec suite.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + err + + + (IO) + + + + — +
          +

          error stream

          +
          + +
        • + +
        • + + out + + + (IO) + + + + — +
          +

          output stream

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +87
        +
        +
        # File 'lib/rspec/core/runner.rb', line 84
        +
        +def run(err, out)
        +  setup(err, out)
        +  run_specs(@world.ordered_example_groups)
        +end
        +
        +
        + +
        +

        + + - (Fixnum) run_specs(example_groups) + + + + + +

        +
        + +

        Runs the provided example groups.

        + + +
        +
        +
        +

        Parameters:

        + + +

        Returns:

        +
          + +
        • + + + (Fixnum) + + + + — +
          +

          exit status code. 0 if all specs passed, or the configured failure exit +code (1 by default) if specs failed.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +
        +
        # File 'lib/rspec/core/runner.rb', line 107
        +
        +def run_specs(example_groups)
        +  @configuration.reporter.report(@world.example_count(example_groups)) do |reporter|
        +    begin
        +      hook_context = SuiteHookContext.new
        +      @configuration.hooks.run(:before, :suite, hook_context)
        +      example_groups.map { |g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code
        +    ensure
        +      @configuration.hooks.run(:after, :suite, hook_context)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (void) setup(err, out) + + + + + +

        +
        + +

        Wires together the various configuration objects and state holders.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + err + + + (IO) + + + + — +
          +

          error stream

          +
          + +
        • + +
        • + + out + + + (IO) + + + + — +
          +

          output stream

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/core/runner.rb', line 93
        +
        +def setup(err, out)
        +  @configuration.error_stream = err
        +  @configuration.output_stream = out if @configuration.output_stream == $stdout
        +  @options.configure(@configuration)
        +  @configuration.load_spec_files
        +  @world.announce_filters
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/SharedContext.html b/source/documentation/3.2/rspec-core/RSpec/Core/SharedContext.html new file mode 100644 index 000000000..402fc198d --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/SharedContext.html @@ -0,0 +1,136 @@ + + + + + + Module: RSpec::Core::SharedContext + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedContext + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_context.rb
        + +
        +
        + +

        Overview

        +
        + +

        Exposes ExampleGroup-level methods to a module, so you can include that +module in an ExampleGroup.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module LoggedInAsAdmin
        +  extend RSpec::Core::SharedContext
        +  before(:example) do
        +     :admin
        +  end
        +end
        +
        +describe "admin section" do
        +  include LoggedInAsAdmin
        +  # ...
        +end
        + +
        + + +
        + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroup.html b/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroup.html new file mode 100644 index 000000000..7b8dc4ca2 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroup.html @@ -0,0 +1,457 @@ + + + + + + Module: RSpec::Core::SharedExampleGroup + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedExampleGroup + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group.rb
        + +
        +
        + +

        Overview

        +
        + +

        Shared example groups let you define common context and/or common examples +that you wish to use in multiple example groups.

        + +

        When defined, the shared group block is stored for later evaluation. It can +later be included in an example group either explicitly (using +include_examples, include_context or +it_behaves_like) or implicitly (via matching metadata).

        + +

        Named shared example groups are scoped based on where they are defined. +Shared groups defined in an example group are available for inclusion in +that example group or any child example groups, but not in any parent or +sibling example groups. Shared example groups defined at the top level can +be included from any example group.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: TopLevelDSL + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + + - (void) shared_examples(name, &block) + + - (void) shared_examples(name, metadata, &block) + + - (void) shared_examples(metadata, &block) + + + + + Also known as: + shared_context, shared_examples_for + + + + +

        +
        + +

        Stores the block for later use. The block will be evaluated in the context +of an example group via include_examples, +include_context, or it_behaves_like.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        shared_examples "auditable" do
        +  it "stores an audit record on save!" do
        +    expect { auditable.save! }.to change(Audit, :count).by(1)
        +  end
        +end
        +
        +describe Account do
        +  it_behaves_like "auditable" do
        +    let(:auditable) { Account.new }
        +  end
        +end
        + +
        + +

        Overloads:

        +
          + + +
        • + - (void) shared_examples(name, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + name + + + (String, Symbol, Module) + + + + — +
            +

            identifer to use when looking up this shared group

            +
            + +
          • + +
          • + + block + + + + + + + — +
            +

            The block to be eval'd

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (void) shared_examples(name, metadata, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + name + + + (String, Symbol, Module) + + + + — +
            +

            identifer to use when looking up this shared group

            +
            + +
          • + +
          • + + metadata + + + (Array<Symbol>, Hash) + + + + — +
            +

            metadata to attach to this group; any example group with matching metadata +will automatically include this shared example group.

            +
            + +
          • + +
          • + + block + + + + + + + — +
            +

            The block to be eval'd

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (void) shared_examples(metadata, &block) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + metadata + + + (Array<Symbol>, Hash) + + + + — +
            +

            metadata to attach to this group; any example group with matching metadata +will automatically include this shared example group.

            +
            + +
          • + +
          • + + block + + + + + + + — +
            +

            The block to be eval'd

            +
            + +
          • + +
          + + +
          +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 80
        +
        +def shared_examples(name, *args, &block)
        +  top_level = self == ExampleGroup
        +  if top_level && RSpec.[:in_example_group]
        +    raise "Creating isolated shared examples from within a context is " \
        +          "not allowed. Remove `RSpec.` prefix or move this to a " \
        +          "top-level scope."
        +  end
        +
        +  RSpec.world.shared_example_group_registry.add(self, name, *args, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html b/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html new file mode 100644 index 000000000..2c2fba57c --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html @@ -0,0 +1,295 @@ + + + + + + Module: RSpec::Core::SharedExampleGroup::TopLevelDSL + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedExampleGroup::TopLevelDSL + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        + +

        Shared examples top level DSL.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (void) expose_globally! + + + + + + + + + + + private + + +
          +

          Adds the top level DSL methods to Module and the top level binding.

          +
          + +
        • + + +
        • + + + + (void) remove_globally! + + + + + + + + + + + private + + +
          +

          Removes the top level DSL methods to Module and the top level binding.

          +
          + +
        • + + +
        + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (void) expose_globally! + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Adds the top level DSL methods to Module and the top level binding.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +116
        +117
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 116
        +
        +def self.expose_globally!
        +  return if exposed_globally?
        +  Core::DSL.change_global_dsl(&definitions)
        +  @exposed_globally = true
        +end
        +
        +
        + +
        +

        + + + (void) remove_globally! + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Removes the top level DSL methods to Module and the top level binding.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 125
        +
        +def self.remove_globally!
        +  return unless exposed_globally?
        +
        +  Core::DSL.change_global_dsl do
        +    undef shared_examples
        +    undef shared_context
        +    undef shared_examples_for
        +  end
        +
        +  @exposed_globally = false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroupInclusionStackFrame.html b/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroupInclusionStackFrame.html new file mode 100644 index 000000000..7ef309e77 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroupInclusionStackFrame.html @@ -0,0 +1,590 @@ + + + + + + Class: RSpec::Core::SharedExampleGroupInclusionStackFrame + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::SharedExampleGroupInclusionStackFrame + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example_group.rb
        + +
        +
        + +

        Overview

        +
        + +

        Contains information about the inclusion site of a shared example group.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (SharedExampleGroupInclusionStackFrame) initialize(shared_group_name, inclusion_location) + + + + + +

        +
        + +

        Returns a new instance of SharedExampleGroupInclusionStackFrame

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +597
        +598
        +599
        +600
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 597
        +
        +def initialize(shared_group_name, inclusion_location)
        +  @shared_group_name  = shared_group_name
        +  @inclusion_location = inclusion_location
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (String) inclusion_location (readonly) + + + + + +

        +
        + +

        Returns the location where the shared example was included

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the location where the shared example was included

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +595
        +596
        +597
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 595
        +
        +def inclusion_location
        +  @inclusion_location
        +end
        +
        +
        + + + +
        +

        + + - (String) shared_group_name (readonly) + + + + + +

        +
        + +

        Returns the name of the shared example group

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          the name of the shared example group

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +593
        +594
        +595
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 593
        +
        +def shared_group_name
        +  @shared_group_name
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        + +

        Returns Description of this stack frame, in the form used by RSpec's +built-in formatters.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          Description of this stack frame, in the form used by RSpec's built-in +formatters.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +613
        +614
        +615
        +616
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 613
        +
        +def description
        +  @description ||= "Shared Example Group: #{shared_group_name.inspect} " \
        +    "called from #{formatted_inclusion_location}"
        +end
        +
        +
        + +
        +

        + + - (String) formatted_inclusion_location + + + + + +

        +
        + +

        Returns The #inclusion_location, formatted for display by a formatter.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The #inclusion_location, formatted for display by a formatter.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +603
        +604
        +605
        +606
        +607
        +608
        +609
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 603
        +
        +def formatted_inclusion_location
        +  @formatted_inclusion_location ||= begin
        +    RSpec.configuration.backtrace_formatter.backtrace_line(
        +      inclusion_location.sub(/(:\d+):in .+$/, '\1')
        +    )
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroupModule.html b/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroupModule.html new file mode 100644 index 000000000..5e3f50809 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/SharedExampleGroupModule.html @@ -0,0 +1,369 @@ + + + + + + Class: RSpec::Core::SharedExampleGroupModule + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::SharedExampleGroupModule + + + +

        + +
        + +
        Inherits:
        +
        + Module + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group.rb
        + +
        +
        + +

        Overview

        +
        + +

        Represents some functionality that is shared with multiple example groups. +The functionality is defined by the provided block, which is lazily +eval'd when the SharedExampleGroupModule instance is +included in an example group.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (SharedExampleGroupModule) initialize(description, definition) + + + + + +

        +
        + +

        Returns a new instance of SharedExampleGroupModule

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 8
        +
        +def initialize(description, definition)
        +  @description = description
        +  @definition  = definition
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) included(klass) + + + + + +

        +
        + +

        Ruby callback for when a module is included in another module is class. Our +definition evaluates the shared group block in the context of the including +example group.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 22
        +
        +def included(klass)
        +  SharedExampleGroupInclusionStackFrame.with_frame(@description, RSpec::CallerFilter.first_non_rspec_line) do
        +    klass.class_exec(&@definition)
        +  end
        +end
        +
        +
        + +
        +

        + + - (void) inspect + + + + Also known as: + to_s + + + + +

        +
        + +

        Provides a human-readable representation of this module.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 14
        +
        +def inspect
        +  "#<#{self.class.name} #{@description.inspect}>"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/Version.html b/source/documentation/3.2/rspec-core/RSpec/Core/Version.html new file mode 100644 index 000000000..894e76db4 --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/Version.html @@ -0,0 +1,139 @@ + + + + + + Module: RSpec::Core::Version + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Version + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/version.rb
        + +
        +
        + +

        Overview

        +
        + +

        Version information for RSpec Core.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + +
        + +
        STRING = +
        +
        + +

        Current version of RSpec Core, in semantic versioning format.

        + + +
        +
        +
        + + +
        +
        +
        '3.2.0.pre'
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/RSpec/Core/World.html b/source/documentation/3.2/rspec-core/RSpec/Core/World.html new file mode 100644 index 000000000..8ee2a2e5a --- /dev/null +++ b/source/documentation/3.2/rspec-core/RSpec/Core/World.html @@ -0,0 +1,980 @@ + + + + + + Class: RSpec::Core::World + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::World + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Hooks
        + + + + + +
        Defined in:
        +
        lib/rspec/core/world.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Internal container for global non-configuration data.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (void) wants_to_quit + + + + + + + + + + + + + + private + + +
          +

          Used internally to determine what to do when a SIGINT is received.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Hooks

        +

        #after, #append_after, #around, #before, #prepend_before

        +
        +

        Constructor Details

        + +
        +

        + + - (World) initialize(configuration = RSpec.configuration) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of World

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/world.rb', line 15
        +
        +def initialize(configuration=RSpec.configuration)
        +  @configuration = configuration
        +  @example_groups = []
        +  @filtered_examples = Hash.new do |hash, group|
        +    hash[group] = begin
        +      examples = group.examples.dup
        +      examples = filter_manager.prune(examples)
        +      examples.uniq!
        +      examples
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (void) wants_to_quit + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Used internally to determine what to do when a SIGINT is received.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/world.rb', line 13
        +
        +def wants_to_quit
        +  @wants_to_quit
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (void) announce_exclusion_filter(announcements) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Add exclusion filters to announcement message.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +161
        +162
        +163
        +164
        +165
        +
        +
        # File 'lib/rspec/core/world.rb', line 161
        +
        +def announce_exclusion_filter(announcements)
        +  return if exclusion_filter.empty?
        +
        +  announcements << "exclude #{exclusion_filter.description}"
        +end
        +
        +
        + +
        +

        + + - (void) announce_filters + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Notify reporter of filters.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +140
        +141
        +142
        +
        +
        # File 'lib/rspec/core/world.rb', line 108
        +
        +def announce_filters
        +  filter_announcements = []
        +
        +  announce_inclusion_filter filter_announcements
        +  announce_exclusion_filter filter_announcements
        +
        +  unless filter_manager.empty?
        +    if filter_announcements.length == 1
        +      reporter.message("Run options: #{filter_announcements[0]}")
        +    else
        +      reporter.message("Run options:\n  #{filter_announcements.join("\n  ")}")
        +    end
        +  end
        +
        +  if @configuration.run_all_when_everything_filtered? && example_count.zero?
        +    reporter.message("#{everything_filtered_message}; ignoring #{inclusion_filter.description}")
        +    filtered_examples.clear
        +    inclusion_filter.clear
        +  end
        +
        +  return unless example_count.zero?
        +
        +  example_groups.clear
        +  if filter_manager.empty?
        +    reporter.message("No examples found.")
        +  elsif exclusion_filter.empty?
        +    message = everything_filtered_message
        +    if @configuration.run_all_when_everything_filtered?
        +      message << "; ignoring #{inclusion_filter.description}"
        +    end
        +    reporter.message(message)
        +  elsif inclusion_filter.empty?
        +    reporter.message(everything_filtered_message)
        +  end
        +end
        +
        +
        + +
        +

        + + - (void) announce_inclusion_filter(announcements) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Add inclusion filters to announcement message.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +152
        +153
        +154
        +155
        +156
        +
        +
        # File 'lib/rspec/core/world.rb', line 152
        +
        +def announce_inclusion_filter(announcements)
        +  return if inclusion_filter.empty?
        +
        +  announcements << "include #{inclusion_filter.description}"
        +end
        +
        +
        + +
        +

        + + - (void) example_count(groups = example_groups) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Get count of examples to be run.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/core/world.rb', line 86
        +
        +def example_count(groups=example_groups)
        +  FlatMap.flat_map(groups) { |g| g.descendants }.
        +    inject(0) { |a, e| a + e.filtered_examples.size }
        +end
        +
        +
        + +
        +

        + + - (void) ordered_example_groups + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Apply ordering strategy from configuration to example groups.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/core/world.rb', line 37
        +
        +def ordered_example_groups
        +  ordering_strategy = @configuration.ordering_registry.fetch(:global)
        +  ordering_strategy.order(@example_groups)
        +end
        +
        +
        + +
        +

        + + - (void) preceding_declaration_line(filter_line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Find line number of previous declaration.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +94
        +95
        +96
        +97
        +98
        +
        +
        # File 'lib/rspec/core/world.rb', line 94
        +
        +def preceding_declaration_line(filter_line)
        +  declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
        +    line <= filter_line ? line : highest_prior_declaration_line
        +  end
        +end
        +
        +
        + +
        +

        + + - (void) register(example_group) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Register an example group.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/core/world.rb', line 58
        +
        +def register(example_group)
        +  example_groups << example_group
        +  example_group
        +end
        +
        +
        + +
        +

        + + - (void) reset + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Reset world to 'scratch' before running suite.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/world.rb', line 45
        +
        +def reset
        +  example_groups.clear
        +  @shared_example_group_registry = nil
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/_index.html b/source/documentation/3.2/rspec-core/_index.html new file mode 100644 index 000000000..817b9ff43 --- /dev/null +++ b/source/documentation/3.2/rspec-core/_index.html @@ -0,0 +1,571 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.6

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + + + + + + + + + + + + + + + + + + + +
          +
        • H
        • +
            + +
          • + Helpers + + (RSpec::Core::Formatters) + +
          • + +
          • + Hooks + + (RSpec::Core) + +
          • + +
          +
        + + +
        + + +
          +
        • L
        • +
            + +
          • + Loader + + (RSpec::Core::Formatters) + +
          • + +
          +
        + + + + + + + + + + + +
          +
        • R
        • + +
        + + + + + +
          +
        • T
        • +
            + +
          • + TopLevelDSL + + (RSpec::Core::SharedExampleGroup) + +
          • + +
          +
        + + +
          +
        • V
        • +
            + +
          • + Version + + (RSpec::Core) + +
          • + +
          +
        + + +
        + + +
          +
        • W
        • +
            + +
          • + World + + (RSpec::Core) + +
          • + +
          +
        + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/class_list.html b/source/documentation/3.2/rspec-core/class_list.html new file mode 100644 index 000000000..601ae23bb --- /dev/null +++ b/source/documentation/3.2/rspec-core/class_list.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-core/file.Changelog.html b/source/documentation/3.2/rspec-core/file.Changelog.html new file mode 100644 index 000000000..fe1c418c7 --- /dev/null +++ b/source/documentation/3.2/rspec-core/file.Changelog.html @@ -0,0 +1,2614 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        3.2.0 Development

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Improve the inspect output of example groups. (Mike Dalton, +#1687)

          +
        • +

          When rake task fails, only output the command if verbose flag +is set. (Ben Snape, #1704)

          +
        • +

          Add RSpec.clear_examples as a clear way to reset examples in +between spec runs, whilst retaining user configuration. (Alexey Fedorov, +#1706)

          +
        • +

          Reduce string allocations when defining and running examples by 70% and +50% respectively. (Myron Marston, #1738)

          +
        • +

          Removed dependency on pathname from stdlib. (Sam Phippen, #1703)

          +
        • +

          Improve the message presented when a user hits Ctrl-C. (Alex Chaffee +#1717, #1742)

          +
        • +

          Improve shared example group inclusion backtrace displayed in failed +example output so that it works for all methods of including shared +example groups and shows all inclusion locations. (Myron Marston, #1763)

          +
        • +

          Issue seed notification at start (as well as the end) of the reporter run. +(Arlandis Word, #1761)

          +
        • +

          Improve the documentation of around hooks. (Jim Kingdon, #1772)

          +
        • +

          Support prepending of modules into example groups from config and allow +filtering based on metadata. (Arlandis Word, #1806)

          +
        + +

        Bug Fixes:

        +
        • +

          When assigning generated example descriptions, surface errors raised by +matcher.description in the example description. (Myron +Marston, #1771)

          +
        • +

          Don't consider expectations from after hooks when +generating example descriptions. (Myron Marston, #1771)

          +
        • +

          Don't apply metadata-filtered config hooks to examples in groups with +matching metadata when those example override the parent metadata value to +not match. (Myron Marston, #1796)

          +
        + +

        3.1.8 Development

        + +

        Bug Fixes:

        +
        • +

          Apply --seed before loading --require files so +that required files can access the provided seed. (Myron Marston, #1745)

          +
        • +

          Handle +RSpec::Core::Formatters::DeprecationFormatter::FileStream +being reopened with an IO stream, which sometimes happens with spring. +(Kevin Mook, #1757)

          +
        + +

        3.1.7 / 2014-10-11

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix Metadata.relative_path so that for a current directory of +/foo/bar, /foo/bar_1 is not wrongly converted to +._1. (Akos Vandra, #1730)

          +
        • +

          Prevent constant lookup mistakenly finding +RSpec::ExampleGroups generated constants on 1.9.2 by +appending a trailing _ to the generated names. (Jon Rowe, +#1737)

          +
        • +

          Fix bug in :pending metadata. If it got set in any way besides +passing it as part of the metadata literal passed to it (such +as by using define_derived_metadata), it did not have the +desired effect, instead marking the example as :passed. +(Myron Marston, #1739)

          +
        + +

        3.1.6 / 2014-10-08

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix regression in rake task pattern handling, that prevented patterns that +were relative from the current directory rather than from spec +from working properly. (Myron Marston, #1734)

          +
        • +

          Prevent rake task from generating duplicate load path entries. (Myron +Marston, #1735)

          +
        + +

        3.1.5 / 2014-09-29

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix issue with the rake task incorrectly escaping strings on Windows. (Jon +Rowe #1718)

          +
        • +

          Support absolute path patterns. While this wasn't officially supported +previously, setting rake_task.pattern to an absolute path +pattern in RSpec 3.0 and before worked since it delegated to +FileList internally (but now just forwards the pattern on to +the rspec command). (Myron Marston, #1726)

          +
        + +

        3.1.4 / 2014-09-18

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix implicit subject when using describe false or +describe nil so that it returns the provided primitive rather +than the string representation. (Myron Marston, #1710)

          +
        • +

          Fix backtrace filtering to allow code in subdirectories of your current +working directory (such as vendor/bundle/…) to be filtered from +backtraces. (Myron Marston, #1708)

          +
        + +

        3.1.3 / 2014-09-15

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix yet another regression in rake task pattern handling, to allow +task.pattern = FileList["..."] to work. That was never +intended to be supported but accidentally worked in 3.0 and earlier. +(Myron Marston, #1701)

          +
        • +

          Fix pattern handling so that files are normalized to absolute paths before +subtracting the --exclude-pattern matched files from the +--pattern matched files so that it still works even if the +patterns are in slightly different forms (e.g. one starting with +./). (Christian Nelson, #1698)

          +
        + +

        3.1.2 / 2014-09-08

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix another regression in rake task pattern handling, so that patterns +that start with ./ still work. (Christian Nelson, #1696)

          +
        + +

        3.1.1 / 2014-09-05

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix a regression in rake task pattern handling, so that +rake_task.pattern = array works again. While we never +intended to support array values (or even knew that worked!), the +implementation from 3.0 and earlier used FileList internally, +which allows arrays. The fix restores the old behavior. (Myron Marston, +#1694)

          +
        + +

        3.1.0 / 2014-09-04

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Update files generated by rspec --init so that warnings are +enabled in commented out section of spec_helper rather than +.rspec so users have to consciously opt-in to the setting. +(Andrew Hooker, #1572)

          +
        • +

          Update spec_helper generated by rspec --init so +that it sets the new rspec-expectations +include_chain_clauses_in_custom_matcher_descriptions config +option (which will be on by default in RSpec 4) and also sets the +rspec-mocks verify_partial_doubles option (which will also +default to on in RSpec 4). (Myron Marston, #1647)

          +
        • +

          Provide an inspect output for example procsy objects (used in +around hooks) that doesn't make them look like procs. (Jon Rowe, +#1620)

          +
        • +

          Remove a few unneeded require statements from +rspec/core/rake_task.rb, making it even more lighterweight. +(Myron Marston, #1640)

          +
        • +

          Allow rspec-core to be used when neither rspec-mocks or rspec-expectations +are installed, without requiring any user configuration. (Sam Phippen, +Myron Marston, #1615)

          +
        • +

          Don't filter out gems from backtraces by default. (The RSpec gems will +still be filtered). User feedback has indicated that including gems in +default backtraces will be useful. (Myron Marston, #1641)

          +
        • +

          Add new config.filter_gems_from_backtrace "rack", +"rake" API to easily filter the named gems from +backtraces. (Myron Marston, #1682)

          +
        • +

          Fix default backtrace filters so that the RSpec binary is excluded when +installing RSpec as a bundler :git dependency. (Myron +Marston, #1648)

          +
        • +

          Simplify command generated by the rake task so that it no longer includes +unnecessary -S. (Myron Marston, #1559)

          +
        • +

          Add --exclude-pattern CLI option, config.exclude_pattern += config option and task.exclude_pattern = rake task +config option. Matching files will be excluded. (John Gesimondo, Myron +Marston, #1651, #1671)

          +
        • +

          When an around hook fails to execute the example, mark it as pending +(rather than passing) so the user is made aware of the fact that the +example did not actually run. (Myron Marston, #1660)

          +
        • +

          Remove dependency on FileUtils from the standard library so +that users do not get false positives where their code relies on it but +they are not requiring it. (Sam Phippen, #1565)

          +
        + +

        Bug Fixes:

        +
        • +

          Fix rake task t.pattern = option so that it does not run all +specs when it matches no files, by passing along a --pattern +option to the rspec command, rather than resolving the file +list and passing along the files individually. (Evgeny Zislis, #1653)

          +
        • +

          Fix rake task default pattern so that it follows symlinks properly. (Myron +Marston, #1672)

          +
        • +

          Fix default pattern used with rspec command so that it follows +symlinks properly. (Myron Marston, #1672)

          +
        • +

          Change how we assign constant names to example group classes so that it +avoids a problem with describe "Core". (Daniela +Wellisz, #1679)

          +
        • +

          Handle rendering exceptions that have a different encoding than that of +their original source file. (Jon Rowe, #1681)

          +
        • +

          Allow access to message_lines without colour for failed examples even when +they're part of a shared example group. (tomykaira, #1689)

          +
        + +

        3.0.4 / 2014-08-14

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix processing order of CLI options so that if +config.files_to_run is accessed from a file loaded by +--require, --pattern is still applied. (Myron +Marston, #1652)

          +
        • +

          Fix config.pattern= so that it still takes affect even if +config.files_to_run has already been accessed. (Myron Marston, +#1652)

          +
        + +

        3.0.3 / 2014-07-21

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Properly convert both parts of a description into strings before +concatenation. (@nicklink483, #1636)

          +
        • +

          Exclude the working directory when figuring out folders to ignore. (Jon +Rowe, Myron Marston, #1616)

          +
        • +

          Allow +::RSpec::Core::Notifications::FailedExampleNotification#message_lines +to be accessed without a colouriser. (@tomykaira, #1637)

          +
        + +

        3.0.2 / 2014-06-19

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix regression in CLI option handling that prevented --tag +slow passed at the command line from overriding --tag +~slow in .rspec. (Colin Jones, #1602)

          +
        • +

          Fix metadata :example_group deprecation warning so that it +gets issued at the call site of the configuration that specified it as a +filter rather than later when an example group is defined. (Myron Marston, +#1562)

          +
        • +

          Make the line that is printed when a shared example group fails indicating +where the concrete example group is white, separating it from the stack +trace that is produced for the failure. (Sam Phippen, Jon Rowe, #1606)

          +
        + +

        3.0.1 / 2014-06-12

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix a couple ruby warnings caused by rspec-core when loaded. (Prem +Sichanugrist, #1584)

          +
        • +

          Example groups named Config will no longer cause a Ruby +warning to be issued. (Jimmy Cuadra, #1580)

          +
        + +

        3.0.0 / 2014-06-01

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix BaseTextFormatter so that it does not re-close a closed +output stream. (Myron Marston)

          +
        • +

          Fix regression in metadata that caused the metadata hash of a top-level +example group to have a :parent_example_group key even though +it has no parent example group. (Myron Marston)

          +
        + +

        Enhancements:

        +
        • +

          Alter the default spec_helper.rb to no longer recommend +config.full_backtrace = true see #1536 for discussion. (Jon +Rowe)

          +
        + +

        3.0.0.rc1 / 2014-05-18

        + +

        Full +Changelog

        + +

        Breaking Changes for 3.0.0:

        +
        • +

          Change described_class so that in a nested group like +describe MyClass, it returns MyClass rather +than the outer group's described class. (Myron Marston)

          +
        • +

          Refactor filter manager so that it no longer subclasses Hash and has a +tighter, more domain-specific interface. (Sergey Pchelincev)

          +
        • +

          Remove legacy colours definitions from BaseTextFormatter. (Jon +Rowe)

          +
        • +

          Remove console color definitions from BaseTextFormatter. (Jon +Rowe)

          +
        • +

          Restructure example group metadata so that the computed keys are exposed +directly off of the metadata hash rather than being on a nested +:example_group subhash. In addition, the parent example group +metadata is now available as [:parent_example_group] rather +than [:example_group][:example_group]. Deprecated access via +the old key structure is still provided. (Myron Marston)

          +
        • +

          Remove :describes metadata key. It duplicates +:described_class for no good reason. Deprecated access via +:describes is still provided. (Myron Marston)

          +
        • +

          Rename :example_group_block metadata key to +:block. (Myron Marston)

          +
        • +

          Remove deprecated RSpec::Core::Example#options. (Myron +Marston)

          +
        • +

          Move BaseTextFormatter#colorize_summary to +SummaryNotification#colorize_with (Jon Rowe).

          +
        • +

          describe some_hash treated some_hash as metadata +in RSpec 2.x but will treat it as the described object in RSpec 3.0. +Metadata must always come after the description args. (Myron Marston)

          +
        • +

          Remove deprecated display_name alias of +ExampleGroup.description. (Myron Marston)

          +
        • +

          Remove deprecated describes alias of +ExampleGroup.described_class. (Myron Marston)

          +
        • +

          Remove deprecated +RSpec::Core::ExampleGroup.alias_it_behaves_like_to. Use +RSpec::Core::Configuration#alias_it_behaves_like_to instead. +(Myron Marston)

          +
        • +

          Remove deprecated RSpec::Core::ExampleGroup.alias_example_to. +Use RSpec::Core::Configuration#alias_example_to instead. +(Myron Marston)

          +
        • +

          Removed focused example alias and change example/group aliases +fit, focus, fcontext and +fdescribe to no longer include :focused => +true metadata. They only contain :focus => true +metadata now. This means that you will need to filter them with +filter_run :focus, not filter_run :focused. +(Myron Marston)

          +
        • +

          Remove --line-number filtering. It's semantically dubious +since it's a global filter (potentially applied to multiple files) but +there's no meaningful connection between the same line number in +multiple files. Instead use the rspec path/to/spec.rb:23:46 +form, which is terser and makes more sense as it is scoped to a file. +(Myron Marston)

          +
        • +

          Remove --default_path as an alias for +--default-path. (Jon Rowe)

          +
        • +

          Remove deprecated share_examples_for. There's still +shared_examples and shared_examples_for. (Myron +Marston)

          +
        • +

          Rename RSpec::Core::Configuration#warnings to +RSpec::Core::Configuration#warnings? since it's a boolean +flag. (Myron Marston)

          +
        • +

          RSpec's global state is no longer reset after a spec run. This gives +more flexibility to alternate runners to decide when and if they want the +state reset. Alternate runners are now responsible for calling this (or +doing a similar reset) if they are going to run the spec suite multiple +times in the same process. (Sam Phippen)

          +
        • +

          Merge RSpec::Core::CommandLine (never formally declared +public) into RSpec::Core::Runner. (Myron Marston)

          +
        • +

          Remove color_enabled as an alias of color. (Jon +Rowe)

          +
        • +

          Remove backtrace_cleaner as an alias of +backtrace_formatter. (Jon Rowe)

          +
        • +

          Remove filename_pattern as an alias of pattern. +(Jon Rowe)

          +
        • +

          Extract support for legacy formatters to +rspec-legacy_formatters. (Jon Rowe)

          +
        • +

          RSpec::Configuration#formatters now returns a dup to prevent +mutation. (Jon Rowe)

          +
        • +

          Replace stdlib as an available expectation framework with +test_unit and minitest. (Aaron Kromer)

          +
        • +

          Remove backtrace formatting helpers from BaseTextFormatter. +(Jon Rowe)

          +
        • +

          Extract profiler support to ProfileFormatter and +ProfileNotification. Formatters should implement +dump_profile if they wish to respond to +--profile. (Jon Rowe)

          +
        • +

          Extract remaining formatter state to reporter and notifications. Introduce +ExamplesNotification to share information about examples that +was previously held in BaseFormatter. (Jon Rowe)

          +
        + +

        Enhancements:

        +
        • +

          Add config.default_formatter attribute, which can be used to +set a formatter which will only be used if no other formatter is set +(e.g. via --formatter). (Myron Marston)

          +
        • +

          Support legacy colour definitions in LegacyFormatterAdaptor. +(Jon Rowe)

          +
        • +

          Migrate execution_result (exposed by metadata) from a hash to +a first-class object with appropriate attributes. status is +now stored and returned as a symbol rather than a string. It retains +deprecated hash behavior for backwards compatibility. (Myron Marston)

          +
        • +

          Provide console code helper for formatters. (Jon Rowe)

          +
        • +

          Use raw ruby hashes for the metadata hashes rather than a subclass of a +hash. Computed metadata entries are now computed in advance rather than +being done lazily on first access. (Myron Marston)

          +
        • +

          Add :block metadata entry to the example metadata, bringing +parity with :block in the example group metadata. (Myron +Marston)

          +
        • +

          Add fspecify and fexample as aliases of +specify and example with :focus => +true metadata for parity with fit. (Myron Marston)

          +
        • +

          Add legacy support for colorize_summary. (Jon Rowe)

          +
        • +

          Restructure runner so it can be more easily customized in a subclass for +an alternate runner. (Ben Hoskings)

          +
        • +

          Document RSpec::Core::ConfigurationOptions as an officially +supported public API. (Myron Marston)

          +
        • +

          Add --deprecation-out CLI option which directs deprecation +warnings to the named file. (Myron Marston)

          +
        • +

          Minitest 5 compatability for expect_with :stdlib (now +available as expect_with :minitest). (Xavier Shay)

          +
        • +

          Reporter now notifies formatters of the load time of RSpec and your specs +via StartNotification and SummaryNotification. +(Jon Rowe)

          +
        • +

          Add disable_monkey_patching! config option that disables all +monkey patching from whatever pieces of RSpec you use. (Alexey Fedorov)

          +
        • +

          Add Pathname support for setting all output streams. (Aaron +Kromer)

          +
        • +

          Add config.define_derived_metadata, which can be used to apply +additional metadata to all groups or examples that match a given filter. +(Myron Marston)

          +
        • +

          Provide formatted and colorized backtraces via +FailedExampleNotification and send +PendingExampleFixedNotifications when the error is due to a +passing spec you expect to fail. (Jon Rowe)

          +
        • +

          Add dump_profile to formatter API to allow formatters to +implement support for --profile. (Jon Rowe)

          +
        • +

          Allow colourising text via ConsoleCodes with RSpec +'states' (e.g. :success, :failure) +rather than direct colour codes. (Jon Rowe)

          +
        • +

          Expose fully_formatted methods off the formatter notification +objects that make it easy for a custom formatter to produce formatted +output like rspec-core's. (Myron Marston)

          +
        + +

        Bug Fixes:

        +
        • +

          Fix spec_helper.rb file generated by rspec --init +so that the recommended settings correctly use the documentation formatter +when running one file. (Myron Marston)

          +
        • +

          Fix ordering problem where descriptions were generated after tearing down +mocks, which resulted in unexpected exceptions. (Bradley Schaefer, Aaron +Kromer, Andrey Savchenko)

          +
        • +

          Allow a symbol to be used as an implicit subject (e.g. describe +:foo). (Myron Marston)

          +
        • +

          Prevent creating an isolated context (i.e. using +RSpec.describe) when already inside a context. There is no +reason to do this, and it could potentially cause unexpected bugs. (Xavier +Shay)

          +
        • +

          Fix shared example group scoping so that when two shared example groups +share the same name at different levels of nested contexts, the one in the +nearest context is used. (Myron Marston)

          +
        • +

          Fix --warnings option so that it enables warnings immediately +so that it applies to files loaded by --require. (Myron +Marston)

          +
        • +

          Issue a warning when you set config.deprecation_stream too +late for it to take effect because the reporter has already been setup. +(Myron Marston)

          +
        • +

          Add the full RSpec::Core::Example interface to the argument +yielded to around hooks. (Myron Marston)

          +
        • +

          Line number always takes precendence when running specs with filters. +(Xavier Shay)

          +
        • +

          Ensure :if and :unless metadata filters are treated as a special case and +are always in-effect. (Bradley Schaefer)

          +
        • +

          Ensure the currently running installation of RSpec is used when the rake +task shells out to rspec, even if a newer version is also +installed. (Postmodern)

          +
        • +

          Using a legacy formatter as default no longer causes an infinite loop. +(Xavier Shay)

          +
        + +

        3.0.0.beta2 / 2014-02-17

        + +

        Full +Changelog

        + +

        Breaking Changes for 3.0.0:

        +
        • +

          Make mock_with option more strict. Strings are no longer +supported (e.g. mock_with "mocha") – use a symbol +instead. Also, unrecognized values will now result in an error rather than +falling back to the null mocking adapter. If you want to use the null +mocking adapter, use mock_with :nothing (as has been +documented for a long time). (Myron Marston)

          +
        • +

          Remove support for overriding RSpec's built-in :if and +:unless filters. (Ashish Dixit)

          +
        • +

          Custom formatters are now required to call +RSpec::Core::Formatters.register(formatter_class, +*notifications) where notifications is the list of +events the formatter wishes to be notified about. Notifications are +handled by methods matching the names on formatters. This allows us to add +or remove notifications without breaking existing formatters. (Jon Rowe)

          +
        • +

          Change arguments passed to formatters. Rather than passing multiple +arguments (which limits are ability to add additional arguments as doing +so would break existing formatters), we now pass a notification value +object that exposes the same data via attributes. This will allow us to +add new bits of data to a notification event without breaking existing +formatters. (Jon Rowe)

          +
        • +

          Remove support for deprecated :alias option for +RSpec.configuration.add_setting. (Myron Marston)

          +
        • +

          Remove support for deprecated RSpec.configuration.requires = +[...]. (Myron Marston)

          +
        • +

          Remove support for deprecated --formatter CLI option. (Myron +Marston)

          +
        • +

          Remove support for deprecated --configure CLI option. (Myron +Marston)

          +
        • +

          Remove support for deprecated +RSpec::Core::RakeTask#spec_opts=. (Myron Marston)

          +
        • +

          An example group level pending block or :pending +metadata now executes the example and cause a failure if it passes, +otherwise it will be pending if it fails. The old “never run” behaviour is +still used for xexample, xit, and +xspecify, or via a new skip method or +:skip metadata option. (Xavier Shay)

          +
        • +

          After calling pending inside an example, the remainder of the +example will now be run. If it passes a failure is raised, otherwise the +example is marked pending. The old “never run” behaviour is provided a by +a new skip method. (Xavier Shay)

          +
        • +

          Pending blocks inside an example have been removed as a feature with no +direct replacement. Use skip or pending without a +block. (Xavier Shay)

          +
        • +

          Pending statement is no longer allowed in before(:all) hooks. +Use skip instead. (Xavier Shay)

          +
        • +

          Remove show_failures_in_pending_blocks configuration option. +(Xavier Shay)

          +
        • +

          Remove support for specifying the documentation formatter using +'s', 'n', 'spec' or 'nested'. (Jon Rowe)

          +
        + +

        Enhancements:

        +
        • +

          Add example run time to JSON formatter output. (Karthik Kastury)

          +
        • +

          Add more suggested settings to the files generated by rspec +--init. (Myron Marston)

          +
        • +

          Add config.alias_example_group_to, which can be used to define +a new method that defines an example group with the provided metadata. +(Michi Huber)

          +
        • +

          Add xdescribe and xcontext as shortcuts to skip +an example group. (Myron Marston)

          +
        • +

          Add fdescribe and fcontext as shortcuts to focus +an example group. (Myron Marston)

          +
        • +

          Don't autorun specs via #at_exit by default. require +'rspec/autorun' is only needed when running specs via +ruby, as it always has been. Running specs via +rake or rspec are both unaffected. (Ben Hoskings)

          +
        • +

          Add expose_dsl_globally config option, defaulting to true. +When disabled it will remove the monkey patches rspec-core adds to +main and Module (e.g. describe, +shared_examples_for, etc). (Jon Rowe)

          +
        • +

          Expose RSpec DSL entry point methods (describe, +shared_examples_for, etc) on the RSpec constant. +Intended for use when expose_dsl_globally is set to +false. (Jon Rowe)

          +
        • +

          For consistency, expose all example group aliases (including +context) on the RSpec constant. If +expose_dsl_globally is set to true, also expose +them on main and Module. Historically, only +describe was exposed. (Jon Rowe, Michi Huber)

          +
        • +

          Add hook scope :example as an alias for :each, +and :context as an alias for :all. (John +Feminella)

          +
        + +

        Bug Fixes:

        +
        • +

          Fix failure (undefined method path) in end-of-run summary +when raise_errors_for_deprecations! is configured. (Myron +Marston)

          +
        • +

          Issue error when attempting to use -i or --I on +command line, too close to -I to be considered short hand for +--init. (Jon Rowe)

          +
        • +

          Prevent adding formatters to an output target if the same formatter has +already been added to that output. (Alex Peattie)

          +
        • +

          Allow a matcher-generated example description to be used when the example +is pending. (Myron Marston)

          +
        • +

          Ensure the configured failure_exit_code is used by the rake +task when there is a failure. (Jon Rowe)

          +
        • +

          Restore behaviour whereby system exclusion filters take priority over +working directory (was broken in beta1). (Jon Rowe)

          +
        • +

          Prevent RSpec mangling file names that have substrings containing +line_number or default_path. (Matijs van +Zuijlen)

          +
        + +

        3.0.0.beta1 / 2013-11-07

        + +

        Full +Changelog

        + +

        Breaking Changes for 3.0.0:

        +
        • +

          Remove explicit support for 1.8.6. (Jon Rowe)

          +
        • +

          Remove RSpec::Core::ExampleGroup#example and +RSpec::Core::ExampleGroup#running_example methods. If you need +access to the example (e.g. to get its metadata), use a block arg instead. +(David Chelimsky)

          +
        • +

          Remove TextMateFormatter, it has been moved to +rspec-tmbundle. (Aaron Kromer)

          +
        • +

          Remove RCov integration. (Jon Rowe)

          +
        • +

          Remove deprecated support for RSpec 1 constructs (Myron Marston):

          +
        • +

          The Spec and Rspec constants (rather than +RSpec).

          +
        • +

          Spec::Runner.configure rather than +RSpec.configure.

          +
        • +

          Rake::SpecTask rather than RSpec::Core::RakeTask.

          +
        • +

          Remove deprecated support for share_as. (Myron Marston)

          +
        • +

          Remove --debug option (and corresponding option on +RSpec::Core::Configuration). Instead, use -r<debugger +gem name> to load whichever debugger gem you wish to use (e.g. +ruby-debug, debugger, or pry). +(Myron Marston)

          +
        • +

          Extract Autotest support to a seperate gem. (Jon Rowe)

          +
        • +

          Raise an error when a let or subject declaration +is accessed in a before(:all) or after(:all) +hook. (Myron Marston)

          +
        • +

          Extract its support to a separate gem. (Peter Alfvin)

          +
        • +

          Disallow use of a shared example group from sibling contexts, making them +fully isolated. 2.14 and 2.99 allowed this but printed a deprecation +warning. (Jon Rowe)

          +
        • +

          Remove RSpec::Core::Configuration#output and +RSpec::Core::Configuration#out aliases of +RSpec::Core::Configuration#output_stream. (Myron Marston)

          +
        • +

          Remove legacy ordering APIs deprecated in 2.99.0.beta1. (Myron Marston)

          +
        + +

        Enhancements:

        +
        • +

          Replace unmaintained syntax gem with coderay gem. (Xavier Shay)

          +
        • +

          Times in profile output are now bold instead of failure_color. +(Matthew Boedicker)

          +
        • +

          Add --no-fail-fast command line option. (Gonzalo +Rodríguez-Baltanás Díaz)

          +
        • +

          Runner now considers the local system ip address when running under Drb. +(Adrian CB)

          +
        • +

          JsonFormatter now includes --profile information. (Alex / +@MasterLambaster)

          +
        • +

          Always treat symbols passed as metadata args as hash keys with true +values. RSpec 2 supported this with the +treat_symbols_as_metadata_keys_with_true_values but now this +behavior is always enabled. (Myron Marston)

          +
        • +

          Add --dry-run option, which prints the formatter output of +your suite without running any examples or hooks. (Thomas Stratmann, Myron +Marston)

          +
        • +

          Document the configuration options and default values in the +spec_helper.rb file that is generated by RSpec. (Parker +Selbert)

          +
        • +

          Give generated example group classes a friendly name derived from the +docstring, rather than something like “Nested_2”. (Myron Marston)

          +
        • +

          Avoid affecting randomization of user code when shuffling examples so that +users can count on their own seeds working. (Travis Herrick)

          +
        • +

          Ordering is no longer a single global property of the test suite. Each +group can pick an ordering using :order metadata. (Andy +Lindeman, Sam Phippen, Myron Marston)

          +
        • +

          Allow named custom ordering strategies to be registered, which can then be +used on individual example groups. (Andy Lindeman, Sam Phippen, Myron +Marston)

          +
        + +

        Deprecations:

        +
        • +

          treat_symbols_as_metadata_keys_with_true_values is deprecated +and no longer has an affect now that the behavior it enabled is always +enabled. (Myron Marston)

          +
        + +

        2.99.2 / 2014-08-19

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Improve deprecation warning for RSpec 3 change in describe <a +symbol> behavior. (Jon Rowe, #1667)

          +
        + +

        2.99.1 / 2014-06-19

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Add missing deprecation warning for when RSpec::Core::Runner +is used multiple times in the same process. In 2.x RSpec's global +state was automatically cleared between runs but in 3.0 you need to call +RSpec.reset manually in these situations. (Sam Phippen, +#1587)

          +
        • +

          Prevent deprecation being accidentally issues when doubles used with +be_ matchers due to automatically generated descriptions. +(Jon Rowe, #1573)

          +
        • +

          Load rspec/core when loading rspec/core/rake_task +to ensure we can issue deprecations correctly. (Jon Rowe, #1612)

          +
        + +

        2.99.0 / 2014-06-01

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix BaseTextFormatter so that it does not re-close a closed +output stream. (Myron Marston)

          +
        • +

          Use RSpec::Configuration#backtrace_exclusion_patterns rather +than the deprecated +RSpec::Configuration#backtrace_clean_patterns when mocking +with rr. (David Dollar)

          +
        + +

        2.99.0.rc1 / 2014-05-18

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Add --deprecation-out CLI option which directs deprecation +warnings to the named file. (Myron Marston)

          +
        • +

          Backport support for skip in metadata to skip execution of an +example. (Xavier Shay, #1472)

          +
        • +

          Add Pathname support for setting all output streams. (Aaron +Kromer)

          +
        • +

          Add test_unit and minitest expectation +frameworks. (Aaron Kromer)

          +
        + +

        Deprecations:

        +
        • +

          Deprecate RSpec::Core::Pending::PendingDeclaredInExample, use +SkipDeclaredInExample instead. (Xavier Shay)

          +
        • +

          Issue a deprecation when described_class is accessed from +within a nested describe <SomeClass> example group, +since described_class will return the innermost described +class in RSpec 3 rather than the outermost described class, as it behaved +in RSpec 2. (Myron Marston)

          +
        • +

          Deprecate RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS, +RSpec::Core::FilterManager::STANDALONE_FILTERS and use of +#empty_without_conditional_filters? on those filters. (Sergey +Pchelincev)

          +
        • +

          Deprecate RSpec::Core::Example#options in favor of +RSpec::Core::Example#metadata. (Myron Marston)

          +
        • +

          Issue warning when passing a symbol or hash to describe or +context as the first argument. In RSpec 2.x this would be +treated as metadata but in RSpec 3 it'll be treated as the described +object. To continue having it treated as metadata, pass a description +before the symbol or hash. (Myron Marston)

          +
        • +

          Deprecate RSpec::Core::BaseTextFormatter::VT100_COLORS and +RSpec::Core::BaseTextFormatter::VT100_COLOR_CODES in favour +of RSpec::Core::BaseTextFormatter::ConsoleCodes::VT100_CODES +and +RSpec::Core::BaseTextFormatter::ConsoleCodes::VT100_CODE_VALUES. +(Jon Rowe)

          +
        • +

          Deprecate RSpec::Core::ExampleGroup.display_name in favor of +RSpec::Core::ExampleGroup.description. (Myron Marston)

          +
        • +

          Deprecate RSpec::Core::ExampleGroup.describes in favor of +RSpec::Core::ExampleGroup.described_class. (Myron Marston)

          +
        • +

          Deprecate RSpec::Core::ExampleGroup.alias_example_to in favor +of RSpec::Core::Configuration#alias_example_to. (Myron +Marston)

          +
        • +

          Deprecate RSpec::Core::ExampleGroup.alias_it_behaves_like_to +in favor of +RSpec::Core::Configuration#alias_it_behaves_like_to. (Myron +Marston)

          +
        • +

          Deprecate RSpec::Core::ExampleGroup.focused in favor of +RSpec::Core::ExampleGroup.focus. (Myron Marston)

          +
        • +

          Add deprecation warning for config.filter_run :focused since +example aliases fit and focus will no longer +include :focused metadata but will continue to include +:focus. (Myron Marston)

          +
        • +

          Deprecate filtering by :line_number (e.g. +--line-number from the CLI). Use location filtering instead. +(Myron Marston)

          +
        • +

          Deprecate --default_path as an alternative to +--default-path. (Jon Rowe)

          +
        • +

          Deprecate RSpec::Core::Configuration#warnings in favor of +RSpec::Core::Configuration#warnings?. (Myron Marston)

          +
        • +

          Deprecate share_examples_for in favor of +shared_examples_for or just shared_examples. +(Myron Marston)

          +
        • +

          Deprecate RSpec::Core::CommandLine in favor of +RSpec::Core::Runner. (Myron Marston)

          +
        • +

          Deprecate #color_enabled, #color_enabled= and +#color? in favour of #color, +#color= and #color_enabled? output. (Jon Rowe)

          +
        • +

          Deprecate #filename_pattern in favour of +#pattern. (Jon Rowe)

          +
        • +

          Deprecate #backtrace_cleaner in favour of +#backtrace_formatter. (Jon Rowe)

          +
        • +

          Deprecate mutating RSpec::Configuration#formatters. (Jon Rowe)

          +
        • +

          Deprecate stdlib as an available expectation framework in +favour of test_unit and minitest. (Aaron Kromer)

          +
        + +

        Bug Fixes:

        +
        • +

          Issue a warning when you set config.deprecation_stream too +late for it to take effect because the reporter has already been setup. +(Myron Marston)

          +
        • +

          skip with a block should not execute the block. (Xavier Shay)

          +
        + +

        2.99.0.beta2 / 2014-02-17

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Add is_expected for one-liners that read well with the +expect-based syntax. is_expected is simply +defined as expect(subject) and can be used in an expression +like: it { is_expected.to read_well }. (Myron Marston)

          +
        • +

          Backport skip from RSpec 3, which acts like +pending did in RSpec 2 when not given a block, since the +behavior of pending is changing in RSpec 3. (Xavier Shay)

          +
        + +

        Deprecations:

        +
        • +

          Deprecate inexact mock_with config options. RSpec 3 will only +support the exact symbols :rspec, :mocha, +:flexmock, :rr or :nothing (or any +module that implements the adapter interface). RSpec 2 did fuzzy matching +but this will not be supported going forward. (Myron Marston)

          +
        • +

          Deprecate show_failures_in_pending_blocks config option. To +achieve the same behavior as the option enabled, you can use a custom +formatter instead. (Xavier Shay)

          +
        • +

          Add a deprecation warning for the fact that the behavior of +pending is changing in RSpec 3 – rather than skipping the +example (as it did in 2.x when no block was provided), it will run the +example and mark it as failed if no exception is raised. Use +skip instead to preserve the old behavior. (Xavier Shay)

          +
        • +

          Deprecate 's', 'n', 'spec' and 'nested' as +aliases for documentation formatter. (Jon Rowe)

          +
        • +

          Deprecate RSpec::Core::Reporter#abort in favor of +RSpec::Core::Reporter#finish. (Jon Rowe)

          +
        + +

        Bug Fixes:

        +
        • +

          Fix failure (undefined method path) in end-of-run summary +when raise_errors_for_deprecations! is configured. (Myron +Marston)

          +
        • +

          Fix issue were overridding spec ordering from the command line wasn't +fully recognised interally. (Jon Rowe)

          +
        + +

        2.99.0.beta1 / 2013-11-07

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Block-based DSL methods that run in the context of an example +(it, before(:each), after(:each), +let and subject) now yield the example as a +block argument. (David Chelimsky)

          +
        • +

          Warn when the name of more than one example group is submitted to +include_examples and it's aliases. (David Chelimsky)

          +
        • +

          Add expose_current_running_example_as config option for use +during the upgrade process when external gems use the deprecated +RSpec::Core::ExampleGroup#example and +RSpec::Core::ExampleGroup#running_example methods. (Myron +Marston)

          +
        • +

          Limit spamminess of deprecation messages. (Bradley Schaefer, Loren Segal)

          +
        • +

          Add config.raise_errors_for_deprecations! option, which turns +deprecations warnings into errors to surface the full backtrace of the +call site. (Myron Marston)

          +
        + +

        Deprecations

        +
        • +

          Deprecate RSpec::Core::ExampleGroup#example and +RSpec::Core::ExampleGroup#running_example methods. If you need +access to the example (e.g. to get its metadata), use a block argument +instead. (David Chelimsky)

          +
        • +

          Deprecate use of autotest/rspec2 in favour of +rspec-autotest. (Jon Rowe)

          +
        • +

          Deprecate RSpec's built-in debugger support. Use a CLI option like +-rruby-debug (for the ruby-debug gem) or +-rdebugger (for the debugger gem) instead. (Myron Marston)

          +
        • +

          Deprecate +RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values = +false. RSpec 3 will not support having this option set to +false. (Myron Marston)

          +
        • +

          Deprecate accessing a let or subject declaration +in a after(:all) hook. (Myron Marston, Jon Rowe)

          +
        • +

          Deprecate built-in its usage in favor of +rspec-its gem due to planned removal in RSpec 3. (Peter +Alfvin)

          +
        • +

          Deprecate RSpec::Core::PendingExampleFixedError in favor of +RSpec::Core::Pending::PendingExampleFixedError. (Myron +Marston)

          +
        • +

          Deprecate RSpec::Core::Configuration#out and +RSpec::Core::Configuration#output in favor of +RSpec::Core::Configuration#output_stream. (Myron Marston)

          +
        • +

          Deprecate legacy ordering APIs.

          +
        • +

          You should use register_ordering(:global) instead of these:

          +
          • +

            RSpec::Core::Configuration#order_examples

            +
          • +

            RSpec::Core::Configuration#order_groups

            +
          • +

            RSpec::Core::Configuration#order_groups_and_examples

            +
          +
        • +

          These are deprecated with no replacement because in RSpec 3 ordering is a +property of individual example groups rather than just a global property of +the entire test suite:

          +
          • +

            RSpec::Core::Configuration#order

            +
          • +

            RSpec::Core::Configuration#randomize?

            +
          +
        • +

          --order default is deprecated in favor of --order +defined (Myron Marston)

          +
        + +

        2.14.8 / 2014-02-27

        + +

        Full +Changelog

        + +

        Bug fixes:

        +
        • +

          Fix regression with the textmateformatter that prevented +backtrace links from being clickable. (Stefan Daschek)

          +
        + +

        2.14.7 / 2013-10-29

        + +

        Full +Changelog

        + +

        Bug fixes:

        +
        • +

          Fix regression in 2.14.6 that broke the Fivemat formatter. It depended +upon either +example.execution_result[:exception].pending_fixed? (which +was removed in 2.14.6 to fix an issue with frozen error objects) or +RSpec::Core::PendingExampleFixedError (which was renamed to +RSpec::Core::Pending::PendingExampleFixedError in 2.8. This +fix makes a constant alias for the old error name. (Myron Marston)

          +
        + +

        2.14.6 / 2013-10-15

        + +

        Full +Changelog

        + +

        Bug fixes:

        +
        • +

          Format stringified numbers correctly when mathn library is loaded. (Jay +Hayes)

          +
        • +

          Fix an issue that prevented the use of frozen error objects. (Lars Gierth)

          +
        + +

        2.14.5 / 2013-08-13

        + +

        Full +Changelog

        + +

        Bug fixes:

        +
        • +

          Fix a NoMethodError that was being raised when there were no +shared examples or contexts declared and RSpec.world.reset is +invoked. (thepoho, Jon Rowe, Myron Marston)

          +
        • +

          Fix a deprecation warning that was being incorrectly displayed when +shared_examples are declared at top level in a +module scope. (Jon Rowe)

          +
        • +

          Fix after(:all) hooks so consecutive (same context) scopes will run even if +one raises an error. (Jon Rowe, Trejkaz)

          +
        • +

          JsonFormatter no longer dies if dump_profile isn't defined +(Alex / @MasterLambaster, Jon Rowe)

          +
        + +

        2.14.4 / 2013-07-21

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix regression in 2.14: ensure configured requires (via -r +option) are loaded before spec files are loaded. This allows the spec +files to programatically change the file pattern (Jon Rowe).

          +
        • +

          Autoload RSpec::Mocks and RSpec::Expectations +when referenced if they are not already loaded +(RSpec::Matches has been autoloaded for a while). In the +rspec gem, we changed it recently to stop loading +rspec/mocks and rspec/expectations by default, as +some users reported problems where they were intending to use mocha, not +rspec-mocks, but rspec-mocks was loaded and causing a conflict. rspec-core +loads mocks and expectations at the appropriate time, so it seemed like a +safe change – but caused a problem for some authors of libraries that +integrate with RSpec. This fixes that problem. (Myron Marston)

          +
        • +

          Gracefully handle a command like rspec --profile +path/to/spec.rb: the path/to/spec.rb arg was being +wrongly treated as the profile integer arg, which got cast +0 using to_i, causing no profiled examples to be +printed. (Jon Rowe)

          +
        + +

        2.14.3 / 2013-07-13

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix deprecation notices issued from RSpec::Core::RakeTask so +that they work properly when all of rspec-core is not loaded. (This was a +regression in 2.14) (Jon Rowe)

          +
        + +

        2.14.2 / 2013-07-09

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix regression caused by 2.14.1 release: formatters that report that they +respond_to? a notification, but had no corresponding method +would raise an error when registered. The new fix is to just implement +start on the deprecation formatter to fix the original +JRuby/ruby-debug issue. (Jon Rowe)

          +
        + +

        2.14.1 / 2013-07-08

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Address deprecation formatter failure when using ruby-debug on +JRuby: fix RSpec::Core::Reporter to not send a notification +when the formatter's implementation of the notification method comes +from Kernel (Alex Portnov, Jon Rowe).

          +
        + +

        2.14.0 / 2013-07-06

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Apply focus to examples defined with fit (equivalent of +it "description", focus: true) (Michael de Silva)

          +
        + +

        Bug fix

        +
        • +

          Ensure methods defined by let take precedence over others +when there is a name collision (e.g. from an included module). (Jon Rowe, +Andy Lindeman and Myron Marston)

          +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Improved Windows detection inside Git Bash, for better --color +handling.

          +
        • +

          Add profiling of the slowest example groups to --profile +option. The output is sorted by the slowest average example groups.

          +
        • +

          Don't show slow examples if there's a failure and both +--fail-fast and --profile options are used +(Paweł Gościcki).

          +
        • +

          Rather than always adding spec to the load path, add the +configured --default-path to the load path (which defaults to +spec). This better supports folks who choose to put their +specs in a different directory (John Feminella).

          +
        • +

          Add some logic to test time duration precision. Make it a function of +time, dropping precision as the time increases. (Aaron Kromer)

          +
        • +

          Add new backtrace_inclusion_patterns config option. Backtrace +lines that match one of these patterns will always be included in +the backtrace, even if they match an exclusion pattern, too (Sam Phippen).

          +
        • +

          Support ERB trim mode using the - when parsing +.rspec as ERB (Gabor Garami).

          +
        • +

          Give a better error message when let and subject are called without a +block. (Sam Phippen).

          +
        • +

          List the precedence of .rspec-local in the configuration +documentation (Sam Phippen)

          +
        • +

          Support {a,b} shell expansion syntax in --pattern +option (Konstantin Haase).

          +
        • +

          Add cucumber documentation for –require command line option (Bradley +Schaefer)

          +
        • +

          Expose configuration options via config:

          +
        • +

          config.libs returns the libs configured to be added onto the +load path

          +
        • +

          full_backtrace? returns the state of the backtrace cleaner

          +
        • +

          debug? returns true when the debugger is loaded

          +
        • +

          line_numbers returns the line numbers we are filtering by (if +any)

          +
        • +

          full_description returns the RegExp used to filter +descriptions (Jon Rowe)

          +
        • +

          Add setters for RSpec.world and RSpec.configuration (Alex Soulim)

          +
        • +

          Configure ruby's warning behaviour with --warnings (Jon +Rowe)

          +
        • +

          Fix an obscure issue on old versions of 1.8.7 where +Time.dup wouldn't allow access to Time.now +(Jon Rowe)

          +
        • +

          Make shared_examples_for context aware, so that keys may be +safely reused in multiple contexts without colliding. (Jon Rowe)

          +
        • +

          Add a configurable deprecation_stream (Jon Rowe)

          +
        • +

          Publish deprecations through a formatter (David Chelimsky)

          +
        + +

        Bug fixes

        +
        • +

          Make JSON formatter behave the same when it comes to --profile +as the text formatter (Paweł Gościcki).

          +
        • +

          Fix named subjects so that if an inner group defines a method that +overrides the named method, subject still retains the +originally declared value (Myron Marston).

          +
        • +

          Fix random ordering so that it does not cause rand in examples +in nested sibling contexts to return the same value (Max Shytikov).

          +
        • +

          Use the new backtrace_inclusion_patterns config option to +ensure that folks who develop code in a directory matching one of the +default exclusion patterns (e.g. gems) still get the normal +backtrace filtering (Sam Phippen).

          +
        • +

          Fix ordering of before hooks so that before hooks +declared in RSpec.configure run before before +hooks declared in a shared context (Michi Huber and Tejas Dinkar).

          +
        • +

          Fix Example#full_description so that it gets filled in by the +last matcher description (as Example#description already did) +when no doc string has been provided (David Chelimsky).

          +
        • +

          Fix the memoized methods (let and subject) +leaking define_method as a public method. +(Thomas Holmes and Jon Rowe) (#873)

          +
        • +

          Fix warnings coming from the test suite. (Pete Higgins)

          +
        + +

        Deprecations

        +
        • +

          Deprecate Configuration#backtrace_clean_patterns in favor of +Configuration#backtrace_exclusion_patterns for greater +consistency and symmetry with new +backtrace_inclusion_patterns config option (Sam Phippen).

          +
        • +

          Deprecate Configuration#requires= in favor of using ruby's +require. Requires specified by the command line can still be +accessed by the Configuration#require reader. (Bradley +Schaefer)

          +
        • +

          Deprecate calling SharedExampleGroups defined across sibling +contexts (Jon Rowe)

          +
        + +

        2.13.1 / 2013-03-12

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Use hook classes as proxies rather than extending hook blocks to support +lambdas for before/after/around hooks. (David Chelimsky)

          +
        • +

          Fix regression in 2.13.0 that caused confusing behavior when overriding a +named subject with an unnamed subject in an inner group and then +referencing the outer group subject's name. The fix for this required +us to disallow using super in a named subject (which is +confusing, anyway – named subjects create 2 methods, so which method on +the parent example group are you supering to?) but +super in an unnamed subject continues to work (Myron +Marston).

          +
        • +

          Do not allow a referenced let or subject in +before(:all) to cause other let declarations to +leak across examples (Myron Marston).

          +
        • +

          Work around odd ruby 1.9 bug with String#match that was +triggered by passing it a regex from a let declaration. For +more info, see bugs.ruby-lang.org/issues/8059 +(Aaron Kromer).

          +
        • +

          Add missing require 'set' to +base_text_formatter.rb (Tom Anderson).

          +
        + +

        Deprecations

        +
        • +

          Deprecate accessing let or subject declarations +in before(:all). These were not intended to be called in a +before(:all) hook, as they exist to define state that is +reset between each example, while before(:all) exists to +define state that is shared across examples in an example group (Myron +Marston).

          +
        + +

        2.13.0 / 2013-02-23

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Allow --profile option to take a count argument that +determines the number of slow examples to dump (Greggory Rothmeier).

          +
        • +

          Add subject! that is the analog to let!. It +defines an explicit subject and sets a before hook that will +invoke the subject (Zubin Henner).

          +
        • +

          Fix let and subject declaration so that +super and return can be used in them, just like +in a normal method. (Myron Marston)

          +
        • +

          Allow output colors to be configured individually. (Charlie Maffitt)

          +
        • +

          Always dump slow examples when --profile option is given, +even when an example failed (Myron Marston).

          +
        + +

        Bug fixes

        +
        • +

          Don't blow up when dumping error output for instances of anonymous +error classes (Myron Marston).

          +
        • +

          Fix default backtrace filters so lines from projects containing “gems” in +the name are not filtered, but lines from installed gems still are (Myron +Marston).

          +
        • +

          Fix autotest command so that is uses double quotes rather than single +quotes for windows compatibility (Jonas Tingeborn).

          +
        • +

          Fix its so that uses of subject in a +before or let declaration in the parent group +continue to reference the parent group's subject. (Olek Janiszewski)

          +
        + +

        2.12.2 / 2012-12-13

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix RSpec::Core::RakeTask so that it is compatible with rake +0.8.7 on ruby 1.8.7. We had accidentally broke it in the 2.12 release +(Myron Marston).

          +
        • +

          Fix RSpec::Core::RakeTask so it is tolerant of the +Rspec constant for backwards compatibility (Patrick Van Stee)

          +
        + +

        2.12.1 / 2012-12-01

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Specs are run even if another at_exit hook calls exit. This +allows Test::Unit and RSpec to run together. (Suraj N. Kurapati)

          +
        • +

          Fix full doc string concatenation so that it handles the case of a method +string (e.g. “#foo”) being nested under a context string (e.g. “when it is +tuesday”), so that we get “when it is tuesday #foo” rather than “when it +is tuesday#foo”. (Myron Marston)

          +
        • +

          Restore public API I unintentionally broke in 2.12.0: +RSpec::Core::Formatters::BaseFormatter#format_backtrce(backtrace, +example) (Myron Marston).

          +
        + +

        2.12.0 / 2012-11-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Add support for custom ordering strategies for groups and examples. (Myron +Marston)

          +
        • +

          JSON Formatter (Alex Chaffee)

          +
        • +

          Refactor rake task internals (Sam Phippen)

          +
        • +

          Refactor HtmlFormatter (Pete Hodgson)

          +
        • +

          Autotest supports a path to Ruby that contains spaces (dsisnero)

          +
        • +

          Provide a helpful warning when a shared example group is redefined. (Mark +Burns).

          +
        • +

          --default_path can be specified as +--default-line. --line_number can be specified +as --line-number. Hyphens are more idiomatic command line +argument separators (Sam Phippen).

          +
        • +

          A more useful error message is shown when an invalid command line option is +used (Jordi Polo).

          +
        • +

          Add format_docstrings { |str| } config option. It can be used +to apply formatting rules to example group and example docstrings. (Alex +Tan)

          +
        • +

          Add support for an .rspec-local options file. This is intended +to allow individual developers to set options in a git-ignored file that +override the common project options in .rspec. (Sam Phippen)

          +
        • +

          Support for mocha 0.13.0. (Andy Lindeman)

          +
        + +

        Bug fixes

        +
        • +

          Remove override of ExampleGroup#ancestors. This is a core ruby +method that RSpec shouldn't override. Instead, define +ExampleGroup#parent_groups. (Myron Marston)

          +
        • +

          Limit monkey patching of shared example/context declaration methods +(shared_examples_for, etc.) to just the objects that need it +rather than every object in the system (Myron Marston).

          +
        • +

          Fix Metadata#fetch to support computed values (Sam Goldman).

          +
        • +

          Named subject can now be referred to from within subject block in a nested +group (tomykaira).

          +
        • +

          Fix fail_fast so that it properly exits when an error occurs +in a before(:all) hook (Bradley Schaefer).

          +
        • +

          Make the order spec files are loaded consistent, regardless of the order +of the files returned by the OS or the order passed at the command line +(Jo Liss and Sam Phippen).

          +
        • +

          Ensure instance variables from before(:all) are always exposed +from after(:all), even if an error occurs in +before(:all) (Sam Phippen).

          +
        • +

          rspec --init no longer generates an incorrect warning about +--configure being deprecated (Sam Phippen).

          +
        • +

          Fix pluralization of 1 seconds (Odin Dutton)

          +
        • +

          Fix ANSICON url (Jarmo Pertman)

          +
        • +

          Use dup of Time so reporting isn't clobbered by examples that modify +Time without properly restoring it. (David Chelimsky)

          +
        + +

        Deprecations

        +
        • +

          share_as is no longer needed. shared_context +and/or RSpec::SharedContext provide better mechanisms (Sam +Phippen).

          +
        • +

          Deprecate RSpec.configuration with a block (use +RSpec.configure).

          +
        + +

        2.11.1 / 2012-07-18

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix the way we autoload RSpec::Matchers so that custom matchers can be +defined before rspec-core has been configured to definitely use +rspec-expectations. (Myron Marston)

          +
        • +

          Fix typo in –help message printed for -e option. (Jo Liss)

          +
        • +

          Fix ruby warnings. (Myron Marston)

          +
        • +

          Ignore mock expectation failures when the example has already failed. Mock +expectation failures have always been ignored in this situation, but due +to my changes in 27059bf1 it was printing a confusing message. (Myron +Marston).

          +
        + +

        2.11.0 / 2012-07-07

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Support multiple --example options. (Daniel Doubrovkine +@dblock)

          +
        • +

          Named subject e.g. subject(:article) { Article.new }

          + +
        • +

          config.mock_with and config.expect_with yield +custom config object to a block if given

          +
          • +

            aids decoupling from rspec-core's configuation

            +
          +
        • +

          include_context and include_examples support a +block, which gets eval'd in the current context (vs the nested context +generated by it_behaves_like).

          +
        • +

          Add config.order = 'random' to the +spec_helper.rb generated by rspec --init.

          +
        • +

          Delay the loading of DRb (Myron Marston).

          +
        • +

          Limit monkey patching of describe onto just the objects that +need it rather than every object in the system (Myron Marston).

          +
        + +

        Bug fixes

        +
        • +

          Support alternative path separators. For example, on Windows, you can now +do this: rspec spec\subdir. (Jarmo Pertman @jarmo)

          +
        • +

          When an example raises an error and an after or around hook does as well, +print out the hook error. Previously, the error was silenced and the user +got no feedback about what happened. (Myron Marston)

          +
        • +

          --require and -I are merged among different +configuration sources (Andy Lindeman)

          +
        • +

          Delegate to mocha methods instead of aliasing them in mocha adapter.

          +
        + +

        2.10.1 / 2012-05-19

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          RSpec.reset properly reinits configuration and world

          +
        • +

          Call to_s before split on exception messages that +might not always be Strings (slyphon)

          +
        + +

        2.10.0 / 2012-05-03

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Add prepend_before and append_after hooks +(preethiramdev)

          +
          • +

            intended for extension libs

            +
          • +

            restores rspec-1 behavior

            +
          +
        • +

          Reporting of profiled examples (moro)

          +
          • +

            Report the total amount of time taken for the top slowest examples.

            +
          • +

            Report what percentage the slowest examples took from the total runtime.

            +
          +
        + +

        Bug fixes

        +
        • +

          Properly parse SPEC_OPTS options.

          +
        • +

          example.description returns the location of the example if +there is no explicit description or matcher-generated description.

          +
        • +

          RDoc fixes (Grzegorz Świrski)

          +
        • +

          Do not modify example ancestry when dumping errors (Michael Grosser)

          +
        + +

        2.9.0 / 2012-03-17

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Support for “X minutes X seconds” spec run duration in formatter. (uzzz)

          +
        • +

          Strip whitespace from group and example names in doc formatter.

          +
        • +

          Removed spork-0.9 shim. If you're using spork-0.8.x, you'll need to +upgrade to 0.9.0.

          +
        + +

        Bug fixes

        +
        • +

          Restore --full_backtrace option

          +
        • +

          Ensure that values passed to config.filter_run are respected +when running over DRb (using spork).

          +
        • +

          Ensure shared example groups are reset after a run (as example groups are).

          +
        • +

          Remove rescue false from calls to filters represented as Procs

          +
        • +

          Ensure described_class gets the closest constant (pyromaniac)

          +
        • +

          In “autorun”, don't run the specs in the at_exit hook if +there was an exception (most likely due to a SyntaxError). (sunaku)

          +
        • +

          Don't extend groups with modules already used to extend ancestor +groups.

          +
        • +

          its correctly memoizes nil or false values (Yamada Masaki)

          +
        + +

        2.8.0 / 2012-01-04

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          For metadata filtering, restore passing the entire array to the proc, +rather than each item in the array (weidenfreak)

          +
        • +

          Ensure each spec file is loaded only once

          +
          • +

            Fixes a bug that caused all the examples in a file to be run when +referenced twice with line numbers in a command, e.g.

            +
            • +

              rspec path/to/file:37 path/to/file:42

              +
            +
          +
        + +

        2.8.0.rc2 / 2011-12-19

        + +

        Full +Changelog

        + +

        Enhancments

        +
        • +

          new --init command (Peter Schröder)

          +
          • +

            generates spec/spec_helper.rb

            +
          • +

            deletes obsolete files (on confirmation)

            +
          • +

            merged with and deprecates --configure command, which +generated .rspec

            +
          +
        • +

          use require_relative when available (Ian Leitch)

          +
        • +

          include_context and include_examples accept +params (Calvin Bascom)

          +
        • +

          print the time for every example in the html formatter (Richie Vos)

          +
        • +

          several tasty refactoring niblets (Sasha)

          +
        • +

          `it “does something”, :x => [:foo,'bar',/baz/] (Ivan Neverov)

          +
          • +

            supports matching n command line tag values with an example or group

            +
          +
        + +

        2.8.0.rc1 / 2011-11-06

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          --order (Justin Ko)

          +
          • +

            run examples in random order: --order rand

            +
          • +

            specify the seed: --order rand:123

            +
          +
        • +

          --seed SEED

          +
          • +

            equivalent of --order rand:SEED

            +
          +
        • +

          SharedContext supports let (David Chelimsky)

          +
        • +

          Filter improvements (David Chelimsky)

          +
          • +

            override opposing tags from the command line

            +
          • +

            override RSpec.configure tags from the command line

            +
          • +

            --line_number 37 overrides all other filters

            +
          • +

            path/to/file.rb:37 overrides all other filters

            +
          • +

            refactor: consolidate filter management in a FilterManger object

            +
          +
        • +

          Eliminate Ruby warnings (Matijs van Zuijlen)

          +
        • +

          Make reporter.report an API (David Chelimsky)

          +
          • +

            supports extension tools like interative_rspec

            +
          +
        + +

        Changes

        +
        • +

          change config.color_enabled (getter/setter/predicate) to +color to align with --[no]-color CLI option.

          +
          • +

            color_enabled is still supported for now, but will likley be +deprecated in a 2.x release so we can remove it in 3.0.

            +
          +
        + +

        Bug fixes

        +
        • +

          Make sure the bar in --tag foo:bar makes it to +DRb (Aaron Gibralter)

          +
        • +

          Fix bug where full descriptions of groups nested 3 deep were repeated.

          +
        • +

          Restore report of time to run to start after files are loaded.

          +
          • +

            fixes bug where run times were cumalitive in spork

            +
          • +

            fixes compatibility with time-series metrics

            +
          • +

            fixes bug where run times were cumalitive in spork

            +
          • +

            fixes compatibility with time-series metrics

            +
          +
        • +

          Don't error out when config.mock_with or +expect_with is re-specifying the current config (Myron +Marston)

          +
        • +

          Deprecations

          +
          • +

            :alias option on configuration.add_setting. Use +:alias_with on the original setting declaration instead.

            +
          +
        + +

        2.7.1 / 2011-10-20

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          tell autotest the correct place to find the rspec executable

          +
        + +

        2.7.0 / 2011-10-16

        + +

        Full +Changelog

        + +

        NOTE: RSpec's release policy dictates that there should not be any +backward incompatible changes in minor releases, but we're making an +exception to release a change to how RSpec interacts with other command +line tools.

        + +

        As of 2.7.0, you must explicity require +"rspec/autorun" unless you use the rspec +command (which already does this for you).

        + +

        Enhancements

        +
        • +

          Add example.exception (David Chelimsky)

          +
        • +

          --default_path command line option (Justin Ko)

          +
        • +

          support multiple --line_number options (David J. Hamilton)

          +
          • +

            also supports path/to/file.rb:5:9 (runs examples on lines 5 +and 9)

            +
          +
        • +

          Allow classes/modules to be used as shared example group identifiers +(Arthur Gunn)

          +
        • +

          Friendly error message when shared context cannot be found (Sławosz +Sławiński)

          +
        • +

          Clear formatters when resetting config (John Bintz)

          +
        • +

          Add xspecify and xexample as temp-pending methods (David +Chelimsky)

          +
        • +

          Add --no-drb option (Iain Hecker)

          +
        • +

          Provide more accurate run time by registering start time before code is +loaded (David Chelimsky)

          +
          • +

            reverted in 2.8.0

            +
          +
        • +

          Rake task default pattern finds specs in symlinked dirs (Kelly Felkins)

          +
        • +

          Rake task no longer does anything to invoke bundler since Bundler already +handles it for us. Thanks to Andre Arko for the tip.

          +
        • +

          Add --failure-exit-code option (Chris Griego)

          +
        + +

        Bug fixes

        +
        • +

          Include Rake::DSL to remove deprecation warnings in Rake > +0.8.7 (Pivotal Casebook)

          +
        • +

          Only eval let block once even if it returns nil +(Adam Meehan)

          +
        • +

          Fix --pattern option (wasn't being recognized) (David +Chelimsky)

          +
        • +

          Only implicitly require "rspec/autorun" with the +rspec command (David Chelimsky)

          +
        • +

          Ensure that rspec's at_exit defines the exit code (Daniel +Doubrovkine)

          +
        • +

          Show the correct snippet in the HTML and TextMate formatters (Brian +Faherty)

          +
        + +

        2.6.4 / 2011-06-06

        + +

        Full +Changelog

        + +

        NOTE: RSpec's release policy dictates that there should not be new +functionality in patch releases, but this minor enhancement slipped in by +accident. As it doesn't add a new API, we decided to leave it in rather +than roll back this release.

        + +

        Enhancements

        +
        • +

          Add summary of commands to run individual failed examples.

          +
        + +

        Bug fixes

        +
        • +

          Support exclusion filters in DRb. (Yann Lugrin)

          +
        • +

          Fix –example escaping when run over DRb. (Elliot Winkler)

          +
        • +

          Use standard ANSI codes for color formatting so colors work in a wider set +of color schemes.

          +
        + +

        2.6.3 / 2011-05-24

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Explicitly convert exit code to integer, avoiding TypeError when return +value of run is IO object proxied by DRb::DRbObject (Julian +Scheid)

          +
        • +

          Clarify behavior of --example command line option

          +
        • +

          Build using a rubygems-1.6.2 to avoid downstream yaml parsing error

          +
        + +

        2.6.2 / 2011-05-21

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Warn rather than raise when HOME env var is not defined

          +
        • +

          Properly merge command-line exclusions with default :if and :unless +(joshcooper)

          +
        + +

        2.6.1 / 2011-05-19

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Don't extend nil when filters are nil

          +
        • +

          require 'rspec/autorun' when running rcov.

          +
        + +

        2.6.0 / 2011-05-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          shared_context (Damian Nurzynski)

          +
          • +

            extend groups matching specific metadata with:

            +
            • +

              method definitions

              +
            • +

              subject declarations

              +
            • +

              let/let! declarations

              +
            • +

              etc (anything you can do in a group)

              +
            +
          +
        • +

          its([:key]) works for any subject with #[]. (Peter Jaros)

          +
        • +

          treat_symbols_as_metadata_keys_with_true_values (Myron +Marston)

          +
        • +

          Print a deprecation warning when you configure RSpec after defining an +example. All configuration should happen before any examples are defined. +(Myron Marston)

          +
        • +

          Pass the exit status of a DRb run to the invoking process. This causes +specs run via DRb to not just return true or false. (Ilkka Laukkanen)

          +
        • +

          Refactoring of ConfigurationOptions#parse_options (Rodrigo +Rosenfeld Rosas)

          +
        • +

          Report excluded filters in runner output (tip from andyl)

          +
        • +

          Clean up messages for filters/tags.

          +
        • +

          Restore –pattern/-P command line option from rspec-1

          +
        • +

          Support false as well as true in config.full_backtrace= (Andreas Tolf +Tolfsen)

          +
        + +

        Bug fixes

        +
        • +

          Don't stumble over an exception without a message (Hans Hasselberg)

          +
        • +

          Remove non-ascii characters from comments that were choking rcov (Geoffrey +Byers)

          +
        • +

          Fixed backtrace so it doesn't include lines from before the autorun +at_exit hook (Myron Marston)

          +
        • +

          Include RSpec::Matchers when first example group is defined, rather than +just before running the examples. This works around an obscure bug in ruby +1.9 that can cause infinite recursion. (Myron Marston)

          +
        • +

          Don't send example_group_[started|finished] to formatters +for empty groups.

          +
        • +

          Get specs passing on jruby (Sidu Ponnappa)

          +
        • +

          Fix bug where mixing nested groups and outer-level examples gave +unpredictable :line_number behavior (Artur Małecki)

          +
        • +

          Regexp.escape the argument to –example (tip from Elliot Winkler)

          +
        • +

          Correctly pass/fail pending block with message expectations

          +
        • +

          CommandLine returns exit status (0/1) instead of true/false

          +
        • +

          Create path to formatter output file if it doesn't exist (marekj).

          +
        + +

        2.5.1 / 2011-02-06

        + +

        Full +Changelog

        + +

        NOTE: this release breaks compatibility with rspec/autotest/bundler +integration, but does so in order to greatly simplify it.

        + +

        With this release, if you want the generated autotest command to include +'bundle exec', require Autotest's bundler plugin in a .autotest +file in the project's root directory or in your home directory:

        + +
        require "autotest/bundler"
        +
        + +

        Now you can just type 'autotest' on the commmand line and it will +work as you expect.

        + +

        If you don't want 'bundle exec', there is nothing you have to +do.

        + +

        2.5.0 / 2011-02-05

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Autotest::Rspec2 parses command line args passed to autotest after +'–'

          +
        • +

          –skip-bundler option for autotest command

          +
        • +

          Autotest regexp fixes (Jon Rowe)

          +
        • +

          Add filters to html and textmate formatters (Daniel Quimper)

          +
        • +

          Explicit passing of block (need for JRuby 1.6) (John Firebaugh)

          +
        + +

        Bug fixes

        +
        • +

          fix dom IDs in HTML formatter (Brian Faherty)

          +
        • +

          fix bug with –drb + formatters when not running in drb

          +
        • +

          include –tag options in drb args (monocle)

          +
        • +

          fix regression so now SPEC_OPTS take precedence over CLI options again +(Roman Chernyatchik)

          +
        • +

          only call its(:attribute) once (failing example from Brian Dunn)

          +
        • +

          fix bizarre bug where rspec would hang after String.alias :to_int :to_i +(Damian Nurzynski)

          +
        + +

        Deprecations

        +
        • +

          implicit inclusion of 'bundle exec' when Gemfile present (use +autotest's bundler plugin instead)

          +
        + +

        2.4.0 / 2011-01-02

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          start the debugger on -d so the stack trace is visible when it stops +(Clifford Heath)

          +
        • +

          apply hook filtering to examples as well as groups (Myron Marston)

          +
        • +

          support multiple formatters, each with their own output

          +
        • +

          show exception classes in failure messages unless they come from RSpec +matchers or message expectations

          +
        • +

          before(:all) { pending } sets all examples to pending

          +
        + +

        Bug fixes

        +
        • +

          fix bug due to change in behavior of reject in Ruby 1.9.3-dev (Shota +Fukumori)

          +
        • +

          fix bug when running in jruby: be explicit about passing block to super +(John Firebaugh)

          +
        • +

          rake task doesn't choke on paths with quotes (Janmejay Singh)

          +
        • +

          restore –options option from rspec-1

          +
        • +

          require 'ostruct' to fix bug with its() (Kim +Burgestrand)

          +
        • +

          –configure option generates .rspec file instead of autotest/discover.rb

          +
        + +

        2.3.1 / 2010-12-16

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          send debugger warning message to $stdout if +RSpec.configuration.error_stream has not been defined yet.

          +
        • +

          HTML Formatter finally properly displays nested groups (Jarmo +Pertman)

          +
        • +

          eliminate some warnings when running RSpec's own suite (Jarmo Pertman)

          +
        + +

        2.3.0 / 2010-12-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          tell autotest to use “rspec2” if it sees a .rspec file in the project's +root directory

          +
          • +

            replaces the need for ./autotest/discover.rb, which will not work with all +versions of ZenTest and/or autotest

            +
          +
        • +

          config.expect_with

          +
          • +

            :rspec # => rspec/expectations

            +
          • +

            :stdlib # => test/unit/assertions

            +
          • +

            :rspec, :stdlib # => both

            +
          +
        + +

        Bug fixes

        +
        • +

          fix dev Gemfile to work on non-mac-os machines (Lake Denman)

          +
        • +

          ensure explicit subject is only eval'd once (Laszlo Bacsi)

          +
        + +

        2.2.1 / 2010-11-28

        + +

        Full +Changelog

        + +

        Bug fixes * alias_method instead of override Kernel#method_missing (John +Wilger) * changed –autotest to –tty in generated command (MIKAMI Yoshiyuki) +* revert change to debugger (had introduced conflict with Rails) * also +restored –debugger/-debug option

        + +

        2.2.0 / 2010-11-28

        + +

        Full +Changelog

        + +

        Deprecations/changes

        +
        • +

          –debug/-d on command line is deprecated and now has no effect

          +
        • +

          win32console is now ignored; Windows users must use ANSICON for color +support (Bosko Ivanisevic)

          +
        + +

        Enhancements

        +
        • +

          When developing locally rspec-core now works with the rspec-dev setup or +your local gems

          +
        • +

          Raise exception with helpful message when rspec-1 is loaded alongside +rspec-2 (Justin Ko)

          +
        • +

          debugger statements just work as long as ruby-debug is installed

          +
        • +

          otherwise you get warned, but not fired

          +
        • +

          Expose example.metadata in around hooks

          +
        • +

          Performance improvments (much faster now)

          +
        + +

        Bug fixes

        +
        • +

          Make sure –fail-fast makes it across drb

          +
        • +

          Pass -Ilib:spec to rcov

          +
        + +

        2.1.0 / 2010-11-07

        + +

        Full +Changelog

        + +

        Enhancments

        +
        • +

          Add skip_bundler option to rake task to tell rake task to ignore the +presence of a Gemfile (jfelchner)

          +
        • +

          Add gemfile option to rake task to tell rake task what Gemfile to look for +(defaults to 'Gemfile')

          +
        • +

          Allow passing caller trace into Metadata to support extensions (Glenn +Vanderburg)

          +
        • +

          Add deprecation warning for Spec::Runner.configure to aid upgrade from +RSpec-1

          +
        • +

          Add deprecated Spec::Rake::SpecTask to aid upgrade from RSpec-1

          +
        • +

          Add 'autospec' command with helpful message to aid upgrade from +RSpec-1

          +
        • +

          Add support for filtering with tags on CLI (Lailson Bandeira)

          +
        • +

          Add a helpful message about RUBYOPT when require fails in bin/rspec +(slyphon)

          +
        • +

          Add “-Ilib” to the default rcov options (Tianyi Cui)

          +
        • +

          Make the expectation framework configurable (default rspec, of course) +(Justin Ko)

          +
        • +

          Add 'pending' to be conditional (Myron Marston)

          +
        • +

          Add explicit support for :if and :unless as metadata keys for conditional +run of examples (Myron Marston)

          +
        • +

          Add –fail-fast command line option (Jeff Kreeftmeijer)

          +
        + +

        Bug fixes

        +
        • +

          Eliminate stack overflow with “subject { self }”

          +
        • +

          Require 'rspec/core' in the Raketask (ensures it required when +running rcov)

          +
        + +

        2.0.1 / 2010-10-18

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Restore color when using spork + autotest

          +
        • +

          Pending examples without docstrings render the correct message (Josep M. +Bach)

          +
        • +

          Fixed bug where a failure in a spec file ending in anything but _spec.rb +would fail in a confusing way.

          +
        • +

          Support backtrace lines from erb templates in html formatter (Alex +Crichton)

          +
        + +

        2.0.0 / 2010-10-10

        + +

        Full +Changelog

        + +

        RSpec-1 compatibility

        +
        • +

          Rake task uses ENV as file list if present

          +
        + +

        Bug fixes

        +
        • +

          Bug Fix: optparse –out foo.txt (Leonardo Bessa)

          +
        • +

          Suppress color codes for non-tty output (except autotest)

          +
        + +

        2.0.0.rc / 2010-10-05

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          implicitly require unknown formatters so you don't have to require the +file explicitly on the commmand line (Michael Grosser)

          +
        • +

          add –out/-o option to assign output target

          +
        • +

          added fail_fast configuration option to abort on first failure

          +
        • +

          support a Hash subject (its() { should == value }) +(Josep M. Bach)

          +
        + +

        Bug fixes

        +
        • +

          Explicitly require rspec version to fix broken rdoc task (Hans de Graaff)

          +
        • +

          Ignore backtrace lines that come from other languages, like Java or +Javascript (Charles Lowell)

          +
        • +

          Rake task now does what is expected when setting (or not setting) +fail_on_error and verbose

          +
        • +

          Fix bug in which before/after(:all) hooks were running on excluded nested +groups (Myron Marston)

          +
        • +

          Fix before(:all) error handling so that it fails examples in nested groups, +too (Myron Marston)

          +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          removed at_exit hook

          +
        • +

          CTRL-C stops the run (almost) immediately

          +
          • +

            first it cleans things up by running the appropriate after(:all) and +after(:suite) hooks

            +
          • +

            then it reports on any examples that have already run

            +
          +
        • +

          cleaned up rake task

          +
          • +

            generate correct task under variety of conditions

            +
          • +

            options are more consistent

            +
          • +

            deprecated redundant options

            +
          +
        • +

          run 'bundle exec autotest' when Gemfile is present

          +
        • +

          support ERB in .rspec options files (Justin Ko)

          +
        • +

          depend on bundler for development tasks (Myron Marston)

          +
        • +

          add example_group_finished to formatters and reporter (Roman Chernyatchik)

          +
        + +

        Bug fixes

        +
        • +

          support paths with spaces when using autotest (Andreas Neuhaus)

          +
        • +

          fix module_exec with ruby 1.8.6 (Myron Marston)

          +
        • +

          remove context method from top-level

          +
          • +

            was conflicting with irb, for example

            +
          +
        • +

          errors in before(:all) are now reported correctly (Chad Humphries)

          +
        + +

        Removals

        +
        • +

          removed -o –options-file command line option

          +
          • +

            use ./.rspec and ~/.rspec

            +
          +
        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/file.License.html b/source/documentation/3.2/rspec-core/file.License.html new file mode 100644 index 000000000..5fc2dc91c --- /dev/null +++ b/source/documentation/3.2/rspec-core/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2012 Chad Humphries, David Chelimsky, Myron Marston
        Copyright (c) 2009 Chad Humphries, David Chelimsky
        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/file.README.html b/source/documentation/3.2/rspec-core/file.README.html new file mode 100644 index 000000000..317da02b4 --- /dev/null +++ b/source/documentation/3.2/rspec-core/file.README.html @@ -0,0 +1,315 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        rspec-core

        + +

        rspec-core provides the structure for writing executable examples of how +your code should behave, and an rspec command with tools to +constrain which examples get run and tailor the output.

        + +

        install

        + +
        gem install rspec      # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-core # for rspec-core only
        +rspec --help
        + +

        basic structure

        + +

        RSpec uses the words “describe” and “it” so we can express concepts like a +conversation:

        + +
        "Describe an order."
        +"It sums the prices of its line items."
        + +
        RSpec.describe Order do
        +  it "sums the prices of its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        The describe method creates an ExampleGroup. +Within the block passed to describe you can declare examples +using the it method.

        + +

        Under the hood, an example group is a class in which the block passed to +describe is evaluated. The blocks passed to it +are evaluated in the context of an instance of that class.

        + +

        nested groups

        + +

        You can also declare nested nested groups using the describe +or context methods:

        + +
        RSpec.describe Order do
        +  context "with no items" do
        +    it "behaves one way" do
        +      # ...
        +    end
        +  end
        +
        +  context "with one item" do
        +    it "behaves another way" do
        +      # ...
        +    end
        +  end
        +end
        +
        + +

        aliases

        + +

        You can declare example groups using either describe or +context. For a top level example group, describe +and context are available off of RSpec. For +backwards compatibility, they are also available off of the +main object and Module unless you disable monkey +patching.

        + +

        You can declare examples within a group using any of it, +specify, or example.

        + +

        shared examples and contexts

        + +

        Declare a shared example group using shared_examples, and then +include it in any group using include_examples.

        + +
        RSpec.shared_examples "collections" do |collection_class|
        +  it "is empty when first created" do
        +    expect(collection_class.new).to be_empty
        +  end
        +end
        +
        +RSpec.describe Array do
        +  include_examples "collections", Array
        +end
        +
        +RSpec.describe Hash do
        +  include_examples "collections", Hash
        +end
        +
        + +

        Nearly anything that can be declared within an example group can be +declared within a shared example group. This includes before, +after, and around hooks, let +declarations, and nested groups/contexts.

        + +

        You can also use the names shared_context and +include_context. These are pretty much the same as +shared_examples and include_examples, providing +more accurate naming when you share hooks, let declarations, +helper methods, etc, but no examples.

        + +

        metadata

        + +

        rspec-core stores a metadata hash with every example and group, which +contains their descriptions, the locations at which they were declared, +etc, etc. This hash powers many of rspec-core's features, including +output formatters (which access descriptions and locations), and filtering +before and after hooks.

        + +

        Although you probably won't ever need this unless you are writing an +extension, you can access it from an example like this:

        + +
        it "does something" do
        +  expect(example.[:description]).to eq("does something")
        +end
        +
        + +

        described_class

        + +

        When a class is passed to describe, you can access it from an +example using the described_class method, which is a wrapper +for example.metadata[:described_class].

        + +
        RSpec.describe Widget do
        +  example do
        +    expect(described_class).to equal(Widget)
        +  end
        +end
        +
        + +

        This is useful in extensions or shared example groups in which the specific +class is unknown. Taking the collections shared example group from above, +we can clean it up a bit using described_class:

        + +
        RSpec.shared_examples "collections" do
        +  it "is empty when first created" do
        +    expect(described_class.new).to be_empty
        +  end
        +end
        +
        +RSpec.describe Array do
        +  include_examples "collections"
        +end
        +
        +RSpec.describe Hash do
        +  include_examples "collections"
        +end
        +
        + +

        the rspec command

        + +

        When you install the rspec-core gem, it installs the rspec +executable, which you'll use to run rspec. The rspec +command comes with many useful options. Run rspec --help to +see the complete list.

        + +

        store command line options .rspec

        + +

        You can store command line options in a .rspec file in the +project's root directory, and the rspec command will read +them as though you typed them on the command line.

        + +

        autotest integration

        + +

        rspec-core no longer ships with an Autotest extension, if you require +Autotest integration, please use the rspec-autotest gem and +see rspec/rspec-autotest for +details

        + +

        get started

        + +

        Start with a simple example of behavior you expect from your system. Do +this before you write any implementation code:

        + +
        # in spec/calculator_spec.rb
        +RSpec.describe Calculator do
        +  describe '#add' do
        +    it 'returns the sum of its arguments' do
        +      expect(Calculator.new.add(1, 2)).to eq(3)
        +    end
        +  end
        +end
        +
        + +

        Run this with the rspec command, and watch it fail:

        + +
        $ rspec spec/calculator_spec.rb
        +./spec/calculator_spec.rb:1: uninitialized constant Calculator
        + +

        Implement the simplest solution:

        + +
        # in lib/calculator.rb
        +class Calculator
        +  def add(a,b)
        +    a + b
        +  end
        +end
        +
        + +

        Be sure to require the implementation file in the spec:

        + +
        # in spec/calculator_spec.rb
        +# - RSpec adds ./lib to the $LOAD_PATH
        +require "calculator"
        +
        + +

        Now run the spec again, and watch it pass:

        + +
        $ rspec spec/calculator_spec.rb
        +.
        +
        +Finished in 0.000315 seconds
        +1 example, 0 failures
        + +

        Use the documentation formatter to see the resulting spec:

        + +
        $ rspec spec/calculator_spec.rb --format doc
        +Calculator
        +  #add
        +    returns the sum of its arguments
        +
        +Finished in 0.000379 seconds
        +1 example, 0 failures
        + +

        Also see

        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/file_list.html b/source/documentation/3.2/rspec-core/file_list.html new file mode 100644 index 000000000..4fbe39987 --- /dev/null +++ b/source/documentation/3.2/rspec-core/file_list.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-core/frames.html b/source/documentation/3.2/rspec-core/frames.html new file mode 100644 index 000000000..87a4a6df1 --- /dev/null +++ b/source/documentation/3.2/rspec-core/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + diff --git a/source/documentation/3.2/rspec-core/index.html b/source/documentation/3.2/rspec-core/index.html new file mode 100644 index 000000000..317da02b4 --- /dev/null +++ b/source/documentation/3.2/rspec-core/index.html @@ -0,0 +1,315 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        rspec-core

        + +

        rspec-core provides the structure for writing executable examples of how +your code should behave, and an rspec command with tools to +constrain which examples get run and tailor the output.

        + +

        install

        + +
        gem install rspec      # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-core # for rspec-core only
        +rspec --help
        + +

        basic structure

        + +

        RSpec uses the words “describe” and “it” so we can express concepts like a +conversation:

        + +
        "Describe an order."
        +"It sums the prices of its line items."
        + +
        RSpec.describe Order do
        +  it "sums the prices of its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        The describe method creates an ExampleGroup. +Within the block passed to describe you can declare examples +using the it method.

        + +

        Under the hood, an example group is a class in which the block passed to +describe is evaluated. The blocks passed to it +are evaluated in the context of an instance of that class.

        + +

        nested groups

        + +

        You can also declare nested nested groups using the describe +or context methods:

        + +
        RSpec.describe Order do
        +  context "with no items" do
        +    it "behaves one way" do
        +      # ...
        +    end
        +  end
        +
        +  context "with one item" do
        +    it "behaves another way" do
        +      # ...
        +    end
        +  end
        +end
        +
        + +

        aliases

        + +

        You can declare example groups using either describe or +context. For a top level example group, describe +and context are available off of RSpec. For +backwards compatibility, they are also available off of the +main object and Module unless you disable monkey +patching.

        + +

        You can declare examples within a group using any of it, +specify, or example.

        + +

        shared examples and contexts

        + +

        Declare a shared example group using shared_examples, and then +include it in any group using include_examples.

        + +
        RSpec.shared_examples "collections" do |collection_class|
        +  it "is empty when first created" do
        +    expect(collection_class.new).to be_empty
        +  end
        +end
        +
        +RSpec.describe Array do
        +  include_examples "collections", Array
        +end
        +
        +RSpec.describe Hash do
        +  include_examples "collections", Hash
        +end
        +
        + +

        Nearly anything that can be declared within an example group can be +declared within a shared example group. This includes before, +after, and around hooks, let +declarations, and nested groups/contexts.

        + +

        You can also use the names shared_context and +include_context. These are pretty much the same as +shared_examples and include_examples, providing +more accurate naming when you share hooks, let declarations, +helper methods, etc, but no examples.

        + +

        metadata

        + +

        rspec-core stores a metadata hash with every example and group, which +contains their descriptions, the locations at which they were declared, +etc, etc. This hash powers many of rspec-core's features, including +output formatters (which access descriptions and locations), and filtering +before and after hooks.

        + +

        Although you probably won't ever need this unless you are writing an +extension, you can access it from an example like this:

        + +
        it "does something" do
        +  expect(example.[:description]).to eq("does something")
        +end
        +
        + +

        described_class

        + +

        When a class is passed to describe, you can access it from an +example using the described_class method, which is a wrapper +for example.metadata[:described_class].

        + +
        RSpec.describe Widget do
        +  example do
        +    expect(described_class).to equal(Widget)
        +  end
        +end
        +
        + +

        This is useful in extensions or shared example groups in which the specific +class is unknown. Taking the collections shared example group from above, +we can clean it up a bit using described_class:

        + +
        RSpec.shared_examples "collections" do
        +  it "is empty when first created" do
        +    expect(described_class.new).to be_empty
        +  end
        +end
        +
        +RSpec.describe Array do
        +  include_examples "collections"
        +end
        +
        +RSpec.describe Hash do
        +  include_examples "collections"
        +end
        +
        + +

        the rspec command

        + +

        When you install the rspec-core gem, it installs the rspec +executable, which you'll use to run rspec. The rspec +command comes with many useful options. Run rspec --help to +see the complete list.

        + +

        store command line options .rspec

        + +

        You can store command line options in a .rspec file in the +project's root directory, and the rspec command will read +them as though you typed them on the command line.

        + +

        autotest integration

        + +

        rspec-core no longer ships with an Autotest extension, if you require +Autotest integration, please use the rspec-autotest gem and +see rspec/rspec-autotest for +details

        + +

        get started

        + +

        Start with a simple example of behavior you expect from your system. Do +this before you write any implementation code:

        + +
        # in spec/calculator_spec.rb
        +RSpec.describe Calculator do
        +  describe '#add' do
        +    it 'returns the sum of its arguments' do
        +      expect(Calculator.new.add(1, 2)).to eq(3)
        +    end
        +  end
        +end
        +
        + +

        Run this with the rspec command, and watch it fail:

        + +
        $ rspec spec/calculator_spec.rb
        +./spec/calculator_spec.rb:1: uninitialized constant Calculator
        + +

        Implement the simplest solution:

        + +
        # in lib/calculator.rb
        +class Calculator
        +  def add(a,b)
        +    a + b
        +  end
        +end
        +
        + +

        Be sure to require the implementation file in the spec:

        + +
        # in spec/calculator_spec.rb
        +# - RSpec adds ./lib to the $LOAD_PATH
        +require "calculator"
        +
        + +

        Now run the spec again, and watch it pass:

        + +
        $ rspec spec/calculator_spec.rb
        +.
        +
        +Finished in 0.000315 seconds
        +1 example, 0 failures
        + +

        Use the documentation formatter to see the resulting spec:

        + +
        $ rspec spec/calculator_spec.rb --format doc
        +Calculator
        +  #add
        +    returns the sum of its arguments
        +
        +Finished in 0.000379 seconds
        +1 example, 0 failures
        + +

        Also see

        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-core/method_list.html b/source/documentation/3.2/rspec-core/method_list.html new file mode 100644 index 000000000..599a0a758 --- /dev/null +++ b/source/documentation/3.2/rspec-core/method_list.html @@ -0,0 +1,1761 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-core/top-level-namespace.html b/source/documentation/3.2/rspec-core/top-level-namespace.html new file mode 100644 index 000000000..9383e26e6 --- /dev/null +++ b/source/documentation/3.2/rspec-core/top-level-namespace.html @@ -0,0 +1,112 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: RSpec + + + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file From d1f4319f83cf16e5547a43b4bcadd2e6cdb3f94a Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:05:39 +1100 Subject: [PATCH 06/14] link to documentation --- config.rb | 9 +++++++++ source/documentation.html.slim | 13 ++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/config.rb b/config.rb index 3318097d3..c6b64e75d 100644 --- a/config.rb +++ b/config.rb @@ -70,4 +70,13 @@ def asciinema_video(id, speed: 1) | HTML end + + def rspec_documentation + hash = Hash.new { |h,k| h[k] = [] } + Dir["#{root}/source/documentation/*/*"].each do |dir| + version, gem = dir.scan(%r{/source/documentation/([^/]+)/([^/]+)}).first.flatten + hash[gem] << version + end + hash + end end diff --git a/source/documentation.html.slim b/source/documentation.html.slim index 4cf3059d3..cd725defa 100644 --- a/source/documentation.html.slim +++ b/source/documentation.html.slim @@ -17,10 +17,13 @@ section h2 API Documentation p - | You can find detailed API documentation on the Rubydoc.info site: + | You can find detailed API documentation for versions below ul - li= link_to 'http://rubydoc.info/gems/rspec-core', 'http://rubydoc.info/gems/rspec-core' - li= link_to 'http://rubydoc.info/gems/rspec-expectations', 'http://rubydoc.info/gems/rspec-expectations' - li= link_to 'http://rubydoc.info/gems/rspec-mocks', 'http://rubydoc.info/gems/rspec-mocks' - li= link_to 'http://rubydoc.info/gems/rspec-rails', 'http://rubydoc.info/gems/rspec-rails' + - rspec_documentation.each do |gem, versions| + li + b + | #{gem}:  + - versions.sort.reverse.each do |version| + = link_to version, "/documentation/#{version}/#{gem}/" + |   From 2f9ff4059ca2fbcaa1325be217086eaf76b9a48f Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:19:20 +1100 Subject: [PATCH 07/14] rspec-core 2.99 documentation --- .../documentation/2.99/rspec-core/Kernel.html | 186 + .../documentation/2.99/rspec-core/RSpec.html | 670 ++ .../2.99/rspec-core/RSpec/CallerFilter.html | 274 + .../2.99/rspec-core/RSpec/Core.html | 232 + .../RSpec/Core/BacktraceCleaner.html | 583 ++ .../RSpec/Core/BacktraceFormatter.html | 198 + .../rspec-core/RSpec/Core/CommandLine.html | 240 + .../rspec-core/RSpec/Core/Configuration.html | 5919 +++++++++++++++++ .../Configuration/ExposeCurrentExample.html | 105 + ...tBeConfiguredBeforeExampleGroupsError.html | 123 + .../rspec-core/RSpec/Core/DRbCommandLine.html | 322 + .../2.99/rspec-core/RSpec/Core/DSL.html | 213 + .../Core/DeprecatedMutableArrayProxy.html | 200 + .../rspec-core/RSpec/Core/Deprecation.html | 109 + .../2.99/rspec-core/RSpec/Core/Example.html | 926 +++ .../rspec-core/RSpec/Core/Example/Procsy.html | 408 ++ .../rspec-core/RSpec/Core/ExampleGroup.html | 2655 ++++++++ .../DescriptionBehaviorChange.html | 303 + .../rspec-core/RSpec/Core/FilterManager.html | 1301 ++++ .../FilterManager/BackwardCompatibility.html | 362 + .../RSpec/Core/FilterManager/Describable.html | 269 + .../rspec-core/RSpec/Core/Formatters.html | 197 + .../RSpec/Core/Formatters/BaseFormatter.html | 2171 ++++++ .../Core/Formatters/BaseTextFormatter.html | 1275 ++++ .../RSpec/Core/Formatters/ConsoleCodes.html | 273 + .../Core/Formatters/DeprecationFormatter.html | 756 +++ .../DeprecationFormatter/DelayedPrinter.html | 720 ++ .../DeprecationFormatter/FileStream.html | 369 + .../GeneratedDeprecationMessage.html | 218 + .../ImmediatePrinter.html | 540 ++ .../RaiseErrorStream.html | 308 + .../SpecifiedDeprecationMessage.html | 218 + .../Formatters/DocumentationFormatter.html | 860 +++ .../RSpec/Core/Formatters/Helpers.html | 644 ++ .../RSpec/Core/Formatters/HtmlFormatter.html | 1262 ++++ .../RSpec/Core/Formatters/HtmlPrinter.html | 970 +++ .../RSpec/Core/Formatters/JsonFormatter.html | 657 ++ .../RSpec/Core/Formatters/Loader.html | 419 ++ .../Core/Formatters/ProgressFormatter.html | 421 ++ .../Core/Formatters/SnippetExtractor.html | 669 ++ .../SnippetExtractor/NullConverter.html | 211 + .../Core/Formatters/TextMateFormatter.html | 416 ++ .../2.99/rspec-core/RSpec/Core/Hooks.html | 897 +++ .../RSpec/Core/Hooks/AfterAllHook.html | 283 + .../RSpec/Core/Hooks/AfterHook.html | 265 + .../RSpec/Core/Hooks/AroundHook.html | 213 + .../Core/Hooks/AroundHookCollection.html | 320 + .../RSpec/Core/Hooks/BeforeHook.html | 265 + .../RSpec/Core/Hooks/GroupHookCollection.html | 246 + .../rspec-core/RSpec/Core/Hooks/Hook.html | 436 ++ .../RSpec/Core/Hooks/HookCollection.html | 310 + .../Core/Hooks/HookCollectionAliases.html | 109 + .../RSpec/Core/Hooks/RegistersGlobals.html | 182 + .../RSpec/Core/MemoizedHelpers.html | 566 ++ .../Core/MemoizedHelpers/ClassMethods.html | 831 +++ .../2.99/rspec-core/RSpec/Core/Metadata.html | 460 ++ .../Core/Metadata/ExampleMetadataHash.html | 243 + .../Core/Metadata/GroupMetadataHash.html | 611 ++ .../RSpec/Core/MockFrameworkAdapter.html | 401 ++ .../2.99/rspec-core/RSpec/Core/Parser.html | 892 +++ .../2.99/rspec-core/RSpec/Core/Pending.html | 633 ++ .../Core/Pending/SkipDeclaredInExample.html | 285 + .../RSpec/Core/ProjectInitializer.html | 622 ++ .../2.99/rspec-core/RSpec/Core/RakeTask.html | 1578 +++++ .../2.99/rspec-core/RSpec/Core/Reporter.html | 1244 ++++ .../rspec-core/RSpec/Core/RubyProject.html | 438 ++ .../2.99/rspec-core/RSpec/Core/Runner.html | 923 +++ .../rspec-core/RSpec/Core/SharedContext.html | 388 ++ .../RSpec/Core/SharedContext/Recording.html | 388 ++ .../RSpec/Core/SharedExampleGroup.html | 518 ++ .../Core/SharedExampleGroup/Collection.html | 258 + .../Core/SharedExampleGroup/TopLevelDSL.html | 340 + .../2.99/rspec-core/RSpec/Core/Version.html | 117 + .../2.99/rspec-core/RSpec/Core/World.html | 1232 ++++ .../2.99/rspec-core/RSpec/Runner.html | 188 + .../documentation/2.99/rspec-core/_index.html | 790 +++ .../2.99/rspec-core/class_list.html | 58 + .../2.99/rspec-core/file.Changelog.html | 1445 ++++ .../2.99/rspec-core/file.License.html | 73 + .../2.99/rspec-core/file.README.html | 325 + .../2.99/rspec-core/file_list.html | 66 + .../documentation/2.99/rspec-core/frames.html | 26 + .../documentation/2.99/rspec-core/index.html | 325 + .../2.99/rspec-core/method_list.html | 2829 ++++++++ .../2.99/rspec-core/top-level-namespace.html | 144 + 85 files changed, 51935 insertions(+) create mode 100644 source/documentation/2.99/rspec-core/Kernel.html create mode 100644 source/documentation/2.99/rspec-core/RSpec.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/CallerFilter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/BacktraceCleaner.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/BacktraceFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/CommandLine.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Configuration.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Configuration/ExposeCurrentExample.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Configuration/MustBeConfiguredBeforeExampleGroupsError.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/DRbCommandLine.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/DSL.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/DeprecatedMutableArrayProxy.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Deprecation.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Example.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Example/Procsy.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/ExampleGroup.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/ExampleGroup/DescriptionBehaviorChange.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/FilterManager.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/FilterManager/BackwardCompatibility.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/FilterManager/Describable.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/BaseFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/ConsoleCodes.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/DelayedPrinter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/FileStream.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/GeneratedDeprecationMessage.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/ImmediatePrinter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/RaiseErrorStream.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/SpecifiedDeprecationMessage.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DocumentationFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/Helpers.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/HtmlFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/HtmlPrinter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/JsonFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/Loader.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/ProgressFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/SnippetExtractor/NullConverter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Formatters/TextMateFormatter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AfterAllHook.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AfterHook.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AroundHook.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AroundHookCollection.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/BeforeHook.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/GroupHookCollection.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/Hook.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/HookCollection.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/HookCollectionAliases.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Hooks/RegistersGlobals.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/MemoizedHelpers.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Metadata.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Metadata/ExampleMetadataHash.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Metadata/GroupMetadataHash.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/MockFrameworkAdapter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Parser.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Pending.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Pending/SkipDeclaredInExample.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/ProjectInitializer.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/RakeTask.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Reporter.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/RubyProject.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Runner.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/SharedContext.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/SharedContext/Recording.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup/Collection.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/Version.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Core/World.html create mode 100644 source/documentation/2.99/rspec-core/RSpec/Runner.html create mode 100644 source/documentation/2.99/rspec-core/_index.html create mode 100644 source/documentation/2.99/rspec-core/class_list.html create mode 100644 source/documentation/2.99/rspec-core/file.Changelog.html create mode 100644 source/documentation/2.99/rspec-core/file.License.html create mode 100644 source/documentation/2.99/rspec-core/file.README.html create mode 100644 source/documentation/2.99/rspec-core/file_list.html create mode 100644 source/documentation/2.99/rspec-core/frames.html create mode 100644 source/documentation/2.99/rspec-core/index.html create mode 100644 source/documentation/2.99/rspec-core/method_list.html create mode 100644 source/documentation/2.99/rspec-core/top-level-namespace.html diff --git a/source/documentation/2.99/rspec-core/Kernel.html b/source/documentation/2.99/rspec-core/Kernel.html new file mode 100644 index 000000000..2d66642c9 --- /dev/null +++ b/source/documentation/2.99/rspec-core/Kernel.html @@ -0,0 +1,186 @@ + + + + + + Module: Kernel + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: Kernel + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/extensions/kernel.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) debugger(*args) + + + + + + + + + + + + + +

          If not already defined by ruby-debug, this implementation prints helpful message to STDERR when ruby-debug is not loaded.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) debugger(*args) + + + + + +

        +
        +

        If not already defined by ruby-debug, this implementation prints helpful +message to STDERR when ruby-debug is not loaded.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/core/extensions/kernel.rb', line 5
        +
        +def debugger(*args)
        +  (RSpec.configuration.error_stream || $stderr).puts "\n***** debugger statement ignored, use -d or --debug option to enable debugging\n#{caller(0)[1]}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec.html b/source/documentation/2.99/rspec-core/RSpec.html new file mode 100644 index 000000000..047db463c --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec.html @@ -0,0 +1,670 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec + + + +

        + +
        + + + +
        Extended by:
        +
        Core::Deprecation
        + + + + + + + +
        Defined in:
        +
        lib/rspec/core.rb,
        + lib/rspec/core/dsl.rb,
        lib/rspec/core/hooks.rb,
        lib/rspec/core/world.rb,
        lib/rspec/core/runner.rb,
        lib/rspec/core/pending.rb,
        lib/rspec/core/example.rb,
        lib/rspec/core/version.rb,
        lib/rspec/core/metadata.rb,
        lib/rspec/core/rake_task.rb,
        lib/rspec/core/deprecation.rb,
        lib/rspec/core/command_line.rb,
        lib/rspec/core/ruby_project.rb,
        lib/rspec/core/configuration.rb,
        lib/rspec/core/example_group.rb,
        lib/rspec/core/caller_filter.rb,
        lib/rspec/core/shared_context.rb,
        lib/rspec/core/filter_manager.rb,
        lib/rspec/core/mocking/with_rr.rb,
        lib/rspec/core/drb_command_line.rb,
        lib/rspec/core/memoized_helpers.rb,
        lib/rspec/core/backtrace_cleaner.rb,
        lib/rspec/core/mocking/with_rspec.rb,
        lib/rspec/core/extensions/ordered.rb,
        lib/rspec/core/formatters/helpers.rb,
        lib/rspec/core/mocking/with_mocha.rb,
        lib/rspec/core/project_initializer.rb,
        lib/rspec/core/shared_example_group.rb,
        lib/rspec/core/configuration_options.rb,
        lib/rspec/core/metadata_hash_builder.rb,
        lib/rspec/core/mocking/with_flexmock.rb,
        lib/rspec/core/backward_compatibility.rb,
        lib/rspec/core/formatters/html_printer.rb,
        lib/rspec/core/formatters/console_codes.rb,
        lib/rspec/core/formatters/base_formatter.rb,
        lib/rspec/core/formatters/html_formatter.rb,
        lib/rspec/core/formatters/json_formatter.rb,
        lib/rspec/core/minitest_assertions_adapter.rb,
        lib/rspec/core/test_unit_assertions_adapter.rb,
        lib/rspec/core/formatters/snippet_extractor.rb,
        lib/rspec/core/formatters/progress_formatter.rb,
        lib/rspec/core/formatters/base_text_formatter.rb,
        lib/rspec/core/deprecated_mutable_array_proxy.rb,
        lib/rspec/core/formatters/text_mate_formatter.rb,
        lib/rspec/core/shared_example_group/collection.rb,
        lib/rspec/core/mocking/with_absolutely_nothing.rb,
        lib/rspec/core/extensions/module_eval_with_args.rb,
        lib/rspec/core/formatters/deprecation_formatter.rb,
        lib/rspec/core/formatters/documentation_formatter.rb,
        lib/rspec/core/extensions/instance_eval_with_args.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Core, Runner + + + + Classes: CallerFilter + + +

        + +

        Constant Summary

        + +
        + +
        MODULES_TO_AUTOLOAD = + +
        +
        {
        +  :Matchers     => "rspec/expectations",
        +  :Expectations => "rspec/expectations",
        +  :Mocks        => "rspec/mocks"
        +}
        + +
        SharedContext = + +
        +
        Core::SharedContext
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) configuration + + + + + +

        +
        +

        Returns the global Configuration object. While you +can use this method to access the configuration, the more common +convention is to use RSpec.configure.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configuration.drb_port = 1234
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +
        +
        # File 'lib/rspec/core.rb', line 121
        +
        +def self.configuration
        +  if block_given?
        +    RSpec.warn_deprecation <<-WARNING
        +
        +*****************************************************************
        +DEPRECATION WARNING
        +
        +* RSpec.configuration with a block is deprecated and has no effect.
        +* please use RSpec.configure with a block instead.
        +
        +Called from #{CallerFilter.first_non_rspec_line}
        +*****************************************************************
        +
        +WARNING
        +  end
        +  @configuration ||= RSpec::Core::Configuration.new
        +end
        +
        +
        + +
        +

        + + + (Object) configure {|Configuration| ... } + + + + + +

        +
        +

        Yields the global configuration to a block.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.add_formatter 'documentation'
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Configuration) + + + + — +

          global configuration

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +153
        +154
        +155
        +
        +
        # File 'lib/rspec/core.rb', line 153
        +
        +def self.configure
        +  yield configuration if block_given?
        +end
        +
        +
        + +
        +

        + + + (Object) const_missing(name) + + + + + +

        + + + + +
        +
        +
        +
        +223
        +224
        +225
        +226
        +227
        +228
        +229
        +230
        +231
        +232
        +233
        +234
        +235
        +236
        +237
        +
        +
        # File 'lib/rspec/core.rb', line 223
        +
        +def self.const_missing(name)
        +  # Load rspec-expectations when RSpec::Matchers is referenced. This allows
        +  # people to define custom matchers (using `RSpec::Matchers.define`) before
        +  # rspec-core has loaded rspec-expectations (since it delays the loading of
        +  # it to allow users to configure a different assertion/expectation
        +  # framework). `autoload` can't be used since it works with ruby's built-in
        +  # require (e.g. for files that are available relative to a load path dir),
        +  # but not with rubygems' extended require.
        +  #
        +  # As of rspec 2.14.1, we no longer require `rspec/mocks` and
        +  # `rspec/expectations` when `rspec` is required, so we want
        +  # to make them available as an autoload. For more info, see:
        +  require MODULES_TO_AUTOLOAD.fetch(name) { return super }
        +  ::RSpec.const_get(name)
        +end
        +
        +
        + +
        +

        + + + (Object) current_example + + + + + +

        +
        +

        The example being executed.

        + +

        The primary audience for this method is library authors who need access +to the example currently being executed and also want to support all +versions of RSpec 2 and 3.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |c|
        +  # context.example is deprecated, but RSpec.current_example is not
        +  # available until RSpec 3.0.
        +  fetch_current_example = RSpec.respond_to?(:current_example) ?
        +    proc { RSpec.current_example } : proc { |context| context.example }
        +
        +  c.before(:each) do
        +    example = fetch_current_example.call(self)
        +
        +    # ...
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +184
        +185
        +186
        +
        +
        # File 'lib/rspec/core.rb', line 184
        +
        +def self.current_example
        +  Thread.current[:_rspec_current_example]
        +end
        +
        +
        + +
        +

        + + + (Object) current_example=(example) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Set the current example being executed.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +190
        +191
        +192
        +
        +
        # File 'lib/rspec/core.rb', line 190
        +
        +def self.current_example=(example)
        +  Thread.current[:_rspec_current_example] = example
        +end
        +
        +
        + +
        +

        + + + (Object) reset + + + + + +

        +
        +

        Used internally to ensure examples get reloaded between multiple runs in +the same process.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/core.rb', line 100
        +
        +def self.reset
        +  RSpec.resets_required -= 1
        +  internal_reset
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/CallerFilter.html b/source/documentation/2.99/rspec-core/RSpec/CallerFilter.html new file mode 100644 index 000000000..c30c77d7b --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/CallerFilter.html @@ -0,0 +1,274 @@ + + + + + + Class: RSpec::CallerFilter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::CallerFilter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/caller_filter.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        RSPEC_LIBS = + +
        +
        %w[
        +core
        +mocks
        +expectations
        +matchers
        +rails
        + +
        ADDITIONAL_TOP_LEVEL_FILES = + +
        +
        %w[ autorun ]
        + +
        LIB_REGEX = + +
        +
        %r{/lib/rspec/(#{(RSPEC_LIBS + ADDITIONAL_TOP_LEVEL_FILES).join('|')})(\.rb|/)}
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) first_non_rspec_line + + + + + +

        +
        +

        Earlier rubies do not support the two argument form of caller. This +fallback is logically the same, but slower.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/core/caller_filter.rb', line 53
        +
        +def self.first_non_rspec_line
        +  # `caller` is an expensive method that scales linearly with the size of
        +  # the stack. The performance hit for fetching it in chunks is small,
        +  # and since the target line is probably near the top of the stack, the
        +  # overall improvement of a chunked search like this is significant.
        +  #
        +  # See benchmarks/caller.rb for measurements.
        +
        +  # Initial value here is mostly arbitrary, but is chosen to give good
        +  # performance on the common case of creating a double.
        +  increment = 5
        +  i         = 1
        +  line      = nil
        +
        +  while !line
        +    stack = caller(i, increment)
        +    return nil unless stack
        +
        +    line = stack.find { |l| l !~ LIB_REGEX }
        +
        +    i         += increment
        +    increment *= 2 # The choice of two here is arbitrary.
        +  end
        +
        +  line
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core.html b/source/documentation/2.99/rspec-core/RSpec/Core.html new file mode 100644 index 000000000..0caabba57 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core.html @@ -0,0 +1,232 @@ + + + + + + Module: RSpec::Core + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/drb_options.rb,
        + lib/rspec/core.rb,
        lib/rspec/core/dsl.rb,
        lib/rspec/core/hooks.rb,
        lib/rspec/core/world.rb,
        lib/rspec/core/runner.rb,
        lib/rspec/core/pending.rb,
        lib/rspec/core/example.rb,
        lib/rspec/core/version.rb,
        lib/rspec/core/metadata.rb,
        lib/rspec/core/reporter.rb,
        lib/rspec/core/rake_task.rb,
        lib/rspec/core/deprecation.rb,
        lib/rspec/core/command_line.rb,
        lib/rspec/core/ruby_project.rb,
        lib/rspec/core/configuration.rb,
        lib/rspec/core/example_group.rb,
        lib/rspec/core/option_parser.rb,
        lib/rspec/core/shared_context.rb,
        lib/rspec/core/filter_manager.rb,
        lib/rspec/core/mocking/with_rr.rb,
        lib/rspec/core/drb_command_line.rb,
        lib/rspec/core/memoized_helpers.rb,
        lib/rspec/core/backtrace_cleaner.rb,
        lib/rspec/core/mocking/with_rspec.rb,
        lib/rspec/core/extensions/ordered.rb,
        lib/rspec/core/formatters/helpers.rb,
        lib/rspec/core/mocking/with_mocha.rb,
        lib/rspec/core/project_initializer.rb,
        lib/rspec/core/shared_example_group.rb,
        lib/rspec/core/configuration_options.rb,
        lib/rspec/core/metadata_hash_builder.rb,
        lib/rspec/core/mocking/with_flexmock.rb,
        lib/rspec/core/backward_compatibility.rb,
        lib/rspec/core/formatters/html_printer.rb,
        lib/rspec/core/formatters/console_codes.rb,
        lib/rspec/core/formatters/base_formatter.rb,
        lib/rspec/core/formatters/html_formatter.rb,
        lib/rspec/core/formatters/json_formatter.rb,
        lib/rspec/core/minitest_assertions_adapter.rb,
        lib/rspec/core/test_unit_assertions_adapter.rb,
        lib/rspec/core/formatters/snippet_extractor.rb,
        lib/rspec/core/formatters/progress_formatter.rb,
        lib/rspec/core/formatters/base_text_formatter.rb,
        lib/rspec/core/deprecated_mutable_array_proxy.rb,
        lib/rspec/core/formatters/text_mate_formatter.rb,
        lib/rspec/core/shared_example_group/collection.rb,
        lib/rspec/core/mocking/with_absolutely_nothing.rb,
        lib/rspec/core/extensions/module_eval_with_args.rb,
        lib/rspec/core/formatters/deprecation_formatter.rb,
        lib/rspec/core/formatters/documentation_formatter.rb,
        lib/rspec/core/extensions/instance_eval_with_args.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        Builds command line arguments to pass to the rspec command over DRb

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: BacktraceFormatter, DSL, Deprecation, Formatters, Hooks, MemoizedHelpers, MockFrameworkAdapter, Pending, RubyProject, SharedContext, SharedExampleGroup, Version + + + + Classes: BacktraceCleaner, CommandLine, Configuration, DRbCommandLine, DeprecatedMutableArrayProxy, Example, ExampleGroup, FilterManager, Metadata, Parser, ProjectInitializer, RakeTask, Reporter, Runner, World + + +

        + +

        Constant Summary

        + +
        + +
        DeprecationError = + +
        +
        Class.new(StandardError)
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (Object) const_missing(name) + + + + + + + + + + + + + +

          Alias the error for compatibility with extension gems (e.g. formatters) that depend on the const name of the error in RSpec <= 2.8.

          +
          + +
        • + + +
        + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) const_missing(name) + + + + + +

        +
        +

        Alias the error for compatibility with extension gems (e.g. formatters) +that depend on the const name of the error in RSpec <= 2.8.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +165
        +
        +
        # File 'lib/rspec/core/pending.rb', line 158
        +
        +def self.const_missing(name)
        +  return super unless name == :PendingExampleFixedError
        +
        +  RSpec.deprecate("RSpec::Core::PendingExampleFixedError",
        +    :replacement => "RSpec::Core::Pending::PendingExampleFixedError")
        +
        +  Pending::PendingExampleFixedError
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/BacktraceCleaner.html b/source/documentation/2.99/rspec-core/RSpec/Core/BacktraceCleaner.html new file mode 100644 index 000000000..7e17fbf44 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/BacktraceCleaner.html @@ -0,0 +1,583 @@ + + + + + + Class: RSpec::Core::BacktraceCleaner + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::BacktraceCleaner + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/backtrace_cleaner.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        DEFAULT_EXCLUSION_PATTERNS = + +
        +
        [
        +  /\/lib\d*\/ruby\//,
        +  /org\/jruby\//,
        +  /bin\//,
        +  %r|/gems/|,
        +  /spec\/spec_helper\.rb/,
        +  /lib\/rspec\/(core|expectations|matchers|mocks)/
        +]
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (BacktraceCleaner) initialize(inclusion_patterns = nil, exclusion_patterns = DEFAULT_EXCLUSION_PATTERNS.dup) + + + + + +

        +
        +

        Returns a new instance of BacktraceCleaner

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 17
        +
        +def initialize(inclusion_patterns=nil, exclusion_patterns=DEFAULT_EXCLUSION_PATTERNS.dup)
        +  @exclusion_patterns = exclusion_patterns
        +
        +  if inclusion_patterns.nil?
        +    @inclusion_patterns = (matches_an_exclusion_pattern? Dir.getwd) ? [Regexp.new(Dir.getwd)] : []
        +  else
        +    @inclusion_patterns = inclusion_patterns
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) exclusion_patterns + + + + + +

        +
        +

        Returns the value of attribute exclusion_patterns

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 15
        +
        +def exclusion_patterns
        +  @exclusion_patterns
        +end
        +
        +
        + + + +
        +

        + + - (Object) inclusion_patterns + + + + + +

        +
        +

        Returns the value of attribute inclusion_patterns

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 14
        +
        +def inclusion_patterns
        +  @inclusion_patterns
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) exclude?(line) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 27
        +
        +def exclude?(line)
        +  @inclusion_patterns.none? {|p| line =~ p} and matches_an_exclusion_pattern?(line)
        +end
        +
        +
        + +
        +

        + + - (Object) full_backtrace=(true_or_false) + + + + + +

        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 31
        +
        +def full_backtrace=(true_or_false)
        +  @exclusion_patterns = true_or_false ? [] : DEFAULT_EXCLUSION_PATTERNS.dup
        +end
        +
        +
        + +
        +

        + + - (Boolean) full_backtrace? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 35
        +
        +def full_backtrace?
        +  @exclusion_patterns.empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/BacktraceFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/BacktraceFormatter.html new file mode 100644 index 000000000..6414d5596 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/BacktraceFormatter.html @@ -0,0 +1,198 @@ + + + + + + Module: RSpec::Core::BacktraceFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::BacktraceFormatter + + + +

        + +
        + + + +
        Extended by:
        +
        BacktraceFormatter
        + + + + + + +
        Included in:
        +
        BacktraceFormatter, Formatters::Helpers
        + + + +
        Defined in:
        +
        lib/rspec/core/formatters/helpers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) format_backtrace(backtrace, options = {}) + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 6
        +
        +def format_backtrace(backtrace, options = {})
        +  return "" unless backtrace
        +  return backtrace if options[:full_backtrace] == true
        +
        +  if at_exit_index = backtrace.index(RSpec::Core::Runner::AT_EXIT_HOOK_BACKTRACE_LINE)
        +    backtrace = backtrace[0, at_exit_index]
        +  end
        +
        +  cleansed = backtrace.map { |line| backtrace_line(line) }.compact
        +  cleansed.empty? ? backtrace : cleansed
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/CommandLine.html b/source/documentation/2.99/rspec-core/RSpec/Core/CommandLine.html new file mode 100644 index 000000000..00a8a1efd --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/CommandLine.html @@ -0,0 +1,240 @@ + + + + + + Class: RSpec::Core::CommandLine + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::CommandLine + + + +

        + +
        + +
        Inherits:
        +
        + Runner + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/command_line.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from Runner

        +

        Runner::AT_EXIT_HOOK_BACKTRACE_LINE

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Runner

        +

        autorun, autorun_disabled?, disable_autorun!, installed_at_exit?, run, #run, running_in_drb?, trap_interrupt

        +
        +

        Constructor Details

        + +
        +

        + + - (CommandLine) initialize(options, configuration = RSpec.configuration, world = RSpec.world) + + + + + +

        +
        +

        Returns a new instance of CommandLine

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/core/command_line.rb', line 33
        +
        +def initialize(options, configuration=RSpec.configuration, world=RSpec.world)
        +  if Array === options
        +    RSpec.deprecate("Instantiating a `RSpec::Core::CommandLine` with an array of options",
        +                    :replacement => "Instantiate a `RSpec::Core::Runner` with a `RSpec::Core::ConfigurationOptions` instance")
        +    options = ConfigurationOptions.new(options)
        +    options.parse_options
        +  else
        +    RSpec.deprecate("`RSpec::Core::CommandLine`", :replacement => "`RSpec::Core::Runner`")
        +  end
        +
        +  super
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Configuration.html b/source/documentation/2.99/rspec-core/RSpec/Core/Configuration.html new file mode 100644 index 000000000..820da2641 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Configuration.html @@ -0,0 +1,5919 @@ + + + + + + Class: RSpec::Core::Configuration + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Hooks
        + + + + + +
        Defined in:
        +
        lib/rspec/core/configuration.rb
        + +
        +
        + +

        Overview

        +
        +

        Stores runtime configuration information.

        + +

        Configuration options are loaded from ~/.rspec, .rspec, +.rspec-local, command line switches, and the SPEC_OPTS environment +variable (listed in lowest to highest precedence; for example, an option +in ~/.rspec can be overridden by an option in .rspec-local).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        Standard settings

        +

        + +
        RSpec.configure do |c|
        +  c.drb          = true
        +  c.drb_port     = 1234
        +  c.default_path = 'behavior'
        +end
        + + +

        Hooks

        +

        + +
        RSpec.configure do |c|
        +  c.before(:suite) { establish_connection }
        +  c.before(:each)  {  :authorized }
        +  c.around(:each)  { |ex| Database.transaction(&ex) }
        +end
        + +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + Modules: ExposeCurrentExample + + + + Classes: MustBeConfiguredBeforeExampleGroupsError + + +

        + +

        Constant Summary

        + +
        + +
        NoArgument = + +
        +
        "No such argument"
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Hooks

        +

        #after, #append_after, #around, #before, #prepend_before

        + + + + + + + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Configuration) initialize + + + + + +

        +
        +

        Returns a new instance of Configuration

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +282
        +283
        +284
        +285
        +286
        +287
        +288
        +289
        +290
        +291
        +292
        +293
        +294
        +295
        +296
        +297
        +298
        +299
        +300
        +301
        +302
        +303
        +304
        +305
        +306
        +307
        +308
        +309
        +310
        +311
        +312
        +313
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 282
        +
        +def initialize
        +  @expectation_frameworks = []
        +  @include_or_extend_modules = []
        +  @mock_framework = nil
        +  @files_to_run = []
        +  @color = false
        +  @order = nil
        +  @pattern = '**/*_spec.rb'
        +  @failure_exit_code = 1
        +  @spec_files_loaded = false
        +
        +  @backtrace_formatter = BacktraceCleaner.new
        +
        +  @default_path = 'spec'
        +  @deprecation_stream = $stderr
        +  @output_stream = $stdout
        +  @reporter = nil
        +  @filter_manager = FilterManager.new
        +  @preferred_options = {}
        +  @seed = srand % 0xFFFF
        +  @ordering_already_forced = false
        +  @failure_color = :red
        +  @success_color = :green
        +  @pending_color = :yellow
        +  @default_color = :white
        +  @fixed_color = :blue
        +  @detail_color = :cyan
        +  @profile_examples = false
        +  @requires = []
        +  @libs = []
        +  @show_failures_in_pending_blocks = false
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) backtrace_formatter (readonly) + + + + + +

        +
        +

        Returns the value of attribute backtrace_formatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +274
        +275
        +276
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 274
        +
        +def backtrace_formatter
        +  @backtrace_formatter
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_formatter(formatter) + + + + Also known as: + formatter= + + + + +

        +
        +

        Adds a formatter to the formatters collection. formatter can be a +string representing any of the built-in formatters (see +built_in_formatter), or a custom formatter class.

        + +

        Note

        + +

        For internal purposes, add_formatter also accepts the name of a class +and paths to use for output streams, but you should consider that a +private api that may change at any time without notice.

        + + +
        +
        +
        + + + + +
        + + + + +
        +
        +
        +
        +738
        +739
        +740
        +741
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 738
        +
        +def add_formatter(formatter_to_use, *paths)
        +  paths << output_stream if paths.empty?
        +  formatter_loader.add formatter_to_use, *paths
        +end
        +
        +
        + +
        +

        + + + - (Object) add_setting(name) + + - (Object) add_setting(name, opts) + + + + + + +

        +
        +

        Adds a custom setting to the RSpec.configuration object.

        + +
        RSpec.configuration.add_setting :foo
        +
        + +

        Used internally and by extension frameworks like rspec-rails, so they +can add config settings that are domain specific. For example:

        + +
        RSpec.configure do |c|
        +  c.add_setting :use_transactional_fixtures,
        +    :default => true,
        +    :alias_with => :use_transactional_examples
        +end
        +
        + +

        add_setting creates three methods on the configuration object, a +setter, a getter, and a predicate:

        + +
        RSpec.configuration.foo=(value)
        +RSpec.configuration.foo
        +RSpec.configuration.foo? # returns true if foo returns anything but nil or false
        +
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +

          a customizable set of options

          +
          + +
        • + +
        + + + + + + +

        Options Hash (opts):

        +
          + +
        • + :default + (Symbol) + + + + + —

          set a default value for the generated getter and predicate methods:

          + +
          add_setting(:foo, :default => "default value")
          +
          +
          + +
        • + +
        • + :alias_with + (Symbol) + + + + + —

          Use :alias_with to alias the setter, getter, and predicate to another +name, or names:

          + +
          add_setting(:foo, :alias_with => :bar)
          +add_setting(:foo, :alias_with => [:bar, :baz])
          +
          +
          + +
        • + +
        + + + +
        + + + + +
        +
        +
        +
        +370
        +371
        +372
        +373
        +374
        +375
        +376
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 370
        +
        +def add_setting(name, opts={})
        +  default = opts.delete(:default)
        +  (class << self; self; end).class_eval do
        +    add_setting(name, opts)
        +  end
        +  send("#{name}=", default) if default
        +end
        +
        +
        + +
        +

        + + - (Object) alias_example_to(new_name, *args) + + + + + +

        +
        +

        Creates a method that delegates to example including the submitted +args. Used internally to add variants of example like pending:

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        alias_example_to :pending, :pending => true
        +
        +# This lets you do this:
        +
        +describe Thing do
        +  pending "does something" do
        +    thing = Thing.new
        +  end
        +end
        +
        +# ... which is the equivalent of
        +
        +describe Thing do
        +  it "does something", :pending => true do
        +    thing = Thing.new
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +803
        +804
        +805
        +806
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 803
        +
        +def alias_example_to(new_name, *args)
        +  extra_options = (args)
        +  RSpec::Core::ExampleGroup.define_example_method(new_name, extra_options)
        +end
        +
        +
        + +
        +

        + + - (Object) alias_it_behaves_like_to(new_name, report_label = '') + + + + Also known as: + alias_it_should_behave_like_to + + + + +

        +
        +

        Define an alias for it_should_behave_like that allows different +language (like "it_has_behavior" or "it_behaves_like") to be +employed when including shared examples.

        + +

        Example:

        + +
        alias_it_behaves_like_to(:it_has_behavior, 'has behavior:')
        +
        + +

        allows the user to include a shared example group like:

        + +
        describe Entity do
        +  it_has_behavior 'sortability' do
        +    let(:sortable) { Entity.new }
        +  end
        +end
        +
        + +

        which is reported in the output as:

        + +
        Entity
        +  has behavior: sortability
        +    # sortability examples here
        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +829
        +830
        +831
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 829
        +
        +def alias_it_behaves_like_to(new_name, report_label = '')
        +  RSpec::Core::ExampleGroup.define_nested_shared_group_method(new_name, report_label)
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_clean_patterns + + + + + +

        +
        +

        The patterns to discard from backtraces. Deprecated, use +Configuration#backtrace_exclusion_patterns instead

        + +

        Defaults to RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS

        + +

        One can replace the list by using the setter or modify it through the +getter

        + +

        To override this behaviour and display a full backtrace, use +--backtraceon the command line, in a .rspec file, or in the +rspec_options attribute of RSpec's rake task.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +400
        +401
        +402
        +403
        +404
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 400
        +
        +def backtrace_clean_patterns
        +  RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
        +                  :replacement => "RSpec::Core::Configuration#backtrace_exclusion_patterns")
        +  @backtrace_formatter.exclusion_patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_clean_patterns=(patterns) + + + + + +

        + + + + +
        +
        +
        +
        +406
        +407
        +408
        +409
        +410
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 406
        +
        +def backtrace_clean_patterns=(patterns)
        +  RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
        +                  :replacement => "RSpec::Core::Configuration#backtrace_exclusion_patterns")
        +  @backtrace_formatter.exclusion_patterns = patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_cleaner + + + + + +

        + + + + +
        +
        +
        +
        +276
        +277
        +278
        +279
        +280
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 276
        +
        +def backtrace_cleaner
        +  RSpec.deprecate "`RSpec::Core::Configuration#backtrace_cleaner`",
        +                  :replacement => "`RSpec::Core::Configuration#backtrace_formatter`"
        +  @backtrace_formatter
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_exclusion_patterns + + + + + +

        +
        +

        The patterns to discard from backtraces.

        + +

        Defaults to RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS

        + +

        One can replace the list by using the setter or modify it through the +getter

        + +

        To override this behaviour and display a full backtrace, use +--backtraceon the command line, in a .rspec file, or in the +rspec_options attribute of RSpec's rake task.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +437
        +438
        +439
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 437
        +
        +def backtrace_exclusion_patterns
        +  @backtrace_formatter.exclusion_patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_exclusion_patterns=(patterns) + + + + + +

        + + + + +
        +
        +
        +
        +441
        +442
        +443
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 441
        +
        +def backtrace_exclusion_patterns=(patterns)
        +  @backtrace_formatter.exclusion_patterns = patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_inclusion_patterns + + + + + +

        +
        +

        The patterns to always include to backtraces.

        + +

        Defaults to [Regexp.new Dir.getwd] if the current working directory +matches any of the exclusion patterns. Otherwise it defaults to empty.

        + +

        One can replace the list by using the setter or modify it through the +getter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +419
        +420
        +421
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 419
        +
        +def backtrace_inclusion_patterns
        +  @backtrace_formatter.inclusion_patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_inclusion_patterns=(patterns) + + + + + +

        + + + + +
        +
        +
        +
        +423
        +424
        +425
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 423
        +
        +def backtrace_inclusion_patterns=(patterns)
        +  @backtrace_formatter.inclusion_patterns = patterns
        +end
        +
        +
        + +
        +

        + + - (Object) color(output = NoArgument) + + + + + +

        + + + + +
        +
        +
        +
        +595
        +596
        +597
        +598
        +599
        +600
        +601
        +602
        +603
        +604
        +605
        +606
        +607
        +608
        +609
        +610
        +611
        +612
        +613
        +614
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 595
        +
        +def color(output = NoArgument)
        +  if output == NoArgument
        +    output = output_stream
        +    if !output_to_tty?(output) && value_for(:color, @color)
        +      RSpec.warn_deprecation <<-MSG.gsub(/\s+|/,'')
        +        | Calling `RSpec::Core::Configuration#color` in RSpec 3 will
        +        | return the value of the configuration setting, in RSpec 2
        +        | this value is `false` as your output doesn't support color.
        +        | Use `RSpec::Core::Configuration#color_enabled?` if you depend
        +        | on this behavior.
        +        | Called from #{CallerFilter.first_non_rspec_line}.
        +      MSG
        +    end
        +  else
        +    RSpec.deprecate '`RSpec::Core::Configuration#color(output)`',
        +                    :replacement => '`RSpec::Core::Configuration#color_enabled?(output)`'
        +  end
        +
        +  color_enabled? output
        +end
        +
        +
        + +
        +

        + + - (Object) color=(bool) + + + + + +

        + + + + +
        +
        +
        +
        +616
        +617
        +618
        +619
        +620
        +621
        +622
        +623
        +624
        +625
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 616
        +
        +def color=(bool)
        +  if bool
        +    if RSpec.windows_os? and not ENV['ANSICON']
        +      warn "You must use ANSICON 1.31 or later (http://adoxa.3eeweb.com/ansicon/) to use colour on Windows"
        +      @color = false
        +    else
        +      @color = true
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) color?(output = output_stream) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +647
        +648
        +649
        +650
        +651
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 647
        +
        +def color?(output=output_stream)
        +  RSpec.deprecate "RSpec::Core::Configuration#color?",
        +                  :replacement => "RSpec::Core::Configuration#color_enabled?"
        +  color_enabled? output_stream
        +end
        +
        +
        + +
        +

        + + - (Object) color_enabled(output = output_stream) + + + + + +

        + + + + +
        +
        +
        +
        +631
        +632
        +633
        +634
        +635
        +636
        +637
        +638
        +639
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 631
        +
        +def color_enabled(output=output_stream)
        +  RSpec.deprecate "`RSpec::Core::Configuration#color_enabled`",
        +    :replacement =>
        +      "`RSpec::Core::Configuration#color` if you want the configuration " +
        +      "value, or `RSpec::Core::Configuration#color_enabled?(output)` if " +
        +      " you want to know if color output is supported."
        +
        +  color_enabled? output
        +end
        +
        +
        + +
        +

        + + - (Object) color_enabled=(bool) + + + + + +

        + + + + +
        +
        +
        +
        +641
        +642
        +643
        +644
        +645
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 641
        +
        +def color_enabled=(bool)
        +  RSpec.deprecate "RSpec::Core::Configuration#color_enabled=",
        +                  :replacement => "RSpec::Core::Configuration#color="
        +  self.color = bool
        +end
        +
        +
        + +
        +

        + + - (Boolean) color_enabled?(output = output_stream) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +627
        +628
        +629
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 627
        +
        +def color_enabled?(output=output_stream)
        +  output_to_tty?(output) && value_for(:color, @color)
        +end
        +
        +
        + +
        +

        + + - (Object) debug=(bool) + + + + + +

        + + + + +
        +
        +
        +
        +667
        +668
        +669
        +670
        +671
        +672
        +673
        +674
        +675
        +676
        +677
        +678
        +679
        +680
        +681
        +682
        +683
        +684
        +685
        +686
        +687
        +688
        +689
        +690
        +691
        +692
        +693
        +694
        +695
        +696
        +697
        +698
        +699
        +700
        +701
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 667
        +
        +def debug=(bool)
        +  if bool == :cli
        +    RSpec.deprecate("RSpec's built-in debugger support",
        +                    :replacement => "a CLI option like `-rruby-debug` or `-rdebugger`",
        +                    :call_site => nil)
        +    bool = true
        +  elsif bool
        +    RSpec.deprecate("RSpec::Core::Configuration#debug=",
        +                    :replacement => "a CLI option like `-rruby-debug` or `-rdebugger`")
        +  else
        +    # ...but the only way to call this with a false value is to
        +    # call it directly, so here we mention the method name.
        +    # There's no replacement for it since it's a no-op, though.
        +    RSpec.deprecate("RSpec::Core::Configuration#debug=")
        +  end
        +
        +  return unless bool
        +  begin
        +    require 'ruby-debug'
        +    Debugger.start
        +  rescue LoadError => e
        +    raise <<-EOM
        +
        +#{'*'*50}
        +#{e.message}
        +
        +If you have it installed as a ruby gem, then you need to either require
        +'rubygems' or configure the RUBYOPT environment variable with the value
        +'rubygems'.
        +
        +#{e.backtrace.join("\n")}
        +#{'*'*50}
        +EOM
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) debug? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +703
        +704
        +705
        +706
        +707
        +708
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 703
        +
        +def debug?
        +  RSpec.deprecate("RSpec::Core::Configuration#debug?",
        +                  :replacement => "defined?(Debugger)")
        +
        +  !!defined?(Debugger)
        +end
        +
        +
        + +
        +

        + + - (Object) deprecation_stream=(value) + + + + + +

        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 101
        +
        +def deprecation_stream=(value)
        +  if @reporter && !value.equal?(@deprecation_stream)
        +    warn "RSpec's reporter has already been initialized with " +
        +      "#{deprecation_stream.inspect} as the deprecation stream, so your change to "+
        +      "`deprecation_stream` will be ignored. You should configure it earlier for " +
        +      "it to take effect, or use the `--deprecation-out` CLI option. " +
        +      "(Called from #{CallerFilter.first_non_rspec_line})"
        +  else
        +    @deprecation_stream = value
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) exclusion_filter + + + + + +

        +
        +

        Returns the exclusion_filter. If none has been set, returns an empty +hash.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +943
        +944
        +945
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 943
        +
        +def exclusion_filter
        +  filter_manager.exclusions
        +end
        +
        +
        + +
        +

        + + - (Object) exclusion_filter=(filter) + + + + + +

        +
        +

        Clears and reassigns the exclusion_filter. Set to nil if you don't +want any exclusion filter at all.

        + +

        Warning

        + +

        This overrides any exclusion filters/tags set on the command line or in +configuration files.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +937
        +938
        +939
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 937
        +
        +def exclusion_filter=(filter)
        +  filter_manager.exclude_only ([filter])
        +end
        +
        +
        + +
        +

        + + - (Object) expect_with(*frameworks) + + + + + +

        +
        +

        Sets the expectation framework module(s) to be included in each example +group.

        + +

        frameworks can be :rspec, :test_unit, :minitest, a custom +module, or any combination thereof:

        + +
        config.expect_with :rspec
        +config.expect_with :test_unit
        +config.expect_with :minitest
        +config.expect_with :rspec, :minitest
        +config.expect_with OtherExpectationFramework
        +
        + +

        RSpec will translate :rspec, :minitest, and :test_unit into the +appropriate modules.

        + +

        Configuration

        + +

        If the module responds to configuration, expect_with will +yield the configuration object if given a block:

        + +
        config.expect_with OtherExpectationFramework do |custom_config|
        +  custom_config.custom_setting = true
        +end
        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +549
        +550
        +551
        +552
        +553
        +554
        +555
        +556
        +557
        +558
        +559
        +560
        +561
        +562
        +563
        +564
        +565
        +566
        +567
        +568
        +569
        +570
        +571
        +572
        +573
        +574
        +575
        +576
        +577
        +578
        +579
        +580
        +581
        +582
        +583
        +584
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 549
        +
        +def expect_with(*frameworks)
        +  modules = frameworks.map do |framework|
        +    case framework
        +    when Module
        +      framework
        +    when :rspec
        +      require 'rspec/expectations'
        +      self.expecting_with_rspec = true
        +      ::RSpec::Matchers
        +    when :stdlib
        +      RSpec.deprecate ':stdlib', :replacement => ":test_unit or :minitest"
        +      require 'test/unit/assertions'
        +      ::Test::Unit::Assertions
        +    when :test_unit
        +      require 'rspec/core/test_unit_assertions_adapter'
        +      ::RSpec::Core::TestUnitAssertionsAdapter
        +    when :minitest
        +      require 'rspec/core/minitest_assertions_adapter'
        +      ::RSpec::Core::MinitestAssertionsAdapter
        +    else
        +      raise ArgumentError, "#{framework.inspect} is not supported"
        +    end
        +  end
        +
        +  if (modules - @expectation_frameworks).any?
        +    assert_no_example_groups_defined(:expect_with)
        +  end
        +
        +  if block_given?
        +    raise "expect_with only accepts a block with a single argument. Call expect_with #{modules.length} times, once with each argument, instead." if modules.length > 1
        +    raise "#{modules.first} must respond to `configuration` so that expect_with can yield it." unless modules.first.respond_to?(:configuration)
        +    yield modules.first.configuration
        +  end
        +
        +  @expectation_frameworks.push(*modules)
        +end
        +
        +
        + +
        +

        + + - (Object) expectation_framework=(framework) + + + + + +

        +
        +

        Delegates to expect_with(framework)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +522
        +523
        +524
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 522
        +
        +def expectation_framework=(framework)
        +  expect_with(framework)
        +end
        +
        +
        + +
        +

        + + - (Object) expectation_frameworks + + + + + +

        +
        +

        Returns the configured expectation framework adapter module(s)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +516
        +517
        +518
        +519
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 516
        +
        +def expectation_frameworks
        +  expect_with :rspec if @expectation_frameworks.empty?
        +  @expectation_frameworks
        +end
        +
        +
        + +
        +

        + + - (Object) expose_current_running_example_as(method_name) + + + + + +

        +
        +

        Exposes the current running example via the named +helper method. RSpec 2.x exposed this via example, +but in RSpec 3.0, the example is instead exposed via +an arg yielded to it, before, let, etc. However, +some extension gems (such as Capybara) depend on the +RSpec 2.x's example method, so this config option +can be used to maintain compatibility.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.expose_current_running_example_as :example
        +end
        +
        +describe MyClass do
        +  before do
        +    # `example` can be used here because of the above config.
        +    do_something if example.[:type] == "foo"
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + method_name + + + (Symbol) + + + + — +

          the name of the helper method

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +1281
        +1282
        +1283
        +1284
        +1285
        +1286
        +1287
        +1288
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1281
        +
        +def expose_current_running_example_as(method_name)
        +  ExposeCurrentExample.module_eval do
        +    extend RSpec::SharedContext
        +    let(method_name) { |ex| ex }
        +  end
        +
        +  include ExposeCurrentExample
        +end
        +
        +
        + +
        +

        + + - (Object) extend(mod, *filters) + + + + + +

        +
        +

        Tells RSpec to extend example groups with mod. Methods defined in +mod are exposed to example groups (not examples). Use filters to +constrain the groups to extend.

        + +

        Similar to include, but behavior is added to example groups, which +are classes, rather than the examples, which are instances of those +classes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module UiHelpers
        +  def run_in_browser
        +    # ...
        +  end
        +end
        +
        +RSpec.configure do |config|
        +  config.extend(UiHelpers, :type => :request)
        +end
        +
        +describe "edit profile", :type => :request do
        +  run_in_browser
        +
        +  it "does stuff in the client" do
        +    # ...
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +1012
        +1013
        +1014
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1012
        +
        +def extend(mod, *filters)
        +  include_or_extend_modules << [:extend, mod, (filters)]
        +end
        +
        +
        + +
        +

        + + - (Object) filename_pattern + + + + + +

        + + + + +
        +
        +
        +
        +166
        +167
        +168
        +169
        +170
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 166
        +
        +def filename_pattern
        +  RSpec.deprecate "`RSpec::Core::Configuration#filename_pattern`",
        +                  :replacement => "`RSpec::Core::Configuration#pattern`"
        +  pattern
        +end
        +
        +
        + +
        +

        + + - (Object) filename_pattern=(value) + + + + + +

        + + + + +
        +
        +
        +
        +179
        +180
        +181
        +182
        +183
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 179
        +
        +def filename_pattern=(value)
        +  RSpec.deprecate "`RSpec::Core::Configuration#filename_pattern=`",
        +                  :replacement => "`RSpec::Core::Configuration#pattern=`"
        +  self.pattern = value
        +end
        +
        +
        + +
        +

        + + - (Object) filter_run(*args) + + + + + +

        + + + + +
        +
        +
        +
        +870
        +871
        +872
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 870
        +
        +def filter_run(*args)
        +  __filter_run(__method__, *args)
        +end
        +
        +
        + +
        +

        + + - (Object) filter_run_excluding(*args) + + + + + +

        +
        +

        Adds key/value pairs to the exclusion_filter. If the +treat_symbols_as_metadata_keys_with_true_values config option is set +to true and args excludes any symbols that are not part of a hash, +each symbol is treated as a key in the hash with the value true.

        + +

        Note

        + +

        Filters set using this method can be overridden from the command line +or config files (e.g. .rspec).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # given this declaration
        +describe "something", :foo => 'bar' do
        +  # ...
        +end
        +
        +# any of the following will exclude that group
        +config.filter_run_excluding :foo => 'bar'
        +config.filter_run_excluding :foo => /^ba/
        +config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
        +config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# given a proc with an arity of 1, the lambda is passed the value related to the key, e.g.
        +config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
        +
        +# given a proc with an arity of 2, the lambda is passed the value related to the key,
        +# and the metadata itself e.g.
        +config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# with treat_symbols_as_metadata_keys_with_true_values = true
        +filter_run_excluding :foo # same as filter_run_excluding :foo => true
        + +
        + + +
        + + + + +
        +
        +
        +
        +926
        +927
        +928
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 926
        +
        +def filter_run_excluding(*args)
        +  filter_manager.exclude_with_low_priority (args)
        +end
        +
        +
        + +
        +

        + + - (Object) filter_run_including(*args) + + + + + +

        +
        +

        Adds key/value pairs to the inclusion_filter. If the +treat_symbols_as_metadata_keys_with_true_values config option is set +to true and args includes any symbols that are not part of a hash, +each symbol is treated as a key in the hash with the value true.

        + +

        Note

        + +

        Filters set using this method can be overridden from the command line +or config files (e.g. .rspec).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # given this declaration
        +describe "something", :foo => 'bar' do
        +  # ...
        +end
        +
        +# any of the following will include that group
        +config.filter_run_including :foo => 'bar'
        +config.filter_run_including :foo => /^ba/
        +config.filter_run_including :foo => lambda {|v| v == 'bar'}
        +config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# given a proc with an arity of 1, the lambda is passed the value related to the key, e.g.
        +config.filter_run_including :foo => lambda {|v| v == 'bar'}
        +
        +# given a proc with an arity of 2, the lambda is passed the value related to the key,
        +# and the metadata itself e.g.
        +config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# with treat_symbols_as_metadata_keys_with_true_values = true
        +filter_run_including :foo # same as filter_run_including :foo => true
        + +
        + + +
        + + + + +
        +
        +
        +
        +866
        +867
        +868
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 866
        +
        +def filter_run_including(*args)
        +  __filter_run(__method__, *args)
        +end
        +
        +
        + +
        +

        + + - (Object) format_docstrings(&block) + + + + + +

        +
        +

        Formats the docstring output using the block provided.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # This will strip the descriptions of both examples and example groups.
        +RSpec.configure do |config|
        +  config.format_docstrings { |s| s.strip }
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +1080
        +1081
        +1082
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1080
        +
        +def format_docstrings(&block)
        +  @format_docstrings_block = block_given? ? block : DEFAULT_FORMATTER
        +end
        +
        +
        + +
        +

        + + - (Object) formatters + + + + + +

        + + + + +
        +
        +
        +
        +744
        +745
        +746
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 744
        +
        +def formatters
        +  DeprecatedMutableArrayProxy.new(formatter_loader.formatters)
        +end
        +
        +
        + +
        +

        + + - (Object) full_backtrace=(true_or_false) + + + + + +

        + + + + +
        +
        +
        +
        +590
        +591
        +592
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 590
        +
        +def full_backtrace=(true_or_false)
        +  @backtrace_formatter.full_backtrace = true_or_false
        +end
        +
        +
        + +
        +

        + + - (Boolean) full_backtrace? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +586
        +587
        +588
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 586
        +
        +def full_backtrace?
        +  @backtrace_formatter.full_backtrace?
        +end
        +
        +
        + +
        +

        + + - (Object) full_description + + + + + +

        + + + + +
        +
        +
        +
        +723
        +724
        +725
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 723
        +
        +def full_description
        +  filter.fetch :full_description, nil
        +end
        +
        +
        + +
        +

        + + - (Object) full_description=(description) + + + + + +

        + + + + +
        +
        +
        +
        +719
        +720
        +721
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 719
        +
        +def full_description=(description)
        +  filter_run :full_description => Regexp.union(*Array(description).map {|d| Regexp.new(d) })
        +end
        +
        +
        + +
        +

        + + - (Object) include(mod, *filters) + + + + + +

        +
        +

        Tells RSpec to include mod in example groups. Methods defined in +mod are exposed to examples (not example groups). Use filters to +constrain the groups in which to include the module.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module AuthenticationHelpers
        +  def (user)
        +    # ...
        +  end
        +end
        +
        +module UserHelpers
        +  def users(username)
        +    # ...
        +  end
        +end
        +
        +RSpec.configure do |config|
        +  config.include(UserHelpers) # included in all modules
        +  config.include(AuthenticationHelpers, :type => :request)
        +end
        +
        +describe "edit profile", :type => :request do
        +  it "can be viewed by owning user" do
        +     users(:jdoe)
        +    get "/profiles/jdoe"
        +    assert_select ".username", :text => 'jdoe'
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +979
        +980
        +981
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 979
        +
        +def include(mod, *filters)
        +  include_or_extend_modules << [:include, mod, (filters)]
        +end
        +
        +
        + +
        +

        + + - (Object) inclusion_filter + + + + Also known as: + filter + + + + +

        +
        +

        Returns the inclusion_filter. If none has been set, returns an empty +hash.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +889
        +890
        +891
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 889
        +
        +def inclusion_filter
        +  filter_manager.inclusions
        +end
        +
        +
        + +
        +

        + + - (Object) inclusion_filter=(filter) + + + + Also known as: + filter= + + + + +

        +
        +

        Clears and reassigns the inclusion_filter. Set to nil if you don't +want any inclusion filter at all.

        + +

        Warning

        + +

        This overrides any inclusion filters/tags set on the command line or in +configuration files.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +881
        +882
        +883
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 881
        +
        +def inclusion_filter=(filter)
        +  filter_manager.include_only ([filter])
        +end
        +
        +
        + +
        +

        + + - (Object) libs=(libs) + + + + + +

        + + + + +
        +
        +
        +
        +653
        +654
        +655
        +656
        +657
        +658
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 653
        +
        +def libs=(libs)
        +  libs.map do |lib|
        +    @libs.unshift lib
        +    $LOAD_PATH.unshift lib
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) line_numbers + + + + + +

        + + + + +
        +
        +
        +
        +715
        +716
        +717
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 715
        +
        +def line_numbers
        +  filter.fetch(:line_numbers,[])
        +end
        +
        +
        + +
        +

        + + - (Object) line_numbers=(line_numbers) + + + + + +

        +
        +

        Run examples defined on line_numbers in all files to run.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +711
        +712
        +713
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 711
        +
        +def line_numbers=(line_numbers)
        +  filter_run :line_numbers => line_numbers.map{|l| l.to_i}
        +end
        +
        +
        + +
        +

        + + - (Object) mock_framework + + + + + +

        +
        +

        Returns the configured mock framework adapter module

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +379
        +380
        +381
        +382
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 379
        +
        +def mock_framework
        +  mock_with :rspec unless @mock_framework
        +  @mock_framework
        +end
        +
        +
        + +
        +

        + + - (Object) mock_framework=(framework) + + + + + +

        +
        +

        Delegates to mock_framework=(framework)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +385
        +386
        +387
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 385
        +
        +def mock_framework=(framework)
        +  mock_with framework
        +end
        +
        +
        + +
        +

        + + - (Object) mock_with(framework) + + + + + +

        +
        +

        Sets the mock framework adapter module.

        + +

        framework can be a Symbol or a Module.

        + +

        Given any of :rspec, :mocha, :flexmock, or :rr, configures the +named framework.

        + +

        Given :nothing, configures no framework. Use this if you don't use +any mocking framework to save a little bit of overhead.

        + +

        Given a Module, includes that module in every example group. The module +should adhere to RSpec's mock framework adapter API:

        + +
        setup_mocks_for_rspec
        +  - called before each example
        +
        +verify_mocks_for_rspec
        +  - called after each example. Framework should raise an exception
        +    when expectations fail
        +
        +teardown_mocks_for_rspec
        +  - called after verify_mocks_for_rspec (even if there are errors)
        +
        + +

        If the module responds to configuration and mock_with receives a block, +it will yield the configuration object to the block e.g.

        + +
        config.mock_with OtherMockFrameworkAdapter do |mod_config|
        +  mod_config.custom_setting = true
        +end
        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +474
        +475
        +476
        +477
        +478
        +479
        +480
        +481
        +482
        +483
        +484
        +485
        +486
        +487
        +488
        +489
        +490
        +491
        +492
        +493
        +494
        +495
        +496
        +497
        +498
        +499
        +500
        +501
        +502
        +503
        +504
        +505
        +506
        +507
        +508
        +509
        +510
        +511
        +512
        +513
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 474
        +
        +def mock_with(framework)
        +  framework_module = case framework
        +  when Module
        +    framework
        +  when String, Symbol
        +    require case framework.to_s
        +            when /rspec/i
        +              deprecate_unless_mock_adapter_name_is_exact(framework, :rspec)
        +              'rspec/core/mocking/with_rspec'
        +            when /mocha/i
        +              deprecate_unless_mock_adapter_name_is_exact(framework, :mocha)
        +              'rspec/core/mocking/with_mocha'
        +            when /rr/i
        +              deprecate_unless_mock_adapter_name_is_exact(framework, :rr)
        +              'rspec/core/mocking/with_rr'
        +            when /flexmock/i
        +              deprecate_unless_mock_adapter_name_is_exact(framework, :flexmock)
        +              'rspec/core/mocking/with_flexmock'
        +            else
        +              deprecate_unless_mock_adapter_name_is_exact(framework, :nothing)
        +              'rspec/core/mocking/with_absolutely_nothing'
        +            end
        +    RSpec::Core::MockFrameworkAdapter
        +  end
        +
        +  new_name, old_name = [framework_module, @mock_framework].map do |mod|
        +    mod.respond_to?(:framework_name) ?  mod.framework_name : :unnamed
        +  end
        +
        +  unless new_name == old_name
        +    assert_no_example_groups_defined(:mock_framework)
        +  end
        +
        +  if block_given?
        +    raise "#{framework_module} must respond to `configuration` so that mock_with can yield it." unless framework_module.respond_to?(:configuration)
        +    yield framework_module.configuration
        +  end
        +
        +  @mock_framework = framework_module
        +end
        +
        +
        + +
        +

        + + - (Object) order + + + + + +

        +
        +

        Determines the order in which examples are run (default: OS standard +load order for files, declaration order for groups and examples).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1105
        +1106
        +1107
        +1108
        +1109
        +1110
        +1111
        +1112
        +1113
        +1114
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1105
        +
        +def order
        +  RSpec.warn_deprecation(
        +    "RSpec::Core::Configuration#order is deprecated with no replacement. " +
        +    "In RSpec 3 individal example groups can use a particular ordering, " +
        +    "so `order` is no longer a global property of the entire suite. " +
        +    "Called from #{CallerFilter.first_non_rspec_line}."
        +  )
        +
        +  value_for(:order, @order)
        +end
        +
        +
        + +
        +

        + + - (Object) order=(type) + + + + + +

        +
        +

        Sets the order and, if order is 'rand:<seed>', also sets the seed.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1099
        +1100
        +1101
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1099
        +
        +def order=(type)
        +  order_and_seed_from_order(type)
        +end
        +
        +
        + +
        +

        + + - (Object) order_examples(&block) + + + + + +

        +
        +

        Sets a strategy by which to order examples.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.order_examples do |examples|
        +    examples.reverse
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +1151
        +1152
        +1153
        +1154
        +1155
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1151
        +
        +def order_examples(&block)
        +  RSpec.deprecate("RSpec::Configuration#order_examples", :replacement => "RSpec::Configuration#register_ordering(:global)")
        +  @example_ordering_block = block
        +  @order = "custom" unless built_in_orderer?(block)
        +end
        +
        +
        + +
        +

        + + - (Object) order_groups(&block) + + + + + +

        +
        +

        Sets a strategy by which to order groups.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.order_groups do |groups|
        +    groups.reverse
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +1175
        +1176
        +1177
        +1178
        +1179
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1175
        +
        +def order_groups(&block)
        +  RSpec.deprecate("RSpec::Configuration#order_groups", :replacement => "RSpec::Configuration#register_ordering(:global)")
        +  @group_ordering_block = block
        +  @order = "custom" unless built_in_orderer?(block)
        +end
        +
        +
        + +
        +

        + + - (Object) order_groups_and_examples(&block) + + + + + +

        +
        +

        Sets a strategy by which to order groups and examples.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.order_groups_and_examples do |groups_or_examples|
        +    groups_or_examples.reverse
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +1199
        +1200
        +1201
        +1202
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1199
        +
        +def order_groups_and_examples(&block)
        +  order_groups(&block)
        +  order_examples(&block)
        +end
        +
        +
        + +
        +

        + + - (Object) out + + + + + +

        +
        +
        Deprecated.

        use RSpec::Core::Configuration#output_stream instead.

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +152
        +153
        +154
        +155
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 152
        +
        +def out
        +  RSpec.deprecate("RSpec::Core::Configuration#out", :replacement => "RSpec::Core::Configuration#output_stream")
        +  output_stream
        +end
        +
        +
        + +
        +

        + + - (Object) out=(value) + + + + + +

        +
        +
        Deprecated.

        use RSpec::Core::Configuration#output_stream= instead.

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +158
        +159
        +160
        +161
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 158
        +
        +def out=(value)
        +  RSpec.deprecate("RSpec::Core::Configuration#out=", :replacement => "RSpec::Core::Configuration#output_stream=")
        +  self.output_stream = value
        +end
        +
        +
        + +
        +

        + + - (Object) output + + + + + +

        +
        +
        Deprecated.

        use RSpec::Core::Configuration#output_stream instead.

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +140
        +141
        +142
        +143
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 140
        +
        +def output
        +  RSpec.deprecate("RSpec::Core::Configuration#output", :replacement => "RSpec::Core::Configuration#output_stream")
        +  output_stream
        +end
        +
        +
        + +
        +

        + + - (Object) output=(value) + + + + + +

        +
        +
        Deprecated.

        use RSpec::Core::Configuration#output_stream= instead.

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +146
        +147
        +148
        +149
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 146
        +
        +def output=(value)
        +  RSpec.deprecate("RSpec::Core::Configuration#output=", :replacement => "RSpec::Core::Configuration#output_stream=")
        +  self.output_stream = value
        +end
        +
        +
        + +
        +

        + + - (Object) output_stream=(value) + + + + + +

        + + + + +
        +
        +
        +
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 128
        +
        +def output_stream=(value)
        +  if @reporter && !value.equal?(@output_stream)
        +    warn "RSpec's reporter has already been initialized with " +
        +      "#{output_stream.inspect} as the output stream, so your change to "+
        +      "`output_stream` will be ignored. You should configure it earlier for " +
        +      "it to take effect. (Called from #{CallerFilter.first_non_rspec_line})"
        +  else
        +    @output_stream = value
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) pattern=(value) + + + + + +

        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +175
        +176
        +177
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 172
        +
        +def pattern= value
        +  if @spec_files_loaded
        +    Kernel.warn "WARNING: Configuring `pattern` to #{value} has no effect since RSpec has already loaded the spec files. Called from #{CallerFilter.first_non_rspec_line}"
        +  end
        +  @pattern = value
        +end
        +
        +
        + +
        +

        + + - (Object) profile_examples + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Defaults profile_examples to 10 examples when @profile_examples is true.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +766
        +767
        +768
        +769
        +770
        +771
        +772
        +773
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 766
        +
        +def profile_examples
        +  profile = value_for(:profile_examples, @profile_examples)
        +  if profile && !profile.is_a?(Integer)
        +    10
        +  else
        +    profile
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) raise_errors_for_deprecations! + + + + + +

        +
        +

        Turns deprecation warnings into errors, in order to surface +the full backtrace of the call site. This can be useful when +you need more context to address a deprecation than the +single-line call site normally provided.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.raise_errors_for_deprecations!
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +1302
        +1303
        +1304
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1302
        +
        +def raise_errors_for_deprecations!
        +  self.deprecation_stream = Formatters::DeprecationFormatter::RaiseErrorStream.new
        +end
        +
        +
        + +
        +

        + + - (Boolean) randomize? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +1116
        +1117
        +1118
        +1119
        +1120
        +1121
        +1122
        +1123
        +1124
        +1125
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1116
        +
        +def randomize?
        +  RSpec.warn_deprecation(
        +    "RSpec::Core::Configuration#randomize? is deprecated with no replacement. " +
        +    "In RSpec 3 individal example groups can use a particular ordering, " +
        +    "so `randomize?` is no longer a binary property of the entire suite. " +
        +    "Called from #{CallerFilter.first_non_rspec_line}."
        +  )
        +
        +  value_for(:order, @order).to_s.match(/rand/)
        +end
        +
        +
        + +
        +

        + + - (Object) register_ordering(name) {|list| ... } + + + + + +

        +
        + +
        + Note: +

        Pass the symbol :global to set the ordering strategy that +will be used to order the top-level example groups and any example +groups that do not have declared :order metadata.

        +
        +
        + +

        In RSpec 3, this registers a named ordering strategy that can later be +used to order an example group's subgroups by adding +:order => <name> metadata to the example group.

        + +

        In RSpec 2.99, only register_ordering(:global) is supported, +to set the global ordering.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |rspec|
        +  rspec.register_ordering :reverse do |list|
        +    list.reverse
        +  end
        +end
        +
        +describe MyClass, :order => :reverse do
        +  # ...
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (Symbol) + + + + — +

          The name of the ordering.

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + + + + + +

          Block that will order the given examples or example groups

          +
          + +
        • + +
        +

        Yield Parameters:

        +
          + +
        • + + list + + + (Array<RSpec::Core::Example>, Array<RSpec::Core::ExampleGropu>) + + + + — +

          The examples or groups to order

          +
          + +
        • + +
        +

        Yield Returns:

        + + +
        + + + + +
        +
        +
        +
        +1230
        +1231
        +1232
        +1233
        +1234
        +1235
        +1236
        +1237
        +1238
        +1239
        +1240
        +1241
        +1242
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1230
        +
        +def register_ordering(name, &block)
        +  unless name == :global
        +    raise ArgumentError,
        +      "Ordering name `#{name.inspect}` given, `:global` expected. " +
        +      "RSpec 3 will support named orderings (that can be used for " +
        +      "individual example groups) but 2.99 only supports using this " +
        +      "to set the global order."
        +  end
        +
        +  @group_ordering_block = block
        +  @example_ordering_block = block
        +  @order = "custom"
        +end
        +
        +
        + +
        +

        + + - (Object) requires=(paths) + + + + + +

        + + + + +
        +
        +
        +
        +660
        +661
        +662
        +663
        +664
        +665
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 660
        +
        +def requires=(paths)
        +  RSpec.deprecate("RSpec::Core::Configuration#requires=(paths)",
        +                  :replacement => "paths.each {|path| require path}")
        +  paths.map {|path| require path}
        +  @requires += paths
        +end
        +
        +
        + +
        +

        + + - (Object) safe_extend(mod, host) + + + + + +

        + + + + +
        +
        +
        +
        +1042
        +1043
        +1044
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1042
        +
        +def safe_extend(mod, host)
        +  host.extend(mod) unless (class << host; self; end) < mod
        +end
        +
        +
        + +
        +

        + + - (Object) seed=(seed) + + + + + +

        +
        +

        Sets the seed value and sets order='rand'

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1092
        +1093
        +1094
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1092
        +
        +def seed=(seed)
        +  order_and_seed_from_seed(seed)
        +end
        +
        +
        + +
        +

        + + - (Object) show_failures_in_pending_blocks + + + + + +

        + + + + +
        +
        +
        +
        +226
        +227
        +228
        +229
        +230
        +231
        +232
        +233
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 226
        +
        +def show_failures_in_pending_blocks
        +  RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, ''))
        +    |RSpec.configuration.show_failures_in_pending_blocks is being removed
        +    |with no replacement. Called from #{CallerFilter.first_non_rspec_line}.
        +  EOS
        +
        +  @show_failures_in_pending_blocks
        +end
        +
        +
        + +
        +

        + + - (Object) show_failures_in_pending_blocks=(value) + + + + + +

        +
        +

        When a block passed to pending fails (as expected), display the failure +without reporting it as a failure (default: false).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +217
        +218
        +219
        +220
        +221
        +222
        +223
        +224
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 217
        +
        +def show_failures_in_pending_blocks=(value)
        +  RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, ''))
        +    |RSpec.configuration.show_failures_in_pending_blocks is being removed
        +    |with no replacement. Called from #{CallerFilter.first_non_rspec_line}.
        +  EOS
        +
        +  @show_failures_in_pending_blocks = value
        +end
        +
        +
        + +
        +

        + + - (Boolean) show_failures_in_pending_blocks? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +235
        +236
        +237
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 235
        +
        +def show_failures_in_pending_blocks?
        +  !!show_failures_in_pending_blocks
        +end
        +
        +
        + +
        +

        + + - (Object) treat_symbols_as_metadata_keys_with_true_values=(value) + + + + + +

        + + + + +
        +
        +
        +
        +255
        +256
        +257
        +258
        +259
        +260
        +261
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 255
        +
        +def (value)
        +  unless value
        +    RSpec.deprecate("RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values = false")
        +  end
        +
        +  @treat_symbols_as_metadata_keys_with_true_values = value
        +end
        +
        +
        + +
        +

        + + - (Object) warnings + + + + + +

        + + + + +
        +
        +
        +
        +1253
        +1254
        +1255
        +1256
        +1257
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1253
        +
        +def warnings
        +  RSpec.deprecate("`RSpec::Core::Configuration#warnings`",
        +                  :replacement => "`RSpec::Core::Configuration#warnings?`")
        +  warnings?
        +end
        +
        +
        + +
        +

        + + - (Object) warnings=(value) + + + + + +

        +
        +

        Set Ruby warnings on or off

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1245
        +1246
        +1247
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1245
        +
        +def warnings= value
        +  $VERBOSE = !!value
        +end
        +
        +
        + +
        +

        + + - (Boolean) warnings? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +1249
        +1250
        +1251
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1249
        +
        +def warnings?
        +  $VERBOSE
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Configuration/ExposeCurrentExample.html b/source/documentation/2.99/rspec-core/RSpec/Core/Configuration/ExposeCurrentExample.html new file mode 100644 index 000000000..674f7ad50 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Configuration/ExposeCurrentExample.html @@ -0,0 +1,105 @@ + + + + + + Module: RSpec::Core::Configuration::ExposeCurrentExample + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Configuration::ExposeCurrentExample + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/configuration.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Configuration/MustBeConfiguredBeforeExampleGroupsError.html b/source/documentation/2.99/rspec-core/RSpec/Core/Configuration/MustBeConfiguredBeforeExampleGroupsError.html new file mode 100644 index 000000000..c4733a246 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Configuration/MustBeConfiguredBeforeExampleGroupsError.html @@ -0,0 +1,123 @@ + + + + + + Exception: RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Exception: RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError + + + +

        + +
        + +
        Inherits:
        +
        + StandardError + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/configuration.rb
        + +
        +
        + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/DRbCommandLine.html b/source/documentation/2.99/rspec-core/RSpec/Core/DRbCommandLine.html new file mode 100644 index 000000000..0b700191d --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/DRbCommandLine.html @@ -0,0 +1,322 @@ + + + + + + Class: RSpec::Core::DRbCommandLine + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::DRbCommandLine + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/drb_command_line.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (DRbCommandLine) initialize(options) + + + + + +

        +
        +

        Returns a new instance of DRbCommandLine

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/drb_command_line.rb', line 7
        +
        +def initialize(options)
        +  @options = options
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) drb_port + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/core/drb_command_line.rb', line 11
        +
        +def drb_port
        +  @options.options[:drb_port] || ENV['RSPEC_DRB'] || 8989
        +end
        +
        +
        + +
        +

        + + - (Object) run(err, out) + + + + + +

        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/core/drb_command_line.rb', line 15
        +
        +def run(err, out)
        +  begin
        +    DRb.start_service("druby://localhost:0")
        +  rescue SocketError, Errno::EADDRNOTAVAIL
        +    DRb.start_service("druby://:0")
        +  end
        +  spec_server = DRbObject.new_with_uri("druby://127.0.0.1:#{drb_port}")
        +  spec_server.run(@options.drb_argv, err, out)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/DSL.html b/source/documentation/2.99/rspec-core/RSpec/Core/DSL.html new file mode 100644 index 000000000..983b8d9fb --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/DSL.html @@ -0,0 +1,213 @@ + + + + + + Module: RSpec::Core::DSL + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::DSL + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/dsl.rb
        + +
        +
        + +

        Overview

        +
        +

        Adds the describe method to the top-level namespace.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) describe(*args, &example_group_block) + + + + + +

        +
        +

        Generates a subclass of ExampleGroup

        + +

        Examples:

        + +
        describe "something" do
        +  it "does something" do
        +    # example code goes here
        +  end
        +end
        +
        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/dsl.rb', line 17
        +
        +def describe(*args, &example_group_block)
        +  RSpec::Core::ExampleGroup.describe(*args, &example_group_block).register
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/DeprecatedMutableArrayProxy.html b/source/documentation/2.99/rspec-core/RSpec/Core/DeprecatedMutableArrayProxy.html new file mode 100644 index 000000000..ad1d6ffb0 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/DeprecatedMutableArrayProxy.html @@ -0,0 +1,200 @@ + + + + + + Class: RSpec::Core::DeprecatedMutableArrayProxy + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::DeprecatedMutableArrayProxy + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/deprecated_mutable_array_proxy.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (DeprecatedMutableArrayProxy) initialize(array) + + + + + +

        +
        +

        Returns a new instance of DeprecatedMutableArrayProxy

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/core/deprecated_mutable_array_proxy.rb', line 5
        +
        +def initialize(array)
        +  @array = array
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Deprecation.html b/source/documentation/2.99/rspec-core/RSpec/Core/Deprecation.html new file mode 100644 index 000000000..73f26ac65 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Deprecation.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Core::Deprecation + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Deprecation + + + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec
        + + + +
        Defined in:
        +
        lib/rspec/core/deprecation.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Example.html b/source/documentation/2.99/rspec-core/RSpec/Core/Example.html new file mode 100644 index 000000000..bcdbd7248 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Example.html @@ -0,0 +1,926 @@ + + + + + + Class: RSpec::Core::Example + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Example + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example.rb
        + +
        +
        + +

        Overview

        +
        +

        Wrapper for an instance of a subclass of ExampleGroup. An instance of +Example is returned by the example method +exposed to examples, before and after hooks, +and yielded to around hooks.

        + +

        Useful for configuring logging and/or taking some action based +on the state of an example's metadata.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |config|
        +  config.before do
        +    log example.description
        +  end
        +
        +  config.after do
        +    log example.description
        +  end
        +
        +  config.around do |ex|
        +    log example.description
        +    ex.run
        +  end
        +end
        +
        +shared_examples "auditable" do
        +  it "does something" do
        +    log "#{example.full_description}: #{auditable.inspect}"
        +    auditable.should do_something
        +  end
        +end
        + +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + Modules: Procsy + + + + +

        + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) exception + + + + + + + + + readonly + + + + + + + + + +

          Returns the first exception raised in the context of running this example (nil if no exception is raised).

          +
          + +
        • + + +
        • + + + - (Object) metadata + + + + + + + + + readonly + + + + + + + + + +

          Returns the metadata object associated with this example.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Example) initialize(example_group_class, description, metadata, example_block = nil) + + + + + +

        +
        +

        Creates a new instance of Example.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group_class + + + + + + + — +

          the subclass of ExampleGroup in which this Example is declared

          +
          + +
        • + +
        • + + description + + + + + + + — +

          the String passed to the it method (or alias)

          +
          + +
        • + +
        • + + metadata + + + + + + + — +

          additional args passed to it to be used as metadata

          +
          + +
        • + +
        • + + example_block + + + + + + (defaults to: nil) + + + — +

          the block of code that represents the example

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core/example.rb', line 79
        +
        +def initialize(example_group_class, description, , example_block=nil)
        +  @example_group_class, @options, @example_block = example_group_class, , example_block
        +  @metadata  = @example_group_class..for_example(description, )
        +  @example_group_instance = @exception = nil
        +  @pending_declared_in_example = false
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) exception (readonly) + + + + + +

        +
        +

        Returns the first exception raised in the context of running this +example (nil if no exception is raised)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/example.rb', line 60
        +
        +def exception
        +  @exception
        +end
        +
        +
        + + + +
        +

        + + - (Object) metadata (readonly) + + + + + +

        +
        +

        Returns the metadata object associated with this example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/core/example.rb', line 65
        +
        +def 
        +  @metadata
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) procsy(metadata, &proc) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Wraps the example block in a Proc so it can invoked using run or +call in around hooks.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +145
        +146
        +147
        +
        +
        # File 'lib/rspec/core/example.rb', line 145
        +
        +def self.procsy(, &proc)
        +  proc.extend(Procsy).with()
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        +
        +

        Returns the string submitted to example or its aliases (e.g. +specify, it, etc). If no string is submitted (e.g. it { is_expected.to +do_something }) it returns the message generated by the matcher if +there is one, otherwise returns a message including the location of the +example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +54
        +
        +
        # File 'lib/rspec/core/example.rb', line 51
        +
        +def description
        +  description = [:description].to_s.empty? ? "example at #{location}" : [:description]
        +  RSpec.configuration.format_docstrings_block.call(description)
        +end
        +
        +
        + +
        +

        + + - (Object) example_group + + + + + +

        +
        +

        Returns the example group class that provides the context for running +this example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +
        +
        # File 'lib/rspec/core/example.rb', line 95
        +
        +def example_group
        +  @example_group_class
        +end
        +
        +
        + +
        +

        + + - (Object) options + + + + + +

        +
        +
        Deprecated.

        access options via metadata instead

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/core/example.rb', line 87
        +
        +def options
        +  RSpec.deprecate("`RSpec::Core::Example#options`",
        +                  :replacement => "`RSpec::Core::Example#metadata`")
        +  @options
        +end
        +
        +
        + +
        +

        + + - (Object) run(example_group_instance, reporter) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        instance_evals the block passed to the constructor in the context of +the instance of RSpec::Core::ExampleGroup.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group_instance + + + + + + + — +

          the instance of an ExampleGroup subclass

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +
        +
        # File 'lib/rspec/core/example.rb', line 105
        +
        +def run(example_group_instance, reporter)
        +  @example_group_instance = example_group_instance
        +  RSpec.current_example = self
        +
        +  start(reporter)
        +
        +  begin
        +    unless pending
        +      with_around_each_hooks do
        +        begin
        +          run_before_each
        +          @example_group_instance.instance_eval_with_args(self, &@example_block)
        +        rescue Pending::SkipDeclaredInExample => e
        +          @pending_declared_in_example = e.message
        +        rescue Exception => e
        +          set_exception(e)
        +        ensure
        +          assign_generated_description
        +          run_after_each
        +        end
        +      end
        +    end
        +  rescue Exception => e
        +    set_exception(e)
        +  ensure
        +    @example_group_instance.instance_variables.each do |ivar|
        +      @example_group_instance.instance_variable_set(ivar, nil)
        +    end
        +    @example_group_instance = nil
        +  end
        +
        +  finish(reporter)
        +ensure
        +  RSpec.current_example = nil
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Example/Procsy.html b/source/documentation/2.99/rspec-core/RSpec/Core/Example/Procsy.html new file mode 100644 index 000000000..3873fad02 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Example/Procsy.html @@ -0,0 +1,408 @@ + + + + + + Module: RSpec::Core::Example::Procsy + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Example::Procsy + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example.rb
        + +
        +
        + +

        Overview

        +
        + +
        + Note: +

        Procsy, itself, is not a public API, but we're documenting it +here to document how to interact with the object yielded to an +around hook.

        +
        +
        + +

        Used to extend a Proc with behavior that makes it look something like +an RSpec::Core::Example in an around hook.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |c|
        +  c.around do |ex| # ex is a Proc extended with Procsy
        +    if ex.[:key] == :some_value && some_global_condition
        +      raise "some message"
        +    end
        +    ex.run         # run delegates to ex.call
        +  end
        +end
        + +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (Object) extended(proc) + + + + + + + + + + + private + + +

          Adds a run method to the extended Proc, allowing it to be invoked in an around hook using either run or call.

          +
          + +
        • + + +
        + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) metadata (readonly) + + + + + +

        +
        +

        The metadata of the RSpec::Core::Example instance.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +168
        +169
        +170
        +
        +
        # File 'lib/rspec/core/example.rb', line 168
        +
        +def 
        +  @metadata
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) extended(proc) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Adds a run method to the extended Proc, allowing it to be invoked +in an around hook using either +run or call.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + + + + (Proc) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +175
        +176
        +177
        +178
        +179
        +
        +
        # File 'lib/rspec/core/example.rb', line 175
        +
        +def self.extended(proc)
        +  # @api public
        +  # Foo bar
        +  def proc.run; call; end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) with(metadata) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +182
        +183
        +184
        +185
        +
        +
        # File 'lib/rspec/core/example.rb', line 182
        +
        +def with()
        +  @metadata = 
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/ExampleGroup.html b/source/documentation/2.99/rspec-core/RSpec/Core/ExampleGroup.html new file mode 100644 index 000000000..a42b31242 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/ExampleGroup.html @@ -0,0 +1,2655 @@ + + + + + + Class: RSpec::Core::ExampleGroup + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::ExampleGroup + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        Hooks, SharedExampleGroup
        + + + + +
        Includes:
        +
        MemoizedHelpers, Pending, SharedExampleGroup
        + + + + + +
        Defined in:
        +
        lib/rspec/core/example_group.rb
        + +
        +
        + +

        Overview

        +
        +

        ExampleGroup and Example are the main structural elements of +rspec-core. Consider this example:

        + +
        describe Thing do
        +  it "does something" do
        +  end
        +end
        +
        + +

        The object returned by describe Thing is a subclass of ExampleGroup. +The object returned by it "does something" is an instance of Example, +which serves as a wrapper for an instance of the ExampleGroup in which it +is declared.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: DescriptionBehaviorChange + + +

        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Pending

        +

        Pending::NOT_YET_IMPLEMENTED, Pending::NO_REASON_GIVEN

        + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from SharedExampleGroup

        +

        registry, share_as, share_examples_for, shared_example_groups, shared_examples

        + + + + + + + + + +

        Methods included from Hooks

        +

        after, append_after, around, before, prepend_before

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

        Methods included from Pending

        +

        const_missing, #pending_no_warning

        + + + + + + + + + +

        Methods included from MemoizedHelpers

        +

        #is_expected, #should, #should_not, #subject

        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) alias_example_to(name, extra = {}) + + + + + +

        +
        + +
        + Note: +

        Use with caution. This extends the language used in your +specs, but does not add any additional documentation. We use this +in rspec to define methods like focus and xit, but we also add +docs for those methods.

        +
        +
        + +

        Works like alias_method :name, :example with the added benefit of +assigning default metadata to the generated example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +175
        +176
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 172
        +
        +def self.alias_example_to name, extra={}
        +  RSpec.deprecate("`RSpec::Core::ExampleGroup.alias_example_to`",
        +                  :replacement => "`RSpec::Core::Configuration#alias_example_to`")
        +  define_example_method name, extra
        +end
        +
        +
        + +
        +

        + + + (Object) alias_it_behaves_like_to(name, *args, &block) + + + + + +

        +
        + +
        + Note: +

        Use with caution. This extends the language used in your +specs, but does not add any additional documentation. We use this +in rspec to define it_should_behave_like (for backward +compatibility), but we also add docs for that method.

        +
        +
        + +

        Works like alias_method :name, :it_behaves_like with the added +benefit of assigning default metadata to the generated example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +208
        +209
        +210
        +211
        +212
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 208
        +
        +def self.alias_it_behaves_like_to name, *args, &block
        +  RSpec.deprecate("`RSpec::Core::ExampleGroup.alias_it_behaves_like_to`",
        +                  :replacement => "`RSpec::Core::Configuration#alias_it_behaves_like_to`")
        +  define_nested_shared_group_method name, *args, &block
        +end
        +
        +
        + +
        +

        + + + (Object) describe(*args, &example_group_block) + + + + Also known as: + context + + + + +

        +
        +

        Generates a subclass of this example group which inherits +everything except the examples themselves.

        + +

        Examples

        + +
        describe "something" do # << This describe method is defined in
        +                        # << RSpec::Core::DSL, included in the
        +                        # << global namespace
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  describe "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        +
        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +323
        +324
        +325
        +326
        +327
        +328
        +329
        +330
        +331
        +332
        +333
        +334
        +335
        +336
        +337
        +338
        +339
        +340
        +341
        +342
        +343
        +344
        +345
        +346
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 323
        +
        +def self.describe(*args, &example_group_block)
        +  @_subclass_count ||= 0
        +  @_subclass_count += 1
        +
        +  if Symbol === args.first || Hash === args.first
        +    description_arg_behavior_changing_in_rspec_3 = DescriptionBehaviorChange.new(
        +      args.first, CallerFilter.first_non_rspec_line
        +    )
        +  end
        +
        +  args << {} unless args.last.is_a?(Hash)
        +  args.last.update(
        +    :example_group_block => example_group_block,
        +    :description_arg_behavior_changing_in_rspec_3 => description_arg_behavior_changing_in_rspec_3
        +  )
        +
        +  # TODO 2010-05-05: Because we don't know if const_set is thread-safe
        +  child = const_set(
        +    "Nested_#{@_subclass_count}",
        +    subclass(self, args, &example_group_block)
        +  )
        +  children << child
        +  child
        +end
        +
        +
        + +
        +

        + + + (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 46
        +
        +def description
        +  description = [:example_group][:description]
        +  RSpec.configuration.format_docstrings_block.call(description)
        +end
        +
        +
        + +
        +

        + + + (Object) focused(desc = nil, *args, &block) + + + + + +

        +
        +

        Shortcut to define an example with :focus => true

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • example
        • + +
        + +
        + + + + +
        +
        +
        +
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 154
        +
        +def self.focused(desc=nil, *args, &block)
        +  RSpec.deprecate("`RSpec::Core::ExampleGroup.focused`",
        +                  :replacement => "`RSpec::Core::ExampleGroup.focus`")
        +
        +   = Hash === args.last ? args.pop : {}
        +  .merge!(:focus => true, :focused => true)
        +  args << 
        +
        +  example(desc, *args, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) include_context(name, *args, &block) + + + + + +

        +
        +

        Includes shared content mapped to name directly in the group in which +it is declared, as opposed to it_behaves_like, which creates a nested +group. If given a block, that block is also eval'd in the current context.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +219
        +220
        +221
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 219
        +
        +def self.include_context(name, *args, &block)
        +  find_and_eval_shared("context", name, *args, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) include_examples(name, *args, &block) + + + + + +

        +
        +

        Includes shared content mapped to name directly in the group in which +it is declared, as opposed to it_behaves_like, which creates a nested +group. If given a block, that block is also eval'd in the current context.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +228
        +229
        +230
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 228
        +
        +def self.include_examples(name, *args, &block)
        +  find_and_eval_shared("examples", name, *args, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) metadata + + + + + +

        +
        +

        The Metadata object associated with this group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +292
        +293
        +294
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 292
        +
        +def self.
        +  @metadata if defined?(@metadata)
        +end
        +
        +
        + +
        +

        + + + (Object) run(reporter) + + + + + +

        +
        +

        Runs all the examples in this group

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +487
        +488
        +489
        +490
        +491
        +492
        +493
        +494
        +495
        +496
        +497
        +498
        +499
        +500
        +501
        +502
        +503
        +504
        +505
        +506
        +507
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 487
        +
        +def self.run(reporter)
        +  if RSpec.wants_to_quit
        +    RSpec.clear_remaining_example_groups if top_level?
        +    return
        +  end
        +  reporter.example_group_started(self)
        +
        +  begin
        +    run_before_all_hooks(new)
        +    result_for_this_group = run_examples(reporter)
        +    results_for_descendants = children.ordered.map {|child| child.run(reporter)}.all?
        +    result_for_this_group && results_for_descendants
        +  rescue Exception => ex
        +    RSpec.wants_to_quit = true if fail_fast?
        +    fail_filtered_examples(ex, reporter)
        +  ensure
        +    run_after_all_hooks(new)
        +    before_all_ivars.clear
        +    reporter.example_group_finished(self)
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) warn_unexpected_args + + + + + +

        +
        +

        no-op for Ruby < 1.9

        + +

        Ruby 1.8 reports lambda {}.arity == -1, so can't support this warning +reliably

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +260
        +261
        +262
        +263
        +264
        +265
        +266
        +267
        +268
        +269
        +270
        +271
        +272
        +273
        +274
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 260
        +
        +def self.warn_unexpected_args(label, name, args, shared_block)
        +  if !args.empty? && shared_block.parameters.count == 0
        +    if shared_example_groups[args.first]
        +      warn <<-WARNING
        +shared #{label} support#{'s' if /context/ =~ label.to_s} the name of only one example group, received #{[name, *args].inspect}
        +called from #{CallerFilter.first_non_rspec_line}"
        +WARNING
        +    else
        +        warn <<-WARNING
        +shared #{label} #{name.inspect} expected #{shared_block.arity} args, got #{args.inspect}
        +called from #{CallerFilter.first_non_rspec_line}"
        +WARNING
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) described_class + + + + + +

        +
        +

        Returns the class or module passed to the describe method (or alias). +Returns nil if the subject is not a class or module.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        describe Thing do
        +  it "does something" do
        +    described_class == Thing
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +613
        +614
        +615
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 613
        +
        +def described_class
        +  self.class.described_class
        +end
        +
        +
        + +
        +

        + + - (Object) example + + + + + +

        +
        +
        Deprecated.

        use a block argument

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +118
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 118
        +
        +define_example_method :example
        +
        +
        + +
        +

        + + - (Object) example=(current_example) + + + + + +

        + + + + +
        +
        +
        +
        +565
        +566
        +567
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 565
        +
        +def example=(current_example)
        +  RSpec.current_example = current_example
        +end
        +
        +
        + +
        +

        + + - (Object) fit {|Example| ... } + + + + + +

        +
        +

        Shortcut to define an example with :focus => true

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        +
          + +
        • example
        • + +
        + +
        + + + + +
        +
        +
        +
        +133
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 133
        +
        +define_example_method :fit,     :focused => true, :focus => true
        +
        +
        + +
        +

        + + - (Object) focus {|Example| ... } + + + + + +

        +
        +

        Shortcut to define an example with :focus => true

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        +
          + +
        • example
        • + +
        + +
        + + + + +
        +
        +
        +
        +130
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 130
        +
        +define_example_method :focus,   :focused => true, :focus => true
        +
        +
        + +
        +

        + + - (Object) it {|Example| ... } + + + + + +

        +
        +

        Defines an example within a group.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +121
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 121
        +
        +define_example_method :it
        +
        +
        + +
        +

        + + - (Object) it_behaves_like + + + + + +

        +
        +

        Generates a nested example group and includes the shared content +mapped to name in the nested group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +196
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 196
        +
        +define_nested_shared_group_method :it_behaves_like, "behaves like"
        +
        +
        + +
        +

        + + - (Object) it_should_behave_like + + + + + +

        +
        +

        Generates a nested example group and includes the shared content +mapped to name in the nested group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +199
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 199
        +
        +define_nested_shared_group_method :it_should_behave_like
        +
        +
        + +
        +

        + + - (Object) pending {|Example| ... } + + + + + +

        +
        +

        Shortcut to define an example with :pending => true

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        +
          + +
        • example
        • + +
        + +
        + + + + +
        +
        +
        +
        +137
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 137
        +
        +define_example_method :pending,  :pending => true
        +
        +
        + +
        +

        + + - (Object) running_example + + + + + +

        +
        +
        Deprecated.

        use a block argument

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +576
        +577
        +578
        +579
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 576
        +
        +def running_example
        +  warn_deprecation_of_example_accessor :running_example
        +  RSpec.current_example
        +end
        +
        +
        + +
        +

        + + - (Object) skip {|Example| ... } + + + + + +

        +
        +

        Shortcut to define an example with :pending => true +Backported from RSpec 3 to aid migration.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        +
          + +
        • example
        • + +
        + +
        + + + + +
        +
        +
        +
        +141
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 141
        +
        +define_example_method :skip,     :pending => true
        +
        +
        + +
        +

        + + - (Object) specify {|Example| ... } + + + + + +

        +
        +

        Defines an example within a group. +This is here primarily for backward compatibility with early versions +of RSpec which used context and specify instead of describe and +it.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +126
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 126
        +
        +define_example_method :specify
        +
        +
        + +
        +

        + + - (Object) warn_deprecation_of_example_accessor(name) + + + + + +

        + + + + +
        +
        +
        +
        +581
        +582
        +583
        +584
        +585
        +586
        +587
        +588
        +589
        +590
        +591
        +592
        +593
        +594
        +595
        +596
        +597
        +598
        +599
        +600
        +601
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 581
        +
        +def warn_deprecation_of_example_accessor(name)
        +  RSpec.warn_deprecation(<<-EOS.gsub(/^\s*\|/, ''))
        +    |RSpec::Core::ExampleGroup##{name} is deprecated and will be removed
        +    |in RSpec 3. There are a few options for what you can use instead:
        +    |
        +    |  - rspec-core's DSL methods (`it`, `before`, `after`, `let`, `subject`, etc)
        +    |    now yield the example as a block argument, and that is the recommended
        +    |    way to access the current example from those contexts.
        +    |  - The current example is now exposed via `RSpec.current_example`,
        +    |    which is accessible from any context.
        +    |  - If you can't update the code at this call site (e.g. because it is in
        +    |    an extension gem), you can use this snippet to continue making this
        +    |    method available in RSpec 2.99 and RSpec 3:
        +    |
        +    |      RSpec.configure do |c|
        +    |        c.expose_current_running_example_as :#{name}
        +    |      end
        +    |
        +    |(Called from #{CallerFilter.first_non_rspec_line})
        +  EOS
        +end
        +
        +
        + +
        +

        + + - (Object) xexample {|Example| ... } + + + + + +

        +
        +

        Shortcut to define an example with :pending => 'Temporarily disabled with xexample'

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        +
          + +
        • example
        • + +
        + +
        + + + + +
        +
        +
        +
        +144
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 144
        +
        +define_example_method :xexample, :pending => 'Temporarily disabled with xexample'
        +
        +
        + +
        +

        + + - (Object) xit {|Example| ... } + + + + + +

        +
        +

        Shortcut to define an example with :pending => 'Temporarily disabled with xit'

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        +
          + +
        • example
        • + +
        + +
        + + + + +
        +
        +
        +
        +147
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 147
        +
        +define_example_method :xit,      :pending => 'Temporarily disabled with xit'
        +
        +
        + +
        +

        + + - (Object) xspecify {|Example| ... } + + + + + +

        +
        +

        Shortcut to define an example with :pending => 'Temporarily disabled with xspecify'

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example object

          +
          + +
        • + +
        + +

        See Also:

        +
          + +
        • example
        • + +
        + +
        + + + + +
        +
        +
        +
        +150
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 150
        +
        +define_example_method :xspecify, :pending => 'Temporarily disabled with xspecify'
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/ExampleGroup/DescriptionBehaviorChange.html b/source/documentation/2.99/rspec-core/RSpec/Core/ExampleGroup/DescriptionBehaviorChange.html new file mode 100644 index 000000000..0500583e4 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/ExampleGroup/DescriptionBehaviorChange.html @@ -0,0 +1,303 @@ + + + + + + Class: RSpec::Core::ExampleGroup::DescriptionBehaviorChange + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::ExampleGroup::DescriptionBehaviorChange + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example_group.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) arg + + + + + + + + + + + + + + + + +

          Returns the value of attribute arg.

          +
          + +
        • + + +
        • + + + - (Object) call_site + + + + + + + + + + + + + + + + +

          Returns the value of attribute call_site.

          +
          + +
        • + + +
        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) arg + + + + + +

        +
        +

        Returns the value of attribute arg

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of arg

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +348
        +349
        +350
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 348
        +
        +def arg
        +  @arg
        +end
        +
        +
        + + + +
        +

        + + - (Object) call_site + + + + + +

        +
        +

        Returns the value of attribute call_site

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of call_site

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +348
        +349
        +350
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 348
        +
        +def call_site
        +  @call_site
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager.html b/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager.html new file mode 100644 index 000000000..f2186ce88 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager.html @@ -0,0 +1,1301 @@ + + + + + + Class: RSpec::Core::FilterManager + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::FilterManager + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/filter_manager.rb
        + +
        +
        + +

        Overview

        +
        +

        Manages the filtering of examples and groups by matching tags declared on +the command line or options files, or filters declared via +RSpec.configure, with hash key/values submitted within example group +and/or example declarations. For example, given this declaration:

        + +
        describe Thing, :awesome => true do
        +  it "does something" do
        +    # ...
        +  end
        +end
        +
        + +

        That group (or any other with :awesome => true) would be filtered in +with any of the following commands:

        + +
        rspec --tag awesome:true
        +rspec --tag awesome
        +rspec -t awesome:true
        +rspec -t awesome
        +
        + +

        Prefixing the tag names with ~ negates the tags, thus excluding this group with +any of:

        + +
        rspec --tag ~awesome:true
        +rspec --tag ~awesome
        +rspec -t ~awesome:true
        +rspec -t ~awesome
        +
        + +

        Options files and command line overrides

        + +

        Tag declarations can be stored in .rspec, ~/.rspec, or a custom +options file. This is useful for storing defaults. For example, let's +say you've got some slow specs that you want to suppress most of the +time. You can tag them like this:

        + +
        describe Something, :slow => true do
        +
        + +

        And then store this in .rspec:

        + +
        --tag ~slow:true
        +
        + +

        Now when you run rspec, that group will be excluded.

        + +

        Overriding

        + +

        Of course, you probably want to run them sometimes, so you can override +this tag on the command line like this:

        + +
        rspec --tag slow:true
        +
        + +

        RSpec.configure

        + +

        You can also store default tags with RSpec.configure. We use tag on +the command line (and in options files like .rspec), but for historical +reasons we use the term filter in `RSpec.configure:

        + +
        RSpec.configure do |c|
        +  c.filter_run_including :foo => :bar
        +  c.filter_run_excluding :foo => :bar
        +end
        +
        + +

        These declarations can also be overridden from the command line.

        + + +
        +
        +

        Defined Under Namespace

        +

        + + + Modules: BackwardCompatibility, Describable + + + + +

        + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) exclusions + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute exclusions.

          +
          + +
        • + + +
        • + + + - (Object) inclusions + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute inclusions.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (FilterManager) initialize + + + + + +

        +
        +

        Returns a new instance of FilterManager

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +145
        +146
        +147
        +148
        +149
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 145
        +
        +def initialize
        +  @exclusions = self.class.default_exclusions.dup.extend(Describable)
        +  @inclusions = {}.extend(Describable)
        +  extend(BackwardCompatibility)
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) exclusions (readonly) + + + + + +

        +
        +

        Returns the value of attribute exclusions

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +143
        +144
        +145
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 143
        +
        +def exclusions
        +  @exclusions
        +end
        +
        +
        + + + +
        +

        + + - (Object) inclusions (readonly) + + + + + +

        +
        +

        Returns the value of attribute inclusions

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +143
        +144
        +145
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 143
        +
        +def inclusions
        +  @inclusions
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) const_missing(name) + + + + + +

        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 70
        +
        +def const_missing(name)
        +  case name
        +  when :DEFAULT_EXCLUSIONS
        +    RSpec.deprecate("RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS is deprecated")
        +    default_exclusions
        +  when :STANDALONE_FILTERS
        +    RSpec.deprecate("RSpec::Core::FilterManager::STANDALONE_FILTERS is deprecated")
        +    standalone_filters
        +  else
        +    super
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_location(file_path, line_numbers) + + + + + +

        + + + + +
        +
        +
        +
        +151
        +152
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 151
        +
        +def add_location(file_path, line_numbers)
        +  # locations is a hash of expanded paths to arrays of line
        +  # numbers to match against. e.g.
        +  #   { "path/to/file.rb" => [37, 42] }
        +  locations = @inclusions.delete(:locations) || Hash.new {|h,k| h[k] = []}
        +  locations[File.expand_path(file_path)].push(*line_numbers)
        +  @inclusions.replace(:locations => locations)
        +  @exclusions.clear
        +end
        +
        +
        + +
        +

        + + - (Boolean) empty? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +161
        +162
        +163
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 161
        +
        +def empty?
        +  inclusions.empty? && exclusions.rules_empty?
        +end
        +
        +
        + +
        +

        + + - (Object) exclude(*args) + + + + + +

        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 169
        +
        +def exclude(*args)
        +  merge(@exclusions, @inclusions, *args)
        +end
        +
        +
        + +
        +

        + + - (Object) exclude!(*args) + + + + + +

        + + + + +
        +
        +
        +
        +173
        +174
        +175
        +176
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 173
        +
        +def exclude!(*args)
        +  RSpec.deprecate("FilterManager#exclude! is deprecated. Use FilterManager#exclude_only")
        +  exclude_only(*args)
        +end
        +
        +
        + +
        +

        + + - (Boolean) exclude?(example) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +186
        +187
        +188
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 186
        +
        +def exclude?(example)
        +  @exclusions.empty? ? false : example.any_apply?(@exclusions)
        +end
        +
        +
        + +
        +

        + + - (Object) exclude_only(*args) + + + + + +

        + + + + +
        +
        +
        +
        +178
        +179
        +180
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 178
        +
        +def exclude_only(*args)
        +  replace(@exclusions, @inclusions, *args)
        +end
        +
        +
        + +
        +

        + + - (Object) exclude_with_low_priority(*args) + + + + + +

        + + + + +
        +
        +
        +
        +182
        +183
        +184
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 182
        +
        +def exclude_with_low_priority(*args)
        +  reverse_merge(@exclusions, @inclusions, *args)
        +end
        +
        +
        + +
        +

        + + - (Object) include(*args) + + + + + +

        + + + + +
        +
        +
        +
        +190
        +191
        +192
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 190
        +
        +def include(*args)
        +  unless_standalone(*args) { merge(@inclusions, @exclusions, *args) }
        +end
        +
        +
        + +
        +

        + + - (Object) include!(*args) + + + + + +

        + + + + +
        +
        +
        +
        +194
        +195
        +196
        +197
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 194
        +
        +def include!(*args)
        +  RSpec.deprecate("FilterManager#include! is deprecated. Use FilterManager#include_only")
        +  include_only(*args)
        +end
        +
        +
        + +
        +

        + + - (Boolean) include?(example) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +207
        +208
        +209
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 207
        +
        +def include?(example)
        +  @inclusions.empty? ? true : example.any_apply?(@inclusions)
        +end
        +
        +
        + +
        +

        + + - (Object) include_only(*args) + + + + + +

        + + + + +
        +
        +
        +
        +199
        +200
        +201
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 199
        +
        +def include_only(*args)
        +  unless_standalone(*args) { replace(@inclusions, @exclusions, *args) }
        +end
        +
        +
        + +
        +

        + + - (Object) include_with_low_priority(*args) + + + + + +

        + + + + +
        +
        +
        +
        +203
        +204
        +205
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 203
        +
        +def include_with_low_priority(*args)
        +  unless_standalone(*args) { reverse_merge(@inclusions, @exclusions, *args) }
        +end
        +
        +
        + +
        +

        + + - (Object) prune(examples) + + + + + +

        + + + + +
        +
        +
        +
        +165
        +166
        +167
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 165
        +
        +def prune(examples)
        +  examples.select {|e| !exclude?(e) && include?(e)}
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager/BackwardCompatibility.html b/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager/BackwardCompatibility.html new file mode 100644 index 000000000..686766c8d --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager/BackwardCompatibility.html @@ -0,0 +1,362 @@ + + + + + + Module: RSpec::Core::FilterManager::BackwardCompatibility + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::FilterManager::BackwardCompatibility + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/filter_manager.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) _warn_deprecated_key(key, updates) + + + + + +

        +
        +

        Emits a deprecation warning for keys that will not be supported in +the future.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +137
        +138
        +139
        +140
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 137
        +
        +def _warn_deprecated_key(key, updates)
        +  RSpec.deprecate("FilterManager#exclude(#{key.inspect} => #{updates[key].inspect})")
        +  @exclusions[key] = updates.delete(key)
        +end
        +
        +
        + +
        +

        + + - (Object) _warn_deprecated_keys(updates) + + + + + +

        +
        +

        Supports a use case that probably doesn't exist: overriding the +if/unless procs.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +130
        +131
        +132
        +133
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 130
        +
        +def _warn_deprecated_keys(updates)
        +  _warn_deprecated_key(:unless, updates) if updates.has_key?(:unless)
        +  _warn_deprecated_key(:if, updates)     if updates.has_key?(:if)
        +end
        +
        +
        + +
        +

        + + - (Object) merge(orig, opposite, *updates) + + + + + +

        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +121
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 118
        +
        +def merge(orig, opposite, *updates)
        +  _warn_deprecated_keys(updates.last)
        +  super
        +end
        +
        +
        + +
        +

        + + - (Object) reverse_merge(orig, opposite, *updates) + + + + + +

        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 123
        +
        +def reverse_merge(orig, opposite, *updates)
        +  _warn_deprecated_keys(updates.last)
        +  super
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager/Describable.html b/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager/Describable.html new file mode 100644 index 000000000..df145293c --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/FilterManager/Describable.html @@ -0,0 +1,269 @@ + + + + + + Module: RSpec::Core::FilterManager::Describable + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::FilterManager::Describable + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/filter_manager.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        PROC_HEX_NUMBER = + +
        +
        /0x[0-9a-f]+\s?@/
        + +
        PROJECT_DIR = + +
        +
        File.expand_path('.')
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +104
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 101
        +
        +def description
        +  reject { |k, v| RSpec::Core::FilterManager.default_exclusions[k] == v }.inspect.
        +    gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)','').gsub('__is_lambda__=true','')
        +end
        +
        +
        + +
        +

        + + - (Boolean) empty_without_conditional_filters? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +106
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 106
        +
        +def empty_without_conditional_filters?
        +  RSpec.deprecate("(inclusion_filter | exclusion_filter)#empty_without_conditional_filters? is deprecated")
        +  rules_empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters.html new file mode 100644 index 000000000..e41c952e8 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters.html @@ -0,0 +1,197 @@ + + + + + + Module: RSpec::Core::Formatters + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Formatters + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters.rb,
        + lib/rspec/core/formatters/helpers.rb,
        lib/rspec/core/formatters/html_printer.rb,
        lib/rspec/core/formatters/console_codes.rb,
        lib/rspec/core/formatters/base_formatter.rb,
        lib/rspec/core/formatters/html_formatter.rb,
        lib/rspec/core/formatters/json_formatter.rb,
        lib/rspec/core/formatters/snippet_extractor.rb,
        lib/rspec/core/formatters/progress_formatter.rb,
        lib/rspec/core/formatters/base_text_formatter.rb,
        lib/rspec/core/formatters/text_mate_formatter.rb,
        lib/rspec/core/formatters/deprecation_formatter.rb,
        lib/rspec/core/formatters/documentation_formatter.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        Built-in Formatters

        + +
          +
        • progress (default) - prints dots for passing examples, F for failures, * for pending
        • +
        • documentation - prints the docstrings passed to describe and it methods (and their aliases)
        • +
        • html
        • +
        • textmate - html plus links to editor
        • +
        • json - useful for archiving data for subsequent analysis
        • +
        + +

        The progress formatter is the default, but you can choose any one or more of +the other formatters by passing with the --format (or -f for short) +command-line option, e.g.

        + +
        rspec --format documentation
        +
        + +

        You can also send the output of multiple formatters to different streams, e.g.

        + +
        rspec --format documentation --format html --out results.html
        +
        + +

        This example sends the output of the documentation formatter to $stdout, and +the output of the html formatter to results.html.

        + +

        Custom Formatters

        + +

        You can tell RSpec to use a custom formatter by passing its path and name to +the rspec commmand. For example, if you define MyCustomFormatter in +path/to/my_custom_formatter.rb, you would type this command:

        + +
        rspec --require path/to/my_custom_formatter.rb --format MyCustomFormatter
        +
        + +

        The reporter calls every formatter with this protocol:

        + +
          +
        • start(expected_example_count)
        • +
        • zero or more of the following + +
            +
          • example_group_started(group)
          • +
          • example_started(example)
          • +
          • example_passed(example)
          • +
          • example_failed(example)
          • +
          • example_pending(example)
          • +
          • message(string)
          • +
        • +
        • stop
        • +
        • start_dump
        • +
        • dump_pending
        • +
        • dump_failures
        • +
        • dump_summary(duration, example_count, failure_count, pending_count)
        • +
        • seed(value)
        • +
        • close
        • +
        + +

        You can either implement all of those methods or subclass +RSpec::Core::Formatters::BaseTextFormatter and override the methods you want +to enhance.

        + + +
        +
        +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + Modules: ConsoleCodes, Helpers + + + + Classes: BaseFormatter, BaseTextFormatter, DeprecationFormatter, DocumentationFormatter, HtmlFormatter, HtmlPrinter, JsonFormatter, Loader, ProgressFormatter, SnippetExtractor, TextMateFormatter + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/BaseFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/BaseFormatter.html new file mode 100644 index 000000000..590349f0a --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/BaseFormatter.html @@ -0,0 +1,2171 @@ + + + + + + Class: RSpec::Core::Formatters::BaseFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::BaseFormatter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Helpers
        + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/base_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        RSpec's built-in formatters are all subclasses of RSpec::Core::Formatters::BaseTextFormatter, +but the BaseTextFormatter documents all of the methods needed to be implemented by a formatter, +as they are called from the reporter.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        +

        Direct Known Subclasses

        +

        BaseTextFormatter, JsonFormatter

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) duration + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute duration.

          +
          + +
        • + + +
        • + + + - (Object) example_count + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute example_count.

          +
          + +
        • + + +
        • + + + - (Object) example_group + + + + + + + + + + + + + + + + +

          Returns the value of attribute example_group.

          +
          + +
        • + + +
        • + + + - (Object) examples + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute examples.

          +
          + +
        • + + +
        • + + + - (Object) failed_examples + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute failed_examples.

          +
          + +
        • + + +
        • + + + - (Object) failure_count + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute failure_count.

          +
          + +
        • + + +
        • + + + - (Object) output + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute output.

          +
          + +
        • + + +
        • + + + - (Object) pending_count + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute pending_count.

          +
          + +
        • + + +
        • + + + - (Object) pending_examples + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute pending_examples.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (BaseFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of BaseFormatter

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + output + + + + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 23
        +
        +def initialize(output)
        +  @output = output || StringIO.new
        +  @example_count = @pending_count = @failure_count = 0
        +  @examples = []
        +  @failed_examples = []
        +  @pending_examples = []
        +  @example_group = nil
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) duration (readonly) + + + + + +

        +
        +

        Returns the value of attribute duration

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 16
        +
        +def duration
        +  @duration
        +end
        +
        +
        + + + +
        +

        + + - (Object) example_count (readonly) + + + + + +

        +
        +

        Returns the value of attribute example_count

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 17
        +
        +def example_count
        +  @example_count
        +end
        +
        +
        + + + +
        +

        + + - (Object) example_group + + + + + +

        +
        +

        Returns the value of attribute example_group

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 15
        +
        +def example_group
        +  @example_group
        +end
        +
        +
        + + + +
        +

        + + - (Object) examples (readonly) + + + + + +

        +
        +

        Returns the value of attribute examples

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 16
        +
        +def examples
        +  @examples
        +end
        +
        +
        + + + +
        +

        + + - (Object) failed_examples (readonly) + + + + + +

        +
        +

        Returns the value of attribute failed_examples

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 18
        +
        +def failed_examples
        +  @failed_examples
        +end
        +
        +
        + + + +
        +

        + + - (Object) failure_count (readonly) + + + + + +

        +
        +

        Returns the value of attribute failure_count

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 17
        +
        +def failure_count
        +  @failure_count
        +end
        +
        +
        + + + +
        +

        + + - (Object) output (readonly) + + + + + +

        +
        +

        Returns the value of attribute output

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 16
        +
        +def output
        +  @output
        +end
        +
        +
        + + + +
        +

        + + - (Object) pending_count (readonly) + + + + + +

        +
        +

        Returns the value of attribute pending_count

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 17
        +
        +def pending_count
        +  @pending_count
        +end
        +
        +
        + + + +
        +

        + + - (Object) pending_examples (readonly) + + + + + +

        +
        +

        Returns the value of attribute pending_examples

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 18
        +
        +def pending_examples
        +  @pending_examples
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) close + + + + + +

        +
        +

        Invoked at the very end, close allows the formatter to clean +up resources, e.g. open streams, etc.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 172
        +
        +def close
        +  restore_sync_output
        +end
        +
        +
        + +
        +

        + + - (nil) dump_failures + + + + + +

        +
        +

        Dumps detailed information about each example failure.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +136
        +137
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 136
        +
        +def dump_failures
        +end
        +
        +
        + +
        +

        + + - (nil) dump_pending + + + + + +

        +
        +

        Outputs a report of pending examples. This gets invoked +after the summary if option is set to do so.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +161
        +162
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 161
        +
        +def dump_pending
        +end
        +
        +
        + +
        +

        + + - (Object) dump_summary(duration, example_count, failure_count, pending_count) + + + + + +

        +
        +

        This method is invoked after the dumping of examples and failures. Each parameter +is assigned to a corresponding attribute.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + duration + + + + + + +
        • + +
        • + + example_count + + + + + + +
        • + +
        • + + failure_count + + + + + + +
        • + +
        • + + pending_count + + + + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +148
        +149
        +150
        +151
        +152
        +153
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 148
        +
        +def dump_summary(duration, example_count, failure_count, pending_count)
        +  @duration = duration
        +  @example_count = example_count
        +  @failure_count = failure_count
        +  @pending_count = pending_count
        +end
        +
        +
        + +
        +

        + + - (Array) example_failed(example) + + + + + +

        +
        +

        Invoked when an example fails.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example + + + + + + + — +

          instance of subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 101
        +
        +def example_failed(example)
        +  @failed_examples << example
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_finished(example_group) + + + + + +

        +
        +

        Invoked at the end of the execution of each example group.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group + + + + + + + — +

          subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +66
        +67
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 66
        +
        +def example_group_finished(example_group)
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_started(example_group) + + + + + +

        +
        +

        This method is invoked at the beginning of the execution of each example group.

        + +

        The next method to be invoked after this is #example_passed, +#example_pending, or #example_group_finished.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group + + + + + + + — +

          subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        • + + example_group + + + + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 57
        +
        +def example_group_started(example_group)
        +  @example_group = example_group
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        +
        +

        Invoked when an example passes.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example + + + + + + + — +

          instance of subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +84
        +85
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 84
        +
        +def example_passed(example)
        +end
        +
        +
        + +
        +

        + + - (Array) example_pending(example) + + + + + +

        +
        +

        Invoked when an example is pending.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example + + + + + + + — +

          instance of subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 91
        +
        +def example_pending(example)
        +  @pending_examples << example
        +end
        +
        +
        + +
        +

        + + - (Array) example_started(example) + + + + + +

        +
        +

        Invoked at the beginning of the execution of each example.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example + + + + + + + — +

          instance of subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +75
        +76
        +77
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 75
        +
        +def example_started(example)
        +  examples << example
        +end
        +
        +
        + +
        +

        + + - (Object) format_backtrace(backtrace, example) + + + + + +

        +
        +

        Formats the given backtrace based on configuration and +the metadata of the given example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +180
        +181
        +182
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 180
        +
        +def format_backtrace(backtrace, example)
        +  super(backtrace, example.)
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        +
        +

        Used by the reporter to send messages to the output stream.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +110
        +111
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 110
        +
        +def message(message)
        +end
        +
        +
        + +
        +

        + + - (Object) start(example_count) + + + + + +

        +
        +

        This method is invoked before any examples are run, right after +they have all been collected. This can be useful for special +formatters that need to provide progress on feedback (graphical ones).

        + +

        This will only be invoked once, and the next one to be invoked +is #example_group_started.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_count + + + + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 42
        +
        +def start(example_count)
        +  start_sync_output
        +  @example_count = example_count
        +end
        +
        +
        + +
        +

        + + - (nil) start_dump + + + + + +

        +
        +

        This method is invoked after all of the examples have executed. The next method +to be invoked after this one is #dump_failures +(BaseTextFormatter then calls #dump_failure once for each failed example.)

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +128
        +129
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 128
        +
        +def start_dump
        +end
        +
        +
        + +
        +

        + + - (nil) stop + + + + + +

        +
        +

        Invoked after all examples have executed, before dumping post-run reports.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +118
        +119
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 118
        +
        +def stop
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html new file mode 100644 index 000000000..9b0e642a4 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html @@ -0,0 +1,1275 @@ + + + + + + Class: RSpec::Core::Formatters::BaseTextFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::BaseTextFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseFormatter + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/base_text_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        Base for all of RSpec's built-in formatters. See RSpec::Core::Formatters::BaseFormatter +to learn more about all of the methods called by the reporter.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        +

        Direct Known Subclasses

        +

        DocumentationFormatter, HtmlFormatter, ProgressFormatter

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #example_failed, #example_group_finished, #example_group_started, #example_passed, #example_pending, #example_started, #format_backtrace, #initialize, #start, #start_dump, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Formatters::BaseFormatter

        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) const_missing(name) + + + + + +

        + + + + +
        +
        +
        +
        +171
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +182
        +183
        +184
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 171
        +
        +def self.const_missing(name)
        +  base = "RSpec::Core::Formatters::"
        +  case name
        +    when :VT100_COLORS then
        +      RSpec.deprecate("#{base}#{name}", :replacement => "#{base}ConsoleCodes::VT100_CODES")
        +      RSpec::Core::Formatters::ConsoleCodes::VT100_CODES
        +    when :VT100_COLOR_CODES then
        +      RSpec.deprecate("#{base}#{name}", :replacement => "#{base}ConsoleCodes::VT100_CODE_VALUES")
        +      require 'set'
        +      RSpec::Core::Formatters::ConsoleCodes::VT100_CODES.to_set
        +  else
        +    super
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) close + + + + + +

        + + + + +
        +
        +
        +
        +164
        +165
        +166
        +167
        +168
        +169
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 164
        +
        +def close
        +  return unless IO === output
        +  return if output.closed? || output == $stdout
        +
        +  output.close
        +end
        +
        +
        + +
        +

        + + - (Object) color_code_for(code_or_symbol) + + + + + +

        + + + + +
        +
        +
        +
        +186
        +187
        +188
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 186
        +
        +def color_code_for(code_or_symbol)
        +  ConsoleCodes.console_code_for(code_or_symbol)
        +end
        +
        +
        + +
        +

        + + - (Object) colorise_summary(summary) + + + + + +

        +
        +

        Colorizes the output red for failure, yellow for +pending, and green otherwise.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + string + + + (String) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 35
        +
        +def colorise_summary(summary)
        +  if failure_count > 0
        +    color(summary, RSpec.configuration.failure_color)
        +  elsif pending_count > 0
        +    color(summary, RSpec.configuration.pending_color)
        +  else
        +    color(summary, RSpec.configuration.success_color)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) colorize(text, code_or_symbol) + + + + + +

        + + + + +
        +
        +
        +
        +190
        +191
        +192
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 190
        +
        +def colorize(text, code_or_symbol)
        +  ConsoleCodes.wrap(text, code_or_symbol)
        +end
        +
        +
        + +
        +

        + + - (Object) dump_commands_to_rerun_failed_examples + + + + + +

        +
        +

        Outputs commands which can be used to re-run failed examples.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 57
        +
        +def dump_commands_to_rerun_failed_examples
        +  return if failed_examples.empty?
        +  output.puts
        +  output.puts("Failed examples:")
        +  output.puts
        +
        +  failed_examples.each do |example|
        +    output.puts(failure_color("rspec #{RSpec::Core::Metadata::relative_path(example.location)}") + " " + detail_color("# #{example.full_description}"))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_failures + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 18
        +
        +def dump_failures
        +  return if failed_examples.empty?
        +  output.puts
        +  output.puts "Failures:"
        +  failed_examples.each_with_index do |example, index|
        +    output.puts
        +    pending_fixed?(example) ? dump_pending_fixed(example, index) : dump_failure(example, index)
        +    dump_backtrace(example)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_pending + + + + + +

        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +154
        +155
        +156
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 139
        +
        +def dump_pending
        +  unless pending_examples.empty?
        +    output.puts
        +    output.puts "Pending:"
        +    pending_examples.each do |pending_example|
        +      output.puts pending_color("  #{pending_example.full_description}")
        +      output.puts detail_color("    # #{pending_example.execution_result[:pending_message]}")
        +      output.puts detail_color("    # #{format_caller(pending_example.location)}")
        +      # instance_variable_get is a hack to avoid a deprecation warning,
        +      # it's only for 2.99.
        +      if pending_example.execution_result[:exception] \
        +        && RSpec.configuration.instance_variable_get(:@show_failures_in_pending_blocks)
        +        dump_failure_info(pending_example)
        +        dump_backtrace(pending_example)
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_profile + + + + + +

        +
        +

        Outputs the slowest examples and example groups in a report when using --profile COUNT (default 10).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 72
        +
        +def dump_profile
        +  dump_profile_slowest_examples
        +  dump_profile_slowest_example_groups
        +end
        +
        +
        + +
        +

        + + - (Object) dump_profile_slowest_example_groups + + + + + +

        + + + + +
        +
        +
        +
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 96
        +
        +def dump_profile_slowest_example_groups
        +  number_of_examples = RSpec.configuration.profile_examples
        +  example_groups = {}
        +
        +  examples.each do |example|
        +    location = example.example_group.parent_groups.last.[:example_group][:location]
        +
        +    example_groups[location] ||= Hash.new(0)
        +    example_groups[location][:total_time]  += example.execution_result[:run_time]
        +    example_groups[location][:count]       += 1
        +    example_groups[location][:description] = example.example_group.top_level_description unless example_groups[location].has_key?(:description)
        +  end
        +
        +  # stop if we've only one example group
        +  return if example_groups.keys.length <= 1
        +
        +  example_groups.each do |loc, hash|
        +    hash[:average] = hash[:total_time].to_f / hash[:count]
        +  end
        +
        +  sorted_groups = example_groups.sort_by {|_, hash| -hash[:average]}.first(number_of_examples)
        +
        +  output.puts "\nTop #{sorted_groups.size} slowest example groups:"
        +  sorted_groups.each do |loc, hash|
        +    average = "#{failure_color(format_seconds(hash[:average]))} #{failure_color("seconds")} average"
        +    total   = "#{format_seconds(hash[:total_time])} seconds"
        +    count   = pluralize(hash[:count], "example")
        +    output.puts "  #{hash[:description]}"
        +    output.puts detail_color("    #{average} (#{total} / #{count}) #{loc}")
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_profile_slowest_examples + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 77
        +
        +def dump_profile_slowest_examples
        +  number_of_examples = RSpec.configuration.profile_examples
        +  sorted_examples = examples.sort_by {|example|
        +    example.execution_result[:run_time] }.reverse.first(number_of_examples)
        +
        +  total, slows = [examples, sorted_examples].map {|exs|
        +    exs.inject(0.0) {|i, e| i + e.execution_result[:run_time] }}
        +
        +  time_taken = slows / total
        +  percentage = '%.1f' % ((time_taken.nan? ? 0.0 : time_taken) * 100)
        +
        +  output.puts "\nTop #{sorted_examples.size} slowest examples (#{format_seconds(slows)} seconds, #{percentage}% of total time):\n"
        +
        +  sorted_examples.each do |example|
        +    output.puts "  #{example.full_description}"
        +    output.puts detail_color("    #{failure_color(format_seconds(example.execution_result[:run_time]))} #{failure_color("seconds")} #{format_caller(example.location)}")
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_summary(duration, example_count, failure_count, pending_count) + + + + + +

        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 45
        +
        +def dump_summary(duration, example_count, failure_count, pending_count)
        +  super(duration, example_count, failure_count, pending_count)
        +  dump_profile unless mute_profile_output?(failure_count)
        +  output.puts "\nFinished in #{format_duration(duration)}\n"
        +  output.puts colorise_summary(summary_line(example_count, failure_count, pending_count))
        +  dump_commands_to_rerun_failed_examples
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 14
        +
        +def message(message)
        +  output.puts message
        +end
        +
        +
        + +
        +

        + + - (Object) seed(number) + + + + + +

        + + + + +
        +
        +
        +
        +158
        +159
        +160
        +161
        +162
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 158
        +
        +def seed(number)
        +  output.puts
        +  output.puts "Randomized with seed #{number}"
        +  output.puts
        +end
        +
        +
        + +
        +

        + + - (Object) summary_line(example_count, failure_count, pending_count) + + + + + +

        +
        +

        Outputs summary with number of examples, failures and pending.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +132
        +133
        +134
        +135
        +136
        +137
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 132
        +
        +def summary_line(example_count, failure_count, pending_count)
        +  summary = pluralize(example_count, "example")
        +  summary << ", " << pluralize(failure_count, "failure")
        +  summary << ", #{pending_count} pending" if pending_count > 0
        +  summary
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/ConsoleCodes.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/ConsoleCodes.html new file mode 100644 index 000000000..7f0203823 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/ConsoleCodes.html @@ -0,0 +1,273 @@ + + + + + + Module: RSpec::Core::Formatters::ConsoleCodes + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Formatters::ConsoleCodes + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/console_codes.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        VT100_CODES = + +
        +
        {
        +  :black   => 30,
        +  :red     => 31,
        +  :green   => 32,
        +  :yellow  => 33,
        +  :blue    => 34,
        +  :magenta => 35,
        +  :cyan    => 36,
        +  :white   => 37,
        +  :bold    => 1,
        +}
        + +
        VT100_CODE_VALUES = + +
        +
        VT100_CODES.invert
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) console_code_for(code_or_symbol) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/core/formatters/console_codes.rb', line 21
        +
        +def console_code_for(code_or_symbol)
        +  if VT100_CODE_VALUES.has_key?(code_or_symbol)
        +    code_or_symbol
        +  else
        +    VT100_CODES.fetch(code_or_symbol) do
        +      console_code_for(:white)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) wrap(text, code_or_symbol) + + + + + +

        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/core/formatters/console_codes.rb', line 31
        +
        +def wrap(text, code_or_symbol)
        +  if RSpec.configuration.color_enabled?
        +    "\e[#{console_code_for(code_or_symbol)}m#{text}\e[0m"
        +  else
        +    text
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter.html new file mode 100644 index 000000000..d2ecd1006 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter.html @@ -0,0 +1,756 @@ + + + + + + Class: RSpec::Core::Formatters::DeprecationFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DeprecationFormatter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/deprecation_formatter.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: DelayedPrinter, FileStream, GeneratedDeprecationMessage, ImmediatePrinter, RaiseErrorStream, SpecifiedDeprecationMessage + + +

        + +

        Constant Summary

        + +
        + +
        RAISE_ERROR_CONFIG_NOTICE = + +
        +
        <<-EOS.gsub(/^\s+\|/, '')
        +  |
        +  |If you need more of the backtrace for any of these deprecations to
        +  |identify where to make the necessary changes, you can configure
        +  |`config.raise_errors_for_deprecations!`, and it will turn the
        +  |deprecation warnings into errors, giving you the full backtrace.
        +EOS
        + +
        DEPRECATION_STREAM_NOTICE = + +
        +
        "Pass `--deprecation-out` or set " +
        +"`config.deprecation_stream` to a file for full output."
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) count + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute count.

          +
          + +
        • + + +
        • + + + - (Object) deprecation_stream + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute deprecation_stream.

          +
          + +
        • + + +
        • + + + - (Object) summary_stream + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute summary_stream.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (DeprecationFormatter) initialize(deprecation_stream, summary_stream) + + + + + +

        +
        +

        Returns a new instance of DeprecationFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 10
        +
        +def initialize(deprecation_stream, summary_stream)
        +  @deprecation_stream = deprecation_stream
        +  @summary_stream = summary_stream
        +  @seen_deprecations = Set.new
        +  @count = 0
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) count (readonly) + + + + + +

        +
        +

        Returns the value of attribute count

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 8
        +
        +def count
        +  @count
        +end
        +
        +
        + + + +
        +

        + + - (Object) deprecation_stream (readonly) + + + + + +

        +
        +

        Returns the value of attribute deprecation_stream

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 8
        +
        +def deprecation_stream
        +  @deprecation_stream
        +end
        +
        +
        + + + +
        +

        + + - (Object) summary_stream (readonly) + + + + + +

        +
        +

        Returns the value of attribute summary_stream

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 8
        +
        +def summary_stream
        +  @summary_stream
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) deprecation(data) + + + + + +

        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 28
        +
        +def deprecation(data)
        +  return if @seen_deprecations.include?(data)
        +
        +  @count += 1
        +  printer.print_deprecation_message data
        +  @seen_deprecations << data
        +end
        +
        +
        + +
        +

        + + - (Object) deprecation_message_for(data) + + + + + +

        + + + + +
        +
        +
        +
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 44
        +
        +def deprecation_message_for(data)
        +  if data[:message]
        +    SpecifiedDeprecationMessage.new(data)
        +  else
        +    GeneratedDeprecationMessage.new(data)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) deprecation_summary + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 36
        +
        +def deprecation_summary
        +  printer.deprecation_summary
        +end
        +
        +
        + +
        +

        + + - (Object) printer + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 17
        +
        +def printer
        +  @printer ||= case deprecation_stream
        +               when File
        +                 ImmediatePrinter.new(FileStream.new(deprecation_stream), summary_stream, self)
        +               when RaiseErrorStream
        +                 ImmediatePrinter.new(deprecation_stream, summary_stream, self)
        +               else
        +                 DelayedPrinter.new(deprecation_stream, summary_stream, self)
        +               end
        +end
        +
        +
        + +
        +

        + + - (Object) start(example_count = nil) + + + + + +

        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 40
        +
        +def start(example_count=nil)
        +  #no-op to fix #966
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/DelayedPrinter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/DelayedPrinter.html new file mode 100644 index 000000000..2cd43b9ea --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/DelayedPrinter.html @@ -0,0 +1,720 @@ + + + + + + Class: RSpec::Core::Formatters::DeprecationFormatter::DelayedPrinter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DeprecationFormatter::DelayedPrinter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Helpers
        + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/deprecation_formatter.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        TOO_MANY_USES_LIMIT = + +
        +
        4
        + +
        + + + + + + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (DelayedPrinter) initialize(deprecation_stream, summary_stream, deprecation_formatter) + + + + + +

        +
        +

        Returns a new instance of DelayedPrinter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 140
        +
        +def initialize(deprecation_stream, summary_stream, deprecation_formatter)
        +  @deprecation_stream = deprecation_stream
        +  @summary_stream = summary_stream
        +  @deprecation_formatter = deprecation_formatter
        +  @seen_deprecations = Hash.new { 0 }
        +  @deprecation_messages = Hash.new { |h, k| h[k] = [] }
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) deprecation_formatter (readonly) + + + + + +

        +
        +

        Returns the value of attribute deprecation_formatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +138
        +139
        +140
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 138
        +
        +def deprecation_formatter
        +  @deprecation_formatter
        +end
        +
        +
        + + + +
        +

        + + - (Object) deprecation_stream (readonly) + + + + + +

        +
        +

        Returns the value of attribute deprecation_stream

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +138
        +139
        +140
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 138
        +
        +def deprecation_stream
        +  @deprecation_stream
        +end
        +
        +
        + + + +
        +

        + + - (Object) summary_stream (readonly) + + + + + +

        +
        +

        Returns the value of attribute summary_stream

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +138
        +139
        +140
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 138
        +
        +def summary_stream
        +  @summary_stream
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) deprecation_summary + + + + + +

        + + + + +
        +
        +
        +
        +163
        +164
        +165
        +166
        +167
        +168
        +169
        +170
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 163
        +
        +def deprecation_summary
        +  return unless @deprecation_messages.any?
        +
        +  print_deferred_deprecation_warnings
        +  deprecation_stream.puts RAISE_ERROR_CONFIG_NOTICE
        +
        +  summary_stream.puts "\n#{pluralize(deprecation_formatter.count, 'deprecation warning')} total"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 172
        +
        +def print_deferred_deprecation_warnings
        +  deprecation_stream.puts "\nDeprecation Warnings:\n\n"
        +  @deprecation_messages.keys.sort_by(&:type).each do |deprecation|
        +    messages = @deprecation_messages[deprecation]
        +    messages.each { |msg| deprecation_stream.puts msg }
        +    deprecation_stream.puts
        +  end
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +148
        +149
        +150
        +151
        +152
        +153
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 148
        +
        +def print_deprecation_message(data)
        +  deprecation_message = deprecation_formatter.deprecation_message_for(data)
        +  @seen_deprecations[deprecation_message] += 1
        +
        +  stash_deprecation_message(deprecation_message)
        +end
        +
        +
        + +
        +

        + + - (Object) stash_deprecation_message(deprecation_message) + + + + + +

        + + + + +
        +
        +
        +
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 155
        +
        +def stash_deprecation_message(deprecation_message)
        +  if @seen_deprecations[deprecation_message] < TOO_MANY_USES_LIMIT
        +    @deprecation_messages[deprecation_message] << deprecation_message.to_s
        +  elsif @seen_deprecations[deprecation_message] == TOO_MANY_USES_LIMIT
        +    @deprecation_messages[deprecation_message] << deprecation_message.too_many_warnings_message
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/FileStream.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/FileStream.html new file mode 100644 index 000000000..deb9fb555 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/FileStream.html @@ -0,0 +1,369 @@ + + + + + + Class: RSpec::Core::Formatters::DeprecationFormatter::FileStream + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DeprecationFormatter::FileStream + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Helpers
        + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/deprecation_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        Wraps a File object and provides file-specific operations.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (FileStream) initialize(file) + + + + + +

        +
        +

        Returns a new instance of FileStream

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +199
        +200
        +201
        +202
        +203
        +204
        +205
        +206
        +207
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 199
        +
        +def initialize(file)
        +  @file = file
        +
        +  # In one of my test suites, I got lots of duplicate output in the
        +  # deprecation file (e.g. 200 of the same deprecation, even though
        +  # the `puts` below was only called 6 times). Setting `sync = true`
        +  # fixes this (but we really have no idea why!).
        +  @file.sync = true
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) puts(*args) + + + + + +

        + + + + +
        +
        +
        +
        +209
        +210
        +211
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 209
        +
        +def puts(*args)
        +  @file.puts(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) summarize(summary_stream, deprecation_count) + + + + + +

        + + + + +
        +
        +
        +
        +213
        +214
        +215
        +216
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 213
        +
        +def summarize(summary_stream, deprecation_count)
        +  summary_stream.puts "\n#{pluralize(deprecation_count, 'deprecation')} logged to #{@file.path}"
        +  puts RAISE_ERROR_CONFIG_NOTICE
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/GeneratedDeprecationMessage.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/GeneratedDeprecationMessage.html new file mode 100644 index 000000000..948beb4cd --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/GeneratedDeprecationMessage.html @@ -0,0 +1,218 @@ + + + + + + Class: RSpec::Core::Formatters::DeprecationFormatter::GeneratedDeprecationMessage + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DeprecationFormatter::GeneratedDeprecationMessage + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/deprecation_formatter.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) type + + + + + + + + + + + + + + + + +

          Returns the value of attribute type.

          +
          + +
        • + + +
        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) type + + + + + +

        +
        +

        Returns the value of attribute type

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of type

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 92
        +
        +def type
        +  @type
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/ImmediatePrinter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/ImmediatePrinter.html new file mode 100644 index 000000000..440c4cbec --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/ImmediatePrinter.html @@ -0,0 +1,540 @@ + + + + + + Class: RSpec::Core::Formatters::DeprecationFormatter::ImmediatePrinter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DeprecationFormatter::ImmediatePrinter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/deprecation_formatter.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ImmediatePrinter) initialize(deprecation_stream, summary_stream, deprecation_formatter) + + + + + +

        +
        +

        Returns a new instance of ImmediatePrinter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +115
        +116
        +117
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 115
        +
        +def initialize(deprecation_stream, summary_stream, deprecation_formatter)
        +  @deprecation_stream = deprecation_stream
        +
        +  @summary_stream = summary_stream
        +  @deprecation_formatter = deprecation_formatter
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) deprecation_formatter (readonly) + + + + + +

        +
        +

        Returns the value of attribute deprecation_formatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 113
        +
        +def deprecation_formatter
        +  @deprecation_formatter
        +end
        +
        +
        + + + +
        +

        + + - (Object) deprecation_stream (readonly) + + + + + +

        +
        +

        Returns the value of attribute deprecation_stream

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 113
        +
        +def deprecation_stream
        +  @deprecation_stream
        +end
        +
        +
        + + + +
        +

        + + - (Object) summary_stream (readonly) + + + + + +

        +
        +

        Returns the value of attribute summary_stream

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 113
        +
        +def summary_stream
        +  @summary_stream
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) deprecation_summary + + + + + +

        + + + + +
        +
        +
        +
        +127
        +128
        +129
        +130
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 127
        +
        +def deprecation_summary
        +  return if deprecation_formatter.count.zero?
        +  deprecation_stream.summarize(summary_stream, deprecation_formatter.count)
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +122
        +123
        +124
        +125
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 122
        +
        +def print_deprecation_message(data)
        +  deprecation_message = deprecation_formatter.deprecation_message_for(data)
        +  deprecation_stream.puts deprecation_message.to_s
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/RaiseErrorStream.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/RaiseErrorStream.html new file mode 100644 index 000000000..56769a1e8 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/RaiseErrorStream.html @@ -0,0 +1,308 @@ + + + + + + Class: RSpec::Core::Formatters::DeprecationFormatter::RaiseErrorStream + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DeprecationFormatter::RaiseErrorStream + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Helpers
        + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/deprecation_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        Not really a stream, but is usable in place of one.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) puts(message) + + + + + +

        +
        + + +
        +
        +
        + +

        Raises:

        + + +
        + + + + +
        +
        +
        +
        +186
        +187
        +188
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 186
        +
        +def puts(message)
        +  raise DeprecationError, message
        +end
        +
        +
        + +
        +

        + + - (Object) summarize(summary_stream, deprecation_count) + + + + + +

        + + + + +
        +
        +
        +
        +190
        +191
        +192
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 190
        +
        +def summarize(summary_stream, deprecation_count)
        +  summary_stream.puts "\n#{pluralize(deprecation_count, 'deprecation')} found."
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/SpecifiedDeprecationMessage.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/SpecifiedDeprecationMessage.html new file mode 100644 index 000000000..0d39a111d --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DeprecationFormatter/SpecifiedDeprecationMessage.html @@ -0,0 +1,218 @@ + + + + + + Class: RSpec::Core::Formatters::DeprecationFormatter::SpecifiedDeprecationMessage + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DeprecationFormatter::SpecifiedDeprecationMessage + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/deprecation_formatter.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) type + + + + + + + + + + + + + + + + +

          Returns the value of attribute type.

          +
          + +
        • + + +
        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) type + + + + + +

        +
        +

        Returns the value of attribute type

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of type

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 63
        +
        +def type
        +  @type
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DocumentationFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DocumentationFormatter.html new file mode 100644 index 000000000..69e5922fa --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/DocumentationFormatter.html @@ -0,0 +1,860 @@ + + + + + + Class: RSpec::Core::Formatters::DocumentationFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DocumentationFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseTextFormatter + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/documentation_formatter.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseTextFormatter

        +

        #close, #color_code_for, #colorise_summary, #colorize, const_missing, #dump_commands_to_rerun_failed_examples, #dump_failures, #dump_pending, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #dump_summary, #message, #seed, #summary_line

        + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #close, #dump_failures, #dump_pending, #dump_summary, #example_started, #format_backtrace, #message, #start, #start_dump, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (DocumentationFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of DocumentationFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 7
        +
        +def initialize(output)
        +  super(output)
        +  @group_level = 0
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) current_indentation + + + + + +

        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 57
        +
        +def current_indentation
        +  '  ' * @group_level
        +end
        +
        +
        + +
        +

        + + - (Object) example_failed(example) + + + + + +

        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 35
        +
        +def example_failed(example)
        +  super(example)
        +  output.puts failure_output(example, example.execution_result[:exception])
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_chain + + + + + +

        + + + + +
        +
        +
        +
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 61
        +
        +def example_group_chain
        +  example_group.parent_groups.reverse
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_finished(example_group) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 21
        +
        +def example_group_finished(example_group)
        +  @group_level -= 1
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_started(example_group) + + + + + +

        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 12
        +
        +def example_group_started(example_group)
        +  super(example_group)
        +
        +  output.puts if @group_level == 0
        +  output.puts "#{current_indentation}#{example_group.description.strip}"
        +
        +  @group_level += 1
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 25
        +
        +def example_passed(example)
        +  super(example)
        +  output.puts passed_output(example)
        +end
        +
        +
        + +
        +

        + + - (Object) example_pending(example) + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 30
        +
        +def example_pending(example)
        +  super(example)
        +  output.puts pending_output(example, example.execution_result[:pending_message])
        +end
        +
        +
        + +
        +

        + + - (Object) failure_output(example, exception) + + + + + +

        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 40
        +
        +def failure_output(example, exception)
        +  failure_color("#{current_indentation}#{example.description.strip} (FAILED - #{next_failure_index})")
        +end
        +
        +
        + +
        +

        + + - (Object) next_failure_index + + + + + +

        + + + + +
        +
        +
        +
        +44
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 44
        +
        +def next_failure_index
        +  @next_failure_index ||= 0
        +  @next_failure_index += 1
        +end
        +
        +
        + +
        +

        + + - (Object) passed_output(example) + + + + + +

        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 49
        +
        +def passed_output(example)
        +  success_color("#{current_indentation}#{example.description.strip}")
        +end
        +
        +
        + +
        +

        + + - (Object) pending_output(example, message) + + + + + +

        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 53
        +
        +def pending_output(example, message)
        +  pending_color("#{current_indentation}#{example.description.strip} (PENDING: #{message})")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/Helpers.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/Helpers.html new file mode 100644 index 000000000..f660e8736 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/Helpers.html @@ -0,0 +1,644 @@ + + + + + + Module: RSpec::Core::Formatters::Helpers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Formatters::Helpers + + + +

        + +
        + + + + + +
        Includes:
        +
        BacktraceFormatter
        + + + + +
        Included in:
        +
        BaseFormatter, DeprecationFormatter::DelayedPrinter, DeprecationFormatter::FileStream, DeprecationFormatter::RaiseErrorStream
        + + + +
        Defined in:
        +
        lib/rspec/core/formatters/helpers.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        SUB_SECOND_PRECISION = + +
        +
        5
        + +
        DEFAULT_PRECISION = + +
        +
        2
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) format_duration(duration) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Formats seconds into a human-readable string.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        format_duration(1) #=>  "1 minute 1 second"
        +format_duration(135.14) #=> "2 minutes 15.14 seconds"
        + +
        +

        Parameters:

        +
          + +
        • + + duration + + + (Float, Fixnum) + + + + — +

          in seconds

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          human-readable time

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 45
        +
        +def format_duration(duration)
        +  precision = case
        +              when duration < 1;    SUB_SECOND_PRECISION
        +              when duration < 120;  DEFAULT_PRECISION
        +              when duration < 300;  1
        +              else                  0
        +              end
        +
        +  if duration > 60
        +    minutes = (duration.to_i / 60).to_i
        +    seconds = duration - minutes * 60
        +
        +    "#{pluralize(minutes, 'minute')} #{pluralize(format_seconds(seconds, precision), 'second')}"
        +  else
        +    pluralize(format_seconds(duration, precision), 'second')
        +  end
        +end
        +
        +
        + +
        +

        + + - (String) format_seconds(float, precision = nil) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Formats seconds to have 5 digits of precision with trailing zeros removed if the number +is less than 1 or with 2 digits of precision if the number is greater than zero.

        + +

        The precision used is set in SUB_SECOND_PRECISION and DEFAULT_PRECISION.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        format_seconds(0.000006) #=> "0.00001"
        +format_seconds(0.020000) #=> "0.02"
        +format_seconds(1.00000000001) #=> "1"
        + +
        +

        Parameters:

        +
          + +
        • + + float + + + (Float) + + + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          formatted float

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 79
        +
        +def format_seconds(float, precision = nil)
        +  precision ||= (float < 1) ? SUB_SECOND_PRECISION : DEFAULT_PRECISION
        +  formatted = sprintf("%.#{precision}f", float)
        +  strip_trailing_zeroes(formatted)
        +end
        +
        +
        + +
        +

        + + - (String) pluralize(count, string) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Pluralize a word based on a count.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + count + + + (Fixnum) + + + + — +

          number of objects

          +
          + +
        • + +
        • + + string + + + (String) + + + + — +

          word to be pluralized

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          pluralized word

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 103
        +
        +def pluralize(count, string)
        +  "#{count} #{string}#{'s' unless count.to_f == 1}"
        +end
        +
        +
        + +
        +

        + + - (String) strip_trailing_zeroes(string) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Remove trailing zeros from a string.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + string + + + (String) + + + + — +

          string with trailing zeros

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          string with trailing zeros removed

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 91
        +
        +def strip_trailing_zeroes(string)
        +  stripped = string.sub(/[^1-9]+$/, '')
        +  stripped.empty? ? "0" : stripped
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/HtmlFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/HtmlFormatter.html new file mode 100644 index 000000000..d8ae5caf6 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/HtmlFormatter.html @@ -0,0 +1,1262 @@ + + + + + + Class: RSpec::Core::Formatters::HtmlFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::HtmlFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseTextFormatter + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/html_formatter.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        TextMateFormatter

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        RSpec::Core::Formatters::Helpers::DEFAULT_PRECISION, RSpec::Core::Formatters::Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseTextFormatter

        +

        #close, #color_code_for, #colorise_summary, #colorize, const_missing, #dump_commands_to_rerun_failed_examples, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #seed, #summary_line

        + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #close, #example_group_finished, #format_backtrace, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (HtmlFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of HtmlFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 9
        +
        +def initialize(output)
        +  super(output)
        +  @example_group_number = 0
        +  @example_number = 0
        +  @header_red = nil
        +  @printer = HtmlPrinter.new(output)
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(m, *a, &b) (private) + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 18
        +
        +def method_missing(m, *a, &b)
        +  # no-op
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) dump_failures + + + + + +

        + + + + +
        +
        +
        +
        +136
        +137
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 136
        +
        +def dump_failures
        +end
        +
        +
        + +
        +

        + + - (Object) dump_pending + + + + + +

        + + + + +
        +
        +
        +
        +139
        +140
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 139
        +
        +def dump_pending
        +end
        +
        +
        + +
        +

        + + - (Object) dump_summary(duration, example_count, failure_count, pending_count) + + + + + +

        + + + + +
        +
        +
        +
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 142
        +
        +def dump_summary(duration, example_count, failure_count, pending_count)
        +  @printer.print_summary(
        +    dry_run?,
        +    duration,
        +    example_count,
        +    failure_count,
        +    pending_count
        +  )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_failed(example) + + + + + +

        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 70
        +
        +def example_failed(example)
        +  super(example)
        +
        +  unless @header_red
        +    @header_red = true
        +    @printer.make_header_red
        +  end
        +
        +  unless @example_group_red
        +    @example_group_red = true
        +    @printer.make_example_group_header_red(example_group_number)
        +  end
        +
        +  @printer.move_progress(percent_done)
        +
        +  exception = example.[:execution_result][:exception]
        +  exception_details = if exception
        +    {
        +      :message => exception.message,
        +      :backtrace => format_backtrace(exception.backtrace, example).join("\n")
        +    }
        +  else
        +    false
        +  end
        +  extra = extra_failure_content(exception)
        +
        +  @printer.print_example_failed(
        +    example.execution_result[:pending_fixed],
        +    example.description,
        +    example.execution_result[:run_time],
        +    @failed_examples.size,
        +    exception_details,
        +    (extra == "") ? false : extra,
        +    true
        +  )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_number + + + + + +

        +
        +

        The number of the currently running example_group

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 27
        +
        +def example_group_number
        +  @example_group_number
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_started(example_group) + + + + + +

        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 42
        +
        +def example_group_started(example_group)
        +  super(example_group)
        +  @example_group_red = false
        +  @example_group_number += 1
        +
        +  unless example_group_number == 1
        +    @printer.print_example_group_end
        +  end
        +  @printer.print_example_group_start( example_group_number, example_group.description, example_group.parent_groups.size )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_number + + + + + +

        +
        +

        The number of the currently running example (a global counter)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 32
        +
        +def example_number
        +  @example_number
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 64
        +
        +def example_passed(example)
        +  @printer.move_progress(percent_done)
        +  @printer.print_example_passed( example.description, example.execution_result[:run_time] )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_pending(example) + + + + + +

        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 108
        +
        +def example_pending(example)
        +
        +  @printer.make_header_yellow unless @header_red
        +  @printer.make_example_group_header_yellow(example_group_number) unless @example_group_red
        +  @printer.move_progress(percent_done)
        +  @printer.print_example_pending( example.description, example.[:execution_result][:pending_message] )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_started(example) + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 59
        +
        +def example_started(example)
        +  super(example)
        +  @example_number += 1
        +end
        +
        +
        + +
        +

        + + - (Object) extra_failure_content(exception) + + + + + +

        +
        +

        Override this method if you wish to output extra HTML for a failed spec. For example, you +could output links to images or other files produced during the specs.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 120
        +
        +def extra_failure_content(exception)
        +  require 'rspec/core/formatters/snippet_extractor'
        +  backtrace = exception.backtrace.map {|line| backtrace_line(line)}
        +  backtrace.compact!
        +  @snippet_extractor ||= SnippetExtractor.new
        +  "    <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 23
        +
        +def message(message)
        +end
        +
        +
        + +
        +

        + + - (Object) percent_done + + + + + +

        + + + + +
        +
        +
        +
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 128
        +
        +def percent_done
        +  result = 100.0
        +  if @example_count > 0
        +    result = (((example_number).to_f / @example_count.to_f * 1000).to_i / 10.0).to_f
        +  end
        +  result
        +end
        +
        +
        + +
        +

        + + - (Object) start(example_count) + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 36
        +
        +def start(example_count)
        +  super(example_count)
        +  @printer.print_html_start
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) start_dump + + + + + +

        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 54
        +
        +def start_dump
        +  @printer.print_example_group_end
        +  @printer.flush
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/HtmlPrinter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/HtmlPrinter.html new file mode 100644 index 000000000..3f66a7072 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/HtmlPrinter.html @@ -0,0 +1,970 @@ + + + + + + Class: RSpec::Core::Formatters::HtmlPrinter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::HtmlPrinter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        ERB::Util
        + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/html_printer.rb
        + +
        +
        + + +

        Constant Summary

        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (HtmlPrinter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of HtmlPrinter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 8
        +
        +def initialize(output)
        +  @output = output
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) flush + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 77
        +
        +def flush
        +  @output.flush
        +end
        +
        +
        + +
        +

        + + - (Object) make_example_group_header_red(group_id) + + + + + +

        + + + + +
        +
        +
        +
        +94
        +95
        +96
        +97
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 94
        +
        +def make_example_group_header_red(group_id)
        +  @output.puts "    <script type=\"text/javascript\">makeRed('div_group_#{group_id}');</script>"
        +  @output.puts "    <script type=\"text/javascript\">makeRed('example_group_#{group_id}');</script>"
        +end
        +
        +
        + +
        +

        + + - (Object) make_example_group_header_yellow(group_id) + + + + + +

        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 99
        +
        +def make_example_group_header_yellow(group_id)
        +  @output.puts "    <script type=\"text/javascript\">makeYellow('div_group_#{group_id}');</script>"
        +  @output.puts "    <script type=\"text/javascript\">makeYellow('example_group_#{group_id}');</script>"
        +end
        +
        +
        + +
        +

        + + - (Object) make_header_red + + + + + +

        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 86
        +
        +def make_header_red
        +  @output.puts "    <script type=\"text/javascript\">makeRed('rspec-header');</script>"
        +end
        +
        +
        + +
        +

        + + - (Object) make_header_yellow + + + + + +

        + + + + +
        +
        +
        +
        +90
        +91
        +92
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 90
        +
        +def make_header_yellow
        +  @output.puts "    <script type=\"text/javascript\">makeYellow('rspec-header');</script>"
        +end
        +
        +
        + +
        +

        + + - (Object) move_progress(percent_done) + + + + + +

        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 81
        +
        +def move_progress( percent_done )
        +  @output.puts "    <script type=\"text/javascript\">moveProgressBar('#{percent_done}');</script>"
        +  @output.flush
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 33
        +
        +def print_example_failed( pending_fixed, description, run_time, failure_id, exception, extra_content, escape_backtrace = false )
        +  formatted_run_time = sprintf("%.5f", run_time)
        +
        +  @output.puts "    <dd class=\"example #{pending_fixed ? 'pending_fixed' : 'failed'}\">"
        +  @output.puts "      <span class=\"failed_spec_name\">#{h(description)}</span>"
        +  @output.puts "      <span class=\"duration\">#{formatted_run_time}s</span>"
        +  @output.puts "      <div class=\"failure\" id=\"failure_#{failure_id}\">"
        +  if exception
        +    @output.puts "        <div class=\"message\"><pre>#{h(exception[:message])}</pre></div>"
        +    if escape_backtrace
        +      @output.puts "        <div class=\"backtrace\"><pre>#{h exception[:backtrace]}</pre></div>"
        +    else
        +      @output.puts "        <div class=\"backtrace\"><pre>#{exception[:backtrace]}</pre></div>"
        +    end
        +  end
        +  @output.puts extra_content if extra_content
        +  @output.puts "      </div>"
        +  @output.puts "    </dd>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 17
        +
        +def print_example_group_end
        +  @output.puts "  </dl>"
        +  @output.puts "</div>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 22
        +
        +def print_example_group_start( group_id, description, number_of_parents  )
        +  @output.puts "<div id=\"div_group_#{group_id}\" class=\"example_group passed\">"
        +  @output.puts "  <dl #{indentation_style(number_of_parents)}>"
        +  @output.puts "  <dt id=\"example_group_#{group_id}\" class=\"passed\">#{h(description)}</dt>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +28
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 28
        +
        +def print_example_passed( description, run_time )
        +  formatted_run_time = sprintf("%.5f", run_time)
        +  @output.puts "    <dd class=\"example passed\"><span class=\"passed_spec_name\">#{h(description)}</span><span class='duration'>#{formatted_run_time}s</span></dd>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 53
        +
        +def print_example_pending( description, pending_message )
        +  @output.puts "    <dd class=\"example not_implemented\"><span class=\"not_implemented_spec_name\">#{h(description)} (PENDING: #{h(pending_message)})</span></dd>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 12
        +
        +def print_html_start
        +  @output.puts HTML_HEADER
        +  @output.puts REPORT_HEADER
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 57
        +
        +def print_summary( was_dry_run, duration, example_count, failure_count, pending_count )
        +  # TODO - kill dry_run?
        +  if was_dry_run
        +    totals = "This was a dry-run"
        +  else
        +    totals =  "#{example_count} example#{'s' unless example_count == 1}, "
        +    totals << "#{failure_count} failure#{'s' unless failure_count == 1}"
        +    totals << ", #{pending_count} pending" if pending_count > 0
        +  end
        +
        +  formatted_duration = sprintf("%.5f", duration)
        +
        +  @output.puts "<script type=\"text/javascript\">document.getElementById('duration').innerHTML = \"Finished in <strong>#{formatted_duration} seconds</strong>\";</script>"
        +  @output.puts "<script type=\"text/javascript\">document.getElementById('totals').innerHTML = \"#{totals}\";</script>"
        +  @output.puts "</div>"
        +  @output.puts "</div>"
        +  @output.puts "</body>"
        +  @output.puts "</html>"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/JsonFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/JsonFormatter.html new file mode 100644 index 000000000..f1ac6f03c --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/JsonFormatter.html @@ -0,0 +1,657 @@ + + + + + + Class: RSpec::Core::Formatters::JsonFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::JsonFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseFormatter + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/json_formatter.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) output_hash + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute output_hash.

          +
          + +
        • + + +
        + + + + + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #dump_failures, #dump_pending, #example_failed, #example_group_finished, #example_group_started, #example_passed, #example_pending, #example_started, #format_backtrace, #start, #start_dump

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (JsonFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of JsonFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 12
        +
        +def initialize(output)
        +  super
        +  @output_hash = {}
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) output_hash (readonly) + + + + + +

        +
        +

        Returns the value of attribute output_hash

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 10
        +
        +def output_hash
        +  @output_hash
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) close + + + + + +

        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 62
        +
        +def close
        +  output.write @output_hash.to_json
        +  output.close if IO === output && output != $stdout
        +end
        +
        +
        + +
        +

        + + - (Object) dump_summary(duration, example_count, failure_count, pending_count) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 21
        +
        +def dump_summary(duration, example_count, failure_count, pending_count)
        +  super(duration, example_count, failure_count, pending_count)
        +  @output_hash[:summary] = {
        +    :duration => duration,
        +    :example_count => example_count,
        +    :failure_count => failure_count,
        +    :pending_count => pending_count
        +  }
        +  @output_hash[:summary_line] = summary_line(example_count, failure_count, pending_count)
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 17
        +
        +def message(message)
        +  (@output_hash[:messages] ||= []) << message
        +end
        +
        +
        + +
        +

        + + - (Object) stop + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 39
        +
        +def stop
        +  super
        +  @output_hash[:examples] = examples.map do |example|
        +    {
        +      :description => example.description,
        +      :full_description => example.full_description,
        +      :status => example.execution_result[:status],
        +      # :example_group,
        +      # :execution_result,
        +      :file_path => example.[:file_path],
        +      :line_number  => example.[:line_number],
        +    }.tap do |hash|
        +      if e=example.exception
        +        hash[:exception] =  {
        +          :class => e.class.name,
        +          :message => e.message,
        +          :backtrace => e.backtrace,
        +        }
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) summary_line(example_count, failure_count, pending_count) + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 32
        +
        +def summary_line(example_count, failure_count, pending_count)
        +  summary = pluralize(example_count, "example")
        +  summary << ", " << pluralize(failure_count, "failure")
        +  summary << ", #{pending_count} pending" if pending_count > 0
        +  summary
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/Loader.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/Loader.html new file mode 100644 index 000000000..c47d4e5a8 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/Loader.html @@ -0,0 +1,419 @@ + + + + + + Class: RSpec::Core::Formatters::Loader + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::Loader + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        RSpec::Core::Formatters::Loader is an internal class for +managing formatters used by a particular configuration. It is +not expected to be used directly, but only through the configuration +interface.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Array) formatters + + + + + + + + + readonly + + + + + + + private + + +

          The loaded formatters.

          +
          + +
        • + + +
        • + + + - (Reporter) reporter + + + + + + + + + readonly + + + + + + + private + + +

          The reporter.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Loader) initialize(reporter) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Loader

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 70
        +
        +def initialize(reporter)
        +  @formatters = []
        +  @reporter = reporter
        +  @setup = false
        +  @default_formatter = 'progress'
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Array) formatters (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns the loaded formatters

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + + — +

          the loaded formatters

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +78
        +79
        +80
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 78
        +
        +def formatters
        +  @formatters
        +end
        +
        +
        + + + +
        +

        + + - (Reporter) reporter (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns the reporter

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Reporter) + + + + — +

          the reporter

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/core/formatters.rb', line 81
        +
        +def reporter
        +  @reporter
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/ProgressFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/ProgressFormatter.html new file mode 100644 index 000000000..a487b7371 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/ProgressFormatter.html @@ -0,0 +1,421 @@ + + + + + + Class: RSpec::Core::Formatters::ProgressFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::ProgressFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseTextFormatter + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/progress_formatter.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseTextFormatter

        +

        #close, #color_code_for, #colorise_summary, #colorize, const_missing, #dump_commands_to_rerun_failed_examples, #dump_failures, #dump_pending, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #dump_summary, #message, #seed, #summary_line

        + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #close, #dump_failures, #dump_pending, #dump_summary, #example_group_finished, #example_group_started, #example_started, #format_backtrace, #initialize, #message, #start, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Formatters::BaseFormatter

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) example_failed(example) + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/core/formatters/progress_formatter.rb', line 18
        +
        +def example_failed(example)
        +  super(example)
        +  output.print failure_color('F')
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/core/formatters/progress_formatter.rb', line 8
        +
        +def example_passed(example)
        +  super(example)
        +  output.print success_color('.')
        +end
        +
        +
        + +
        +

        + + - (Object) example_pending(example) + + + + + +

        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/formatters/progress_formatter.rb', line 13
        +
        +def example_pending(example)
        +  super(example)
        +  output.print pending_color('*')
        +end
        +
        +
        + +
        +

        + + - (Object) start_dump + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/formatters/progress_formatter.rb', line 23
        +
        +def start_dump
        +  super()
        +  output.puts
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html new file mode 100644 index 000000000..17bcc6962 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html @@ -0,0 +1,669 @@ + + + + + + Class: RSpec::Core::Formatters::SnippetExtractor + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::SnippetExtractor + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/snippet_extractor.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Extracts code snippets by looking at the backtrace of the passed error and applies synax highlighting and line numbers using html.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: NullConverter + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) lines_around(file, line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Extract lines of code centered around a particular line within a source file.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + file + + + (String) + + + + — +

          filename

          +
          + +
        • + +
        • + + line + + + (Fixnum) + + + + — +

          line number

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          lines around the target line within the file (2 above and 1 below).

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 57
        +
        +def lines_around(file, line)
        +  if File.file?(file)
        +    lines = File.read(file).split("\n")
        +    min = [0, line-3].max
        +    max = [line+1, lines.length-1].min
        +    selected_lines = []
        +    selected_lines.join("\n")
        +    lines[min..max].join("\n")
        +  else
        +    "# Couldn't get snippet for #{file}"
        +  end
        +rescue SecurityError
        +  "# Couldn't get snippet for #{file}"
        +end
        +
        +
        + +
        +

        + + - (String) post_process(highlighted, offending_line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Adds line numbers to all lines and highlights the line where the failure occurred using html span tags.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + highlighted + + + (String) + + + + — +

          syntax-highlighted snippet surrounding the offending line of code

          +
          + +
        • + +
        • + + offending_line + + + (Fixnum) + + + + — +

          line where failure occured

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          completed snippet

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 79
        +
        +def post_process(highlighted, offending_line)
        +  new_lines = []
        +  highlighted.split("\n").each_with_index do |line, i|
        +    new_line = "<span class=\"linenum\">#{offending_line+i-2}</span>#{line}"
        +    new_line = "<span class=\"offending\">#{new_line}</span>" if i == 2
        +    new_lines << new_line
        +  end
        +  new_lines.join("\n")
        +end
        +
        +
        + +
        +

        + + - (String) snippet(backtrace) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Extract lines of code corresponding to a backtrace.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + backtrace + + + (String) + + + + — +

          the backtrace from a test failure

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          highlighted code snippet indicating where the test failure occured

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 25
        +
        +def snippet(backtrace)
        +  raw_code, line = snippet_for(backtrace[0])
        +  highlighted = @@converter.convert(raw_code, false)
        +  highlighted << "\n<span class=\"comment\"># gem install syntax to get syntax highlighting</span>" if @@converter.is_a?(NullConverter)
        +  post_process(highlighted, line)
        +end
        +
        +
        + +
        +

        + + - (String) snippet_for(error_line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Create a snippet from a line of code.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + error_line + + + (String) + + + + — +

          file name with line number (i.e. 'foo_spec.rb:12')

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          lines around the target line within the file

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 40
        +
        +def snippet_for(error_line)
        +  if error_line =~ /(.*):(\d+)/
        +    file = $1
        +    line = $2.to_i
        +    [lines_around(file, line), line]
        +  else
        +    ["# Couldn't get snippet for #{error_line}", 1]
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/SnippetExtractor/NullConverter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/SnippetExtractor/NullConverter.html new file mode 100644 index 000000000..a6cd79015 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/SnippetExtractor/NullConverter.html @@ -0,0 +1,211 @@ + + + + + + Class: RSpec::Core::Formatters::SnippetExtractor::NullConverter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::SnippetExtractor::NullConverter + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/snippet_extractor.rb
        + +
        +
        + +
        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) convert(code, pre) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 8
        +
        +def convert(code, pre); code; end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/TextMateFormatter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/TextMateFormatter.html new file mode 100644 index 000000000..7640768fb --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Formatters/TextMateFormatter.html @@ -0,0 +1,416 @@ + + + + + + Class: RSpec::Core::Formatters::TextMateFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::TextMateFormatter + + + +

        + +
        + +
        Inherits:
        +
        + HtmlFormatter + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/text_mate_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        Formats backtraces so they're clickable by TextMate

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from HtmlFormatter

        +

        #dump_failures, #dump_pending, #dump_summary, #example_failed, #example_group_number, #example_group_started, #example_number, #example_passed, #example_pending, #example_started, #initialize, #message, #percent_done, #start, #start_dump

        + + + + + + + + + +

        Methods inherited from BaseTextFormatter

        +

        #close, #color_code_for, #colorise_summary, #colorize, const_missing, #dump_commands_to_rerun_failed_examples, #dump_failures, #dump_pending, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #dump_summary, #message, #seed, #summary_line

        + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #close, #dump_failures, #dump_pending, #dump_summary, #example_failed, #example_group_finished, #example_group_started, #example_passed, #example_pending, #example_started, #format_backtrace, #initialize, #message, #start, #start_dump, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Formatters::HtmlFormatter

        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + + in the class RSpec::Core::Formatters::HtmlFormatter + +

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) backtrace_line(line, skip_textmate_conversion = false) + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/formatters/text_mate_formatter.rb', line 9
        +
        +def backtrace_line(line, skip_textmate_conversion=false)
        +  if skip_textmate_conversion
        +    super(line)
        +  else
        +    format_backtrace_line_for_textmate(super(line))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) extra_failure_content(exception) + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/formatters/text_mate_formatter.rb', line 24
        +
        +def extra_failure_content(exception)
        +  require 'rspec/core/formatters/snippet_extractor'
        +  backtrace = exception.backtrace.map {|line| backtrace_line(line, :skip_textmate_conversion)}
        +  backtrace.compact!
        +  @snippet_extractor ||= SnippetExtractor.new
        +  "    <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
        +end
        +
        +
        + +
        +

        + + - (Object) format_backtrace_line_for_textmate(line) + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/core/formatters/text_mate_formatter.rb', line 17
        +
        +def format_backtrace_line_for_textmate(line)
        +  return nil unless line
        +  CGI.escapeHTML(line).sub(/([^:]*\.e?rb):(\d*)/) do
        +    "<a href=\"txmt://open?url=file://#{File.expand_path($1)}&amp;line=#{$2}\">#{$1}:#{$2}</a> "
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks.html new file mode 100644 index 000000000..640f5c308 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks.html @@ -0,0 +1,897 @@ + + + + + + Module: RSpec::Core::Hooks + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Hooks + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Configuration, ExampleGroup, World
        + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: HookCollectionAliases, RegistersGlobals + + + + Classes: AfterAllHook, AfterHook, AroundHook, AroundHookCollection, BeforeHook, GroupHookCollection, Hook, HookCollection + + +

        + +

        Constant Summary

        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) after(*args, &block) + + + + (also: #prepend_after) + + + + + + + + + + + +

          Declare a block of code to be run after each example (using :each) or once after all examples (using :all).

          +
          + +
        • + + +
        • + + + - (Object) append_after(*args, &block) + + + + + + + + + + + + + +

          Adds block to the back of the list of after blocks in the same scope (:each, :all, or :suite).

          +
          + +
        • + + +
        • + + + - (Object) around(*args) {|Example| ... } + + + + + + + + + + + + + +

          Declare a block of code, parts of which will be run before and parts after the example.

          +
          + +
        • + + +
        • + + + - (Object) before(*args, &block) + + + + (also: #append_before) + + + + + + + + + + + +

          Declare a block of code to be run before each example (using :each) or once before any example (using :all).

          +
          + +
        • + + +
        • + + + - (Object) prepend_before(*args, &block) + + + + + + + + + + + + + +

          Adds block to the front of the list of before blocks in the same scope (:each, :all, or :suite).

          +
          + +
        • + + +
        + + + + + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + + - (Object) after(&block) + + - (Object) after(scope, &block) + + - (Object) after(scope, conditions, &block) + + - (Object) after(conditions, &block) + + + + + Also known as: + prepend_after + + + + +

        +
        +

        Declare a block of code to be run after each example (using :each) or +once after all examples (using :all). See +#before for more information about +ordering.

        + +

        Exceptions

        + +

        after hooks are guaranteed to run even when there are exceptions in +before hooks or examples. When an exception is raised in an after +block, the exception is captured for later reporting, and subsequent +after blocks are run.

        + +

        Order

        + +

        after hooks are stored in three scopes, which are run in order: +:each, :all, and :suite. They can also be declared in several +different places: RSpec.configure, a parent group, the current group. +They are run in the following order:

        + +
        after(:each) # declared in the current group
        +after(:each) # declared in a parent group
        +after(:each) # declared in RSpec.configure
        +after(:all)  # declared in the current group
        +after(:all)  # declared in a parent group
        +after(:all)  # declared in RSpec.configure
        +
        + +

        This is the reverse of the order in which before hooks are run. +Similarly, if more than one after is declared within any one scope, +they are run in reverse order of that in which they are declared.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + scope + + + (Symbol) + + + + — +

          :each, :all, or :suite (defaults to :each)

          +
          + +
        • + +
        • + + conditions + + + (Hash) + + + + — +

          constrains this hook to examples matching these conditions e.g. +after(:each, :ui => true) { ... } will only run with examples or +groups declared with :ui => true.

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +379
        +380
        +381
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 379
        +
        +def after(*args, &block)
        +  register_hook :prepend, :after, *args, &block
        +end
        +
        +
        + +
        +

        + + - (Object) append_after(*args, &block) + + + + + +

        +
        +

        Adds block to the back of the list of after blocks in the same +scope (:each, :all, or :suite).

        + +

        See #after for scoping semantics.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +389
        +390
        +391
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 389
        +
        +def append_after(*args, &block)
        +  register_hook :append, :after, *args, &block
        +end
        +
        +
        + +
        +

        + + + - (Object) around(&block) + + - (Object) around(scope, &block) + + - (Object) around(scope, conditions, &block) + + - (Object) around(conditions, &block) + + + + + + +

        +
        + +
        + Note: +

        the syntax of around is similar to that of before and after +but the semantics are quite different. before and after hooks are +run in the context of of the examples with which they are associated, +whereas around hooks are actually responsible for running the +examples. Consequently, around hooks do not have direct access to +resources that are made available within the examples and their +associated before and after hooks.

        +
        +
        + +
        + Note: +

        :each is the only supported scope.

        +
        +
        + +

        Declare a block of code, parts of which will be run before and parts +after the example. It is your responsibility to run the example:

        + +
        around(:each) do |ex|
        +  # do some stuff before
        +  ex.run
        +  # do some stuff after
        +end
        +
        + +

        The yielded example aliases run with call, which lets you treat it +like a Proc. This is especially handy when working with libaries +that manage their own setup and teardown using a block or proc syntax, +e.g.

        + +
        around(:each) {|ex| Database.transaction(&ex)}
        +around(:each) {|ex| FakeFS(&ex)}
        +
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + scope + + + (Symbol) + + + + — +

          :each (defaults to :each) +present for syntax parity with before and after, but :each is +the only supported value.

          +
          + +
        • + +
        • + + conditions + + + (Hash) + + + + — +

          constrains this hook to examples matching these conditions e.g. +around(:each, :ui => true) { ... } will only run with examples or +groups declared with :ui => true.

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example to run

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +437
        +438
        +439
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 437
        +
        +def around(*args, &block)
        +  register_hook :prepend, :around, *args, &block
        +end
        +
        +
        + +
        +

        + + + - (Object) before(&block) + + - (Object) before(scope, &block) + + - (Object) before(scope, conditions, &block) + + - (Object) before(conditions, &block) + + + + + Also known as: + append_before + + + + +

        +
        +

        Declare a block of code to be run before each example (using :each) +or once before any example (using :all). These are usually declared +directly in the ExampleGroup to which they apply, but they can also +be shared across multiple groups.

        + +

        You can also use before(:suite) to run a block of code before any +example groups are run. This should be declared in RSpec.configure

        + +

        Instance variables declared in before(:each) or before(:all) are +accessible within each example.

        + +

        Order

        + +

        before hooks are stored in three scopes, which are run in order: +:suite, :all, and :each. They can also be declared in several +different places: RSpec.configure, a parent group, the current group. +They are run in the following order:

        + +
        before(:suite) # declared in RSpec.configure
        +before(:all)   # declared in RSpec.configure
        +before(:all)   # declared in a parent group
        +before(:all)   # declared in the current group
        +before(:each)  # declared in RSpec.configure
        +before(:each)  # declared in a parent group
        +before(:each)  # declared in the current group
        +
        + +

        If more than one before is declared within any one scope, they are run +in the order in which they are declared.

        + +

        Conditions

        + +

        When you add a conditions hash to before(:each) or before(:all), +RSpec will only apply that hook to groups or examples that match the +conditions. e.g.

        + +
        RSpec.configure do |config|
        +  config.before(:each, :authorized => true) do
        +     :authorized_user
        +  end
        +end
        +
        +describe Something, :authorized => true do
        +  # the before hook will run in before each example in this group
        +end
        +
        +describe SomethingElse do
        +  it "does something", :authorized => true do
        +    # the before hook will run before this example
        +  end
        +
        +  it "does something else" do
        +    # the hook will not run before this example
        +  end
        +end
        +
        + +

        Warning: before(:suite, :with => :conditions)

        + +

        The conditions hash is used to match against specific examples. Since +before(:suite) is not run in relation to any specific example or +group, conditions passed along with :suite are effectively ignored.

        + +

        Exceptions

        + +

        When an exception is raised in a before block, RSpec skips any +subsequent before blocks and the example, but runs all of the +after(:each) and after(:all) hooks.

        + +

        Warning: implicit before blocks

        + +

        before hooks can also be declared in shared contexts which get +included implicitly either by you or by extension libraries. Since +RSpec runs these in the order in which they are declared within each +scope, load order matters, and can lead to confusing results when one +before block depends on state that is prepared in another before block +that gets run later.

        + +

        Warning: before(:all)

        + +

        It is very tempting to use before(:all) to speed things up, but we +recommend that you avoid this as there are a number of gotchas, as well +as things that simply don't work.

        + +

        context

        + +

        before(:all) is run in an example that is generated to provide group +context for the block.

        + +

        instance variables

        + +

        Instance variables declared in before(:all) are shared across all the +examples in the group. This means that each example can change the +state of a shared object, resulting in an ordering dependency that can +make it difficult to reason about failures.

        + +

        unsupported rspec constructs

        + +

        RSpec has several constructs that reset state between each example +automatically. These are not intended for use from within before(:all):

        + +
          +
        • let declarations
        • +
        • subject declarations
        • +
        • Any mocking, stubbing or test double declaration
        • +
        + +

        other frameworks

        + +

        Mock object frameworks and database transaction managers (like +ActiveRecord) are typically designed around the idea of setting up +before an example, running that one example, and then tearing down. +This means that mocks and stubs can (sometimes) be declared in +before(:all), but get torn down before the first real example is ever +run.

        + +

        You can create database-backed model objects in a before(:all) in +rspec-rails, but it will not be wrapped in a transaction for you, so +you are on your own to clean up in an after(:all) block.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        before(:each) declared in an ExampleGroup

        +

        + +
        
        +describe Thing do
        +  before(:each) do
        +    @thing = Thing.new
        +  end
        +
        +  it "does something" do
        +    # here you can access @thing
        +  end
        +end
        + + +

        before(:all) declared in an ExampleGroup

        +

        + +
        
        +describe Parser do
        +  before(:all) do
        +    File.open(file_to_parse, 'w') do |f|
        +      f.write <<-CONTENT
        +        stuff in the file
        +      CONTENT
        +    end
        +  end
        +
        +  it "parses the file" do
        +    Parser.parse(file_to_parse)
        +  end
        +
        +  after(:all) do
        +    File.delete(file_to_parse)
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + scope + + + (Symbol) + + + + — +

          :each, :all, or :suite (defaults to :each)

          +
          + +
        • + +
        • + + conditions + + + (Hash) + + + + — +

          constrains this hook to examples matching these conditions e.g. +before(:each, :ui => true) { ... } will only run with examples or +groups declared with :ui => true.

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +317
        +318
        +319
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 317
        +
        +def before(*args, &block)
        +  register_hook :append, :before, *args, &block
        +end
        +
        +
        + +
        +

        + + - (Object) prepend_before(*args, &block) + + + + + +

        +
        +

        Adds block to the front of the list of before blocks in the same +scope (:each, :all, or :suite).

        + +

        See #before for scoping semantics.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +327
        +328
        +329
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 327
        +
        +def prepend_before(*args, &block)
        +  register_hook :prepend, :before, *args, &block
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AfterAllHook.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AfterAllHook.html new file mode 100644 index 000000000..9667d58fd --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AfterAllHook.html @@ -0,0 +1,283 @@ + + + + + + Class: RSpec::Core::Hooks::AfterAllHook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::AfterAllHook + + + +

        + +
        + +
        Inherits:
        +
        + Hook + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from Hook

        +

        #block, #options

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Hook

        +

        #initialize, #options_apply?

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Hooks::Hook

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) display_name + + + + + +

        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 53
        +
        +def display_name
        +  "after(:all) hook"
        +end
        +
        +
        + +
        +

        + + - (Object) run(example) + + + + + +

        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 40
        +
        +def run(example)
        +  example.instance_exec(example, &block)
        +rescue Exception => e
        +  # TODO: come up with a better solution for this.
        +  RSpec.configuration.reporter.message <<-EOS
        +
        +An error occurred in an after(:all) hook.
        +  #{e.class}: #{e.message}
        +  occurred at #{e.backtrace.first}
        +
        +EOS
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AfterHook.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AfterHook.html new file mode 100644 index 000000000..55f9f5123 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AfterHook.html @@ -0,0 +1,265 @@ + + + + + + Class: RSpec::Core::Hooks::AfterHook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::AfterHook + + + +

        + +
        + +
        Inherits:
        +
        + Hook + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from Hook

        +

        #block, #options

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Hook

        +

        #initialize, #options_apply?

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Hooks::Hook

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) display_name + + + + + +

        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 34
        +
        +def display_name
        +  "after hook"
        +end
        +
        +
        + +
        +

        + + - (Object) run(example) + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 30
        +
        +def run(example)
        +  example.instance_eval_with_rescue("in an after hook", &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AroundHook.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AroundHook.html new file mode 100644 index 000000000..1c32b2844 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AroundHook.html @@ -0,0 +1,213 @@ + + + + + + Class: RSpec::Core::Hooks::AroundHook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::AroundHook + + + +

        + +
        + +
        Inherits:
        +
        + Hook + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from Hook

        +

        #block, #options

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Hook

        +

        #initialize, #options_apply?

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Hooks::Hook

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) display_name + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 59
        +
        +def display_name
        +  "around hook"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AroundHookCollection.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AroundHookCollection.html new file mode 100644 index 000000000..46fab030c --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/AroundHookCollection.html @@ -0,0 +1,320 @@ + + + + + + Class: RSpec::Core::Hooks::AroundHookCollection + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::AroundHookCollection + + + +

        + +
        + +
        Inherits:
        +
        + Array + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        HookCollectionAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) for(example, initial_procsy = nil) + + + + + +

        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +95
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 92
        +
        +def for(example, initial_procsy=nil)
        +  self.class.new(select {|hook| hook.options_apply?(example)}).
        +    with(example, initial_procsy)
        +end
        +
        +
        + +
        +

        + + - (Object) run + + + + + +

        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 103
        +
        +def run
        +  inject(@initial_procsy) do |procsy, around_hook|
        +    Example.procsy(procsy.) do
        +      @example.instance_eval_with_args(procsy, &around_hook.block)
        +    end
        +  end.call
        +end
        +
        +
        + +
        +

        + + - (Object) with(example, initial_procsy) + + + + + +

        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 97
        +
        +def with(example, initial_procsy)
        +  @example = example
        +  @initial_procsy = initial_procsy
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/BeforeHook.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/BeforeHook.html new file mode 100644 index 000000000..29c913da3 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/BeforeHook.html @@ -0,0 +1,265 @@ + + + + + + Class: RSpec::Core::Hooks::BeforeHook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::BeforeHook + + + +

        + +
        + +
        Inherits:
        +
        + Hook + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from Hook

        +

        #block, #options

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Hook

        +

        #initialize, #options_apply?

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Hooks::Hook

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) display_name + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 24
        +
        +def display_name
        +  "before hook"
        +end
        +
        +
        + +
        +

        + + - (Object) run(example) + + + + + +

        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 20
        +
        +def run(example)
        +  example.instance_eval_with_args(example, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/GroupHookCollection.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/GroupHookCollection.html new file mode 100644 index 000000000..0779357fa --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/GroupHookCollection.html @@ -0,0 +1,246 @@ + + + + + + Class: RSpec::Core::Hooks::GroupHookCollection + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::GroupHookCollection + + + +

        + +
        + +
        Inherits:
        +
        + Array + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) for(group) + + + + + +

        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 113
        +
        +def for(group)
        +  @group = group
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) run + + + + + +

        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 118
        +
        +def run
        +  shift.run(@group) until empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/Hook.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/Hook.html new file mode 100644 index 000000000..6385e0824 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/Hook.html @@ -0,0 +1,436 @@ + + + + + + Class: RSpec::Core::Hooks::Hook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::Hook + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        AfterAllHook, AfterHook, AroundHook, BeforeHook

        +
        + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) block + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute block.

          +
          + +
        • + + +
        • + + + - (Object) options + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute options.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Hook) initialize(block, options) + + + + + +

        +
        +

        Returns a new instance of Hook

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 9
        +
        +def initialize(block, options)
        +  @block = block
        +  @options = options
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) block (readonly) + + + + + +

        +
        +

        Returns the value of attribute block

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 7
        +
        +def block
        +  @block
        +end
        +
        +
        + + + +
        +

        + + - (Object) options (readonly) + + + + + +

        +
        +

        Returns the value of attribute options

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 7
        +
        +def options
        +  @options
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) options_apply?(example_or_group) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 14
        +
        +def options_apply?(example_or_group)
        +  example_or_group.all_apply?(options)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/HookCollection.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/HookCollection.html new file mode 100644 index 000000000..eb0e3313b --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/HookCollection.html @@ -0,0 +1,310 @@ + + + + + + Class: RSpec::Core::Hooks::HookCollection + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::HookCollection + + + +

        + +
        + +
        Inherits:
        +
        + Array + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        HookCollectionAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) for(example_or_group) + + + + + +

        + + + + +
        +
        +
        +
        +74
        +75
        +76
        +77
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 74
        +
        +def for(example_or_group)
        +  self.class.new(select {|hook| hook.options_apply?(example_or_group)}).
        +    with(example_or_group)
        +end
        +
        +
        + +
        +

        + + - (Object) run + + + + + +

        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 84
        +
        +def run
        +  each {|h| h.run(@example) } unless empty?
        +end
        +
        +
        + +
        +

        + + - (Object) with(example) + + + + + +

        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 79
        +
        +def with(example)
        +  @example = example
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/HookCollectionAliases.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/HookCollectionAliases.html new file mode 100644 index 000000000..c132894d7 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/HookCollectionAliases.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Core::Hooks::HookCollectionAliases + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Hooks::HookCollectionAliases + + + +

        + +
        + + + + + + + +
        Included in:
        +
        AroundHookCollection, HookCollection
        + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/RegistersGlobals.html b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/RegistersGlobals.html new file mode 100644 index 000000000..d615fea34 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Hooks/RegistersGlobals.html @@ -0,0 +1,182 @@ + + + + + + Module: RSpec::Core::Hooks::RegistersGlobals + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Hooks::RegistersGlobals + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) register_globals(host, globals) + + + + + +

        + + + + +
        +
        +
        +
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 124
        +
        +def register_globals host, globals
        +  [:before, :after, :around].each do |position|
        +    process host, globals, position, :each
        +    next if position == :around # no around(:all) hooks
        +    process host, globals, position, :all
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/MemoizedHelpers.html b/source/documentation/2.99/rspec-core/RSpec/Core/MemoizedHelpers.html new file mode 100644 index 000000000..a1fa28662 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/MemoizedHelpers.html @@ -0,0 +1,566 @@ + + + + + + Module: RSpec::Core::MemoizedHelpers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MemoizedHelpers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/memoized_helpers.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: ClassMethods + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) is_expected + + + + + +

        +
        + +
        + Note: +

        This only works if you are using rspec-expectations.

        +
        +
        + +

        Wraps the subject in expect to make it the target of an expectation. +Designed to read nicely for one-liners.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe [1, 2, 3] do
        +  it { is_expected.to be_an Array }
        +  it { is_expected.not_to include 4 }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 114
        +
        +def is_expected
        +  expect(subject)
        +end
        +
        +
        + +
        +

        + + - (Object) should(matcher = nil, message = nil) + + + + + +

        +
        + +
        + Note: +

        This only works if you are using rspec-expectations.

        +
        +
        + +
        + Note: +

        If you are using RSpec's newer expect-based syntax you may +want to use is_expected.to instead of should.

        +
        +
        + +

        When should is called with no explicit receiver, the call is +delegated to the object returned by subject. Combined with an +implicit subject this supports very concise expressions.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Person do
        +  it { should be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 76
        +
        +def should(matcher=nil, message=nil)
        +  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(subject, matcher, message)
        +end
        +
        +
        + +
        +

        + + - (Object) should_not(matcher = nil, message = nil) + + + + + +

        +
        + +
        + Note: +

        This only works if you are using rspec-expectations.

        +
        +
        + +
        + Note: +

        If you are using RSpec's newer expect-based syntax you may +want to use is_expected.to_not instead of should_not.

        +
        +
        + +

        Just like should, should_not delegates to the subject (implicit or +explicit) of the example group.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Person do
        +  it { should_not be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 95
        +
        +def should_not(matcher=nil, message=nil)
        +  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(subject, matcher, message)
        +end
        +
        +
        + +
        +

        + + - (Object) subject + + + + + +

        +
        + +
        + Note: +

        subject was contributed by Joe Ferris to support the one-liner +syntax embraced by shoulda matchers:

        + +
        describe Widget do
        +  it { is_expected.to validate_presence_of(:name) }
        +  # or
        +  it { should validate_presence_of(:name) }
        +end
        +
        + +

        While the examples below demonstrate how to use subject +explicitly in examples, we recommend that you define a method with +an intention revealing name instead.

        +
        +
        + +
        + Note: +

        Because subject is designed to create state that is reset between +each example, and before(:all) is designed to setup state that is +shared across all examples in an example group, subject is not +intended to be used in a before(:all) hook. RSpec 2.13.1 prints +a warning when you reference a subject from before(:all) and we plan +to have it raise an error in RSpec 3.

        +
        +
        + + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +# explicit declaration of subject
        +describe Person do
        +  subject { Person.new(:birthdate => 19.years.ago) }
        +  it "should be eligible to vote" do
        +    subject.should be_eligible_to_vote
        +    # ^ ^ explicit reference to subject not recommended
        +  end
        +end
        +
        +# implicit subject => { Person.new }
        +describe Person do
        +  it "should be eligible to vote" do
        +    subject.should be_eligible_to_vote
        +    # ^ ^ explicit reference to subject not recommended
        +  end
        +end
        +
        +# one-liner syntax - expectation is set on the subject
        +describe Person do
        +  it { is_expected.to be_eligible_to_vote }
        +  # or
        +  it { should be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 51
        +
        +def subject
        +  __memoized.fetch(:subject) do
        +    __memoized[:subject] = begin
        +      described = described_class || self.class.description
        +      Class === described ? described.new : described
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html b/source/documentation/2.99/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html new file mode 100644 index 000000000..58c9b8de2 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html @@ -0,0 +1,831 @@ + + + + + + Module: RSpec::Core::MemoizedHelpers::ClassMethods + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MemoizedHelpers::ClassMethods + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/memoized_helpers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) its(attribute, &block) + + + + + + + + + + + + + +

          Creates a nested example group named by the submitted attribute, and then generates an example using the submitted block.

          +
          + +
        • + + +
        • + + + - (Object) let(name, &block) + + + + + + + + + + + + + +

          Generates a method whose return value is memoized after the first call.

          +
          + +
        • + + +
        • + + + - (Object) let!(name, &block) + + + + + + + + + + + + + +

          Just like let, except the block is invoked by an implicit before hook.

          +
          + +
        • + + +
        • + + + - (Object) subject(name = nil, &block) + + + + + + + + + + + + + +

          Declares a subject for an example group which can then be wrapped with expect using is_expected to make it the target of an expectation in a concise, one-line example.

          +
          + +
        • + + +
        • + + + - (Object) subject!(name = nil, &block) + + + + + + + + + + + + + +

          Just like subject, except the block is invoked by an implicit before hook.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) its(attribute, &block) + + + + + +

        +
        +

        Creates a nested example group named by the submitted attribute, +and then generates an example using the submitted block.

        + +

        The attribute can be a Symbol or a String. Given a String +with dots, the result is as though you concatenated that String +onto the subject in an expression.

        + +

        When the subject is a Hash, you can refer to the Hash keys by +specifying a Symbol or String in an array.

        + +

        Note that this method does not modify subject in any way, so if you +refer to subject in let or before blocks, you're still +referring to the outer subject.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +# This ...
        +describe Array do
        +  its(:size) { should eq(0) }
        +end
        +
        +# ... generates the same runtime structure as this:
        +describe Array do
        +  describe "size" do
        +    it "should eq(0)" do
        +      subject.size.should eq(0)
        +    end
        +  end
        +end
        + + +
        
        +describe Person do
        +  subject do
        +    Person.new.tap do |person|
        +      person.phone_numbers << "555-1212"
        +    end
        +  end
        +
        +  its("phone_numbers.first") { should eq("555-1212") }
        +end
        + + +
        
        +describe "a configuration Hash" do
        +  subject do
        +    { :max_users => 3,
        +      'admin' => :all_permissions }
        +  end
        +
        +  its([:max_users]) { should eq(3) }
        +  its(['admin']) { should eq(:all_permissions) }
        +
        +  # You can still access to its regular methods this way:
        +  its(:keys) { should include(:max_users) }
        +  its(:count) { should eq(2) }
        +end
        + + +
        
        +describe Person do
        +  subject { Person.new }
        +  before { subject.age = 25 }
        +  its(:age) { should eq(25) }
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +491
        +492
        +493
        +494
        +495
        +496
        +497
        +498
        +499
        +500
        +501
        +502
        +503
        +504
        +505
        +506
        +507
        +508
        +509
        +510
        +511
        +512
        +513
        +514
        +515
        +516
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 491
        +
        +def its(attribute, &block)
        +  RSpec.deprecate("Use of rspec-core's `its` method", :replacement => 'the rspec-its gem')
        +
        +  describe(attribute.to_s) do
        +    if Array === attribute
        +      let(:__its_subject) { subject[*attribute] }
        +    else
        +      let(:__its_subject) do
        +        attribute_chain = attribute.to_s.split('.')
        +        attribute_chain.inject(subject) do |inner_subject, attr|
        +          inner_subject.send(attr)
        +        end
        +      end
        +    end
        +
        +    def should(matcher=nil, message=nil)
        +      RSpec::Expectations::PositiveExpectationHandler.handle_matcher(__its_subject, matcher, message)
        +    end
        +
        +    def should_not(matcher=nil, message=nil)
        +      RSpec::Expectations::NegativeExpectationHandler.handle_matcher(__its_subject, matcher, message)
        +    end
        +
        +    example(&block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) let(name, &block) + + + + + +

        +
        + +
        + Note: +

        let can enhance readability when used sparingly (1,2, or +maybe 3 declarations) in any given example group, but that can +quickly degrade with overuse. YMMV.

        +
        +
        + +
        + Note: +

        let uses an ||= conditional that has the potential to +behave in surprising ways in examples that spawn separate threads, +though we have yet to see this in practice. You've been warned.

        +
        +
        + +
        + Note: +

        Because let is designed to create state that is reset between +each example, and before(:all) is designed to setup state that is +shared across all examples in an example group, let is not +intended to be used in a before(:all) hook. RSpec 2.13.1 prints +a warning when you reference a let from before(:all) and we plan +to have it raise an error in RSpec 3.

        +
        +
        + +

        Generates a method whose return value is memoized after the first +call. Useful for reducing duplication between examples that assign +values to the same local variable.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Thing do
        +  let(:thing) { Thing.new }
        +
        +  it "does something" do
        +    # first invocation, executes block, memoizes and returns result
        +    thing.do_something
        +
        +    # second invocation, returns the memoized value
        +    thing.should be_something
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +252
        +253
        +254
        +255
        +256
        +257
        +258
        +259
        +260
        +261
        +262
        +263
        +264
        +265
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 252
        +
        +def let(name, &block)
        +  # We have to pass the block directly to `define_method` to
        +  # allow it to use method constructs like `super` and `return`.
        +  raise "#let or #subject called without a block" if block.nil?
        +  MemoizedHelpers.module_for(self).send(:define_method, name, &block)
        +
        +  # Apply the memoization. The method has been defined in an ancestor
        +  # module so we can use `super` here to get the value.
        +  if block.arity == 1
        +    define_method(name) { __memoized.fetch(name) { |k| __memoized[k] = super(RSpec.current_example, &nil) } }
        +  else
        +    define_method(name) { __memoized.fetch(name) { |k| __memoized[k] = super(&nil) } }
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) let!(name, &block) + + + + + +

        +
        +

        Just like let, except the block is invoked by an implicit before +hook. This serves a dual purpose of setting up state and providing a +memoized reference to that state.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +class Thing
        +  def self.count
        +    @count ||= 0
        +  end
        +
        +  def self.count=(val)
        +    @count += val
        +  end
        +
        +  def self.reset_count
        +    @count = 0
        +  end
        +
        +  def initialize
        +    self.class.count += 1
        +  end
        +end
        +
        +describe Thing do
        +  after(:each) { Thing.reset_count }
        +
        +  context "using let" do
        +    let(:thing) { Thing.new }
        +
        +    it "is not invoked implicitly" do
        +      Thing.count.should eq(0)
        +    end
        +
        +    it "can be invoked explicitly" do
        +      thing
        +      Thing.count.should eq(1)
        +    end
        +  end
        +
        +  context "using let!" do
        +    let!(:thing) { Thing.new }
        +
        +    it "is invoked implicitly" do
        +      Thing.count.should eq(1)
        +    end
        +
        +    it "returns memoized version on first invocation" do
        +      thing
        +      Thing.count.should eq(1)
        +    end
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +320
        +321
        +322
        +323
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 320
        +
        +def let!(name, &block)
        +  let(name, &block)
        +  before { __send__(name) }
        +end
        +
        +
        + +
        +

        + + - (Object) subject(name = nil, &block) + + + + + +

        +
        +

        Declares a subject for an example group which can then be wrapped +with expect using is_expected to make it the target of an expectation +in a concise, one-line example.

        + +

        Given a name, defines a method with that name which returns the +subject. This lets you declare the subject once and access it +implicitly in one-liners and explicitly using an intention revealing +name.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe CheckingAccount, "with $50" do
        +  subject { CheckingAccount.new(Money.new(50, :USD)) }
        +  it { is_expected.to have_a_balance_of(Money.new(50, :USD)) }
        +  it { is_expected.not_to be_overdrawn }
        +end
        +
        +describe CheckingAccount, "with a non-zero starting balance" do
        +  subject(:account) { CheckingAccount.new(Money.new(50, :USD)) }
        +  it { is_expected.not_to be_overdrawn }
        +  it "has a balance equal to the starting balance" do
        +    .balance.should eq(Money.new(50, :USD))
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (String, Symbol) + + + (defaults to: nil) + + + — +

          used to define an accessor with an +intention revealing name

          +
          + +
        • + +
        • + + block + + + + + + + — +

          defines the value to be returned by subject in examples

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +355
        +356
        +357
        +358
        +359
        +360
        +361
        +362
        +363
        +364
        +365
        +366
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 355
        +
        +def subject(name=nil, &block)
        +  if name
        +    let(name, &block)
        +    alias_method :subject, name
        +
        +    self::NamedSubjectPreventSuper.send(:define_method, name) do
        +      raise NotImplementedError, "`super` in named subjects is not supported"
        +    end
        +  else
        +    let(:subject, &block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) subject!(name = nil, &block) + + + + + +

        +
        +

        Just like subject, except the block is invoked by an implicit before +hook. This serves a dual purpose of setting up state and providing a +memoized reference to that state.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +class Thing
        +  def self.count
        +    @count ||= 0
        +  end
        +
        +  def self.count=(val)
        +    @count += val
        +  end
        +
        +  def self.reset_count
        +    @count = 0
        +  end
        +
        +  def initialize
        +    self.class.count += 1
        +  end
        +end
        +
        +describe Thing do
        +  after(:each) { Thing.reset_count }
        +
        +  context "using subject" do
        +    subject { Thing.new }
        +
        +    it "is not invoked implicitly" do
        +      Thing.count.should eq(0)
        +    end
        +
        +    it "can be invoked explicitly" do
        +      subject
        +      Thing.count.should eq(1)
        +    end
        +  end
        +
        +  context "using subject!" do
        +    subject!(:thing) { Thing.new }
        +
        +    it "is invoked implicitly" do
        +      Thing.count.should eq(1)
        +    end
        +
        +    it "returns memoized version on first invocation" do
        +      subject
        +      Thing.count.should eq(1)
        +    end
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +421
        +422
        +423
        +424
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 421
        +
        +def subject!(name=nil, &block)
        +  subject(name, &block)
        +  before { subject }
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Metadata.html b/source/documentation/2.99/rspec-core/RSpec/Core/Metadata.html new file mode 100644 index 000000000..2b0720d45 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Metadata.html @@ -0,0 +1,460 @@ + + + + + + Class: RSpec::Core::Metadata + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Metadata + + + +

        + +
        + +
        Inherits:
        +
        + Hash + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/metadata.rb
        + +
        +
        + +

        Overview

        +
        +

        Each ExampleGroup class and Example instance owns an instance of +Metadata, which is Hash extended to support lazy evaluation of values +associated with keys that may or may not be used by any example or group.

        + +

        In addition to metadata that is used internally, this also stores +user-supplied metadata, e.g.

        + +
        describe Something, :type => :ui do
        +  it "does something", :slow => true do
        +    # ...
        +  end
        +end
        +
        + +

        :type => :ui is stored in the Metadata owned by the example group, and +:slow => true is stored in the Metadata owned by the example. These can +then be used to select which examples are run using the --tag option on +the command line, or several methods on Configuration used to filter a +run (e.g. filter_run_including, filter_run_excluding, etc).

        + + +
        +
        +

        Defined Under Namespace

        +

        + + + Modules: ExampleMetadataHash, GroupMetadataHash + + + + +

        + +

        Constant Summary

        + + + + + +

        Class Attribute Summary (collapse)

        + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Metadata) initialize(parent_group_metadata = nil) {|_self| ... } + + + + + +

        +
        +

        Returns a new instance of Metadata

        + + +
        +
        +
        + +

        Yields:

        +
          + +
        • + + + (_self) + + + +
        • + +
        +

        Yield Parameters:

        +
          + +
        • + + _self + + + (RSpec::Core::Metadata) + + + + — +

          the object that the method was called on

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +215
        +216
        +217
        +218
        +219
        +220
        +221
        +222
        +223
        +224
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 215
        +
        +def initialize(=nil)
        +  if 
        +    update()
        +    store(:example_group, {:example_group => [:example_group].extend(GroupMetadataHash)}.extend(GroupMetadataHash))
        +  else
        +    store(:example_group, {}.extend(GroupMetadataHash))
        +  end
        +
        +  yield self if block_given?
        +end
        +
        +
        + +
        + +
        +

        Class Attribute Details

        + + + +
        +

        + + + (Object) line_number_filter_deprecation_issued + + + + + +

        +
        +

        Returns the value of attribute line_number_filter_deprecation_issued

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 29
        +
        +def line_number_filter_deprecation_issued
        +  @line_number_filter_deprecation_issued
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) relative_path(line) + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 32
        +
        +def self.relative_path(line)
        +  line = line.sub(File.expand_path("."), ".")
        +  line = line.sub(/\A([^:]+:\d+)$/, '\\1')
        +  return nil if line == '-e:1'
        +  line
        +rescue SecurityError
        +  nil
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Metadata/ExampleMetadataHash.html b/source/documentation/2.99/rspec-core/RSpec/Core/Metadata/ExampleMetadataHash.html new file mode 100644 index 000000000..e553bfdde --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Metadata/ExampleMetadataHash.html @@ -0,0 +1,243 @@ + + + + + + Module: RSpec::Core::Metadata::ExampleMetadataHash + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Metadata::ExampleMetadataHash + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/metadata.rb
        + +
        +
        + +

        Overview

        +
        +

        Mixed in to Metadata for an Example (extends MetadataHash) to support +lazy evaluation of some values.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) described_class + + + + + +

        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 118
        +
        +def described_class
        +  self[:example_group].described_class
        +end
        +
        +
        + +
        +

        + + - (Object) full_description + + + + + +

        + + + + +
        +
        +
        +
        +122
        +123
        +124
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 122
        +
        +def full_description
        +  build_description_from(self[:example_group][:full_description], *self[:description_args])
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Metadata/GroupMetadataHash.html b/source/documentation/2.99/rspec-core/RSpec/Core/Metadata/GroupMetadataHash.html new file mode 100644 index 000000000..7492c01aa --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Metadata/GroupMetadataHash.html @@ -0,0 +1,611 @@ + + + + + + Module: RSpec::Core::Metadata::GroupMetadataHash + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Metadata::GroupMetadataHash + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/metadata.rb
        + +
        +
        + +

        Overview

        +
        +

        Mixed in to Metadata for an ExampleGroup (extends MetadataHash) to +support lazy evaluation of some values.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) container_stack + + + + + +

        + + + + +
        +
        +
        +
        +203
        +204
        +205
        +206
        +207
        +208
        +209
        +210
        +211
        +212
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 203
        +
        +def container_stack
        +  @container_stack ||= begin
        +                         groups = [group = self]
        +                         while group.has_key?(:example_group)
        +                           groups << group[:example_group]
        +                           group = group[:example_group]
        +                         end
        +                         groups
        +                       end
        +end
        +
        +
        + +
        +

        + + - (Object) described_class + + + + + +

        + + + + +
        +
        +
        +
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +154
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 132
        +
        +def described_class
        +  warn_about_first_description_arg_behavioral_change_in_rspec_3
        +
        +  value_for_rspec_2 = described_class_for_rspec_2
        +  value_for_rspec_3 = described_class_for_rspec_3
        +
        +  if value_for_rspec_2 != value_for_rspec_3
        +    RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, ''))
        +      |The semantics of `described_class` in a nested `describe <SomeClass>`
        +      |example group are changing in RSpec 3. In RSpec 2.x, `described_class`
        +      |would return the outermost described class (#{value_for_rspec_2.inspect}).
        +      |In RSpec 3, it will return the innermost described class (#{value_for_rspec_3.inspect}).
        +      |In general, we recommend not describing multiple classes or objects in a
        +      |nested manner as it creates confusion.
        +      |
        +      |To make your code compatible with RSpec 3, change from `described_class` to a reference
        +      |to `#{value_for_rspec_3.inspect}`, or change the arg of the inner `describe` to a string.
        +      |(Called from #{CallerFilter.first_non_rspec_line})
        +    EOS
        +  end
        +
        +  value_for_rspec_2
        +end
        +
        +
        + +
        +

        + + - (Object) described_class_for_rspec_2 + + + + + +

        + + + + +
        +
        +
        +
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +165
        +166
        +167
        +168
        +169
        +170
        +171
        +172
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 156
        +
        +def described_class_for_rspec_2
        +  container_stack.each do |g|
        +    [:described_class, :describes].each do |key|
        +      if g.has_key?(key)
        +        value = g[key]
        +        return value unless value.nil?
        +      end
        +    end
        +  end
        +
        +  container_stack.reverse.each do |g|
        +    candidate = g[:description_args].first
        +    return candidate unless String === candidate || Symbol === candidate
        +  end
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + - (Object) described_class_for_rspec_3 + + + + + +

        + + + + +
        +
        +
        +
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +182
        +183
        +184
        +185
        +186
        +187
        +188
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 174
        +
        +def described_class_for_rspec_3
        +  container_stack.each do |g|
        +    [:described_class, :describes].each do |key|
        +      if g.has_key?(key)
        +        value = g[key]
        +        return value unless value.nil?
        +      end
        +    end
        +
        +    candidate = g[:description_args].first
        +    return candidate unless NilClass === candidate || String === candidate || Symbol === candidate
        +  end
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + - (Object) first_description_arg + + + + + +

        + + + + +
        +
        +
        +
        +195
        +196
        +197
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 195
        +
        +def first_description_arg
        +  self[:description_args].first
        +end
        +
        +
        + +
        +

        + + - (Object) full_description + + + + + +

        + + + + +
        +
        +
        +
        +199
        +200
        +201
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 199
        +
        +def full_description
        +  build_description_from(*container_stack.reverse.map {|a| a[:description_args]}.flatten)
        +end
        +
        +
        + +
        +

        + + - (Object) warn_about_first_description_arg_behavioral_change_in_rspec_3 + + + + + +

        + + + + +
        +
        +
        +
        +190
        +191
        +192
        +193
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 190
        +
        +def warn_about_first_description_arg_behavioral_change_in_rspec_3
        +  return unless behavior_change = self[:description_arg_behavior_changing_in_rspec_3]
        +  RSpec.warn_deprecation(behavior_change.warning)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/MockFrameworkAdapter.html b/source/documentation/2.99/rspec-core/RSpec/Core/MockFrameworkAdapter.html new file mode 100644 index 000000000..8c4ad5672 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/MockFrameworkAdapter.html @@ -0,0 +1,401 @@ + + + + + + Module: RSpec::Core::MockFrameworkAdapter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MockFrameworkAdapter + + + +

        + +
        + + + + + +
        Includes:
        +
        FlexMock::MockContainer, RR::Extensions::InstanceMethods
        + + + + + +
        Defined in:
        +
        lib/rspec/core/mocking/with_rr.rb,
        + lib/rspec/core/mocking/with_rspec.rb,
        lib/rspec/core/mocking/with_mocha.rb,
        lib/rspec/core/mocking/with_flexmock.rb,
        lib/rspec/core/mocking/with_absolutely_nothing.rb
        +
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) configuration + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/core/mocking/with_rspec.rb', line 9
        +
        +def self.configuration
        +  RSpec::Mocks.configuration
        +end
        +
        +
        + +
        +

        + + + (Object) framework_name + + + + + +

        + + + + +
        +
        +
        +
        +9
        +
        +
        # File 'lib/rspec/core/mocking/with_rr.rb', line 9
        +
        +def self.framework_name; :rr end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) setup_mocks_for_rspec + + + + + +

        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/mocking/with_rr.rb', line 13
        +
        +def setup_mocks_for_rspec
        +  RR::Space.instance.reset
        +end
        +
        +
        + +
        +

        + + - (Object) teardown_mocks_for_rspec + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/core/mocking/with_rr.rb', line 21
        +
        +def teardown_mocks_for_rspec
        +  RR::Space.instance.reset
        +end
        +
        +
        + +
        +

        + + - (Object) verify_mocks_for_rspec + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/mocking/with_rr.rb', line 17
        +
        +def verify_mocks_for_rspec
        +  RR::Space.instance.verify_doubles
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Parser.html b/source/documentation/2.99/rspec-core/RSpec/Core/Parser.html new file mode 100644 index 000000000..e18e1821f --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Parser.html @@ -0,0 +1,892 @@ + + + + + + Class: RSpec::Core::Parser + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Parser + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/option_parser.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) parse + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 11
        +
        +def self.parse!(args)
        +  new.parse!(args)
        +end
        +
        +
        + +
        +

        + + + (Object) parse!(args) + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 6
        +
        +def self.parse!(args)
        +  new.parse!(args)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) convert_deprecated_args(args) + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 30
        +
        +def convert_deprecated_args(args)
        +  args.map! { |arg|
        +    case arg
        +    when "--formatter"
        +      RSpec.deprecate("The `--formatter` option", :replacement => "-f or --format", :call_site => nil)
        +      "--format"
        +    when "--default_path"
        +      RSpec.deprecate("The `--default_path` option", :replacement => "--default-path", :call_site => nil)
        +      "--default-path"
        +    when "--line_number"
        +      "--line-number"
        +    else
        +      arg
        +    end
        +  }
        +end
        +
        +
        + +
        +

        + + - (Object) parse!(args) + + + + Also known as: + parse + + + + +

        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 14
        +
        +def parse!(args)
        +  return {} if args.empty?
        +
        +  pre_parse(args)
        +  convert_deprecated_args(args)
        +
        +  options = args.delete('--tty') ? {:tty => true} : {}
        +  begin
        +    parser(options).parse!(args)
        +  rescue OptionParser::InvalidOption => e
        +    abort "#{e.message}\n\nPlease use --help for a listing of valid options"
        +  end
        +
        +  options
        +end
        +
        +
        + +
        +

        + + - (Object) parser(options) + + + + + +

        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +165
        +166
        +167
        +168
        +169
        +170
        +171
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +182
        +183
        +184
        +185
        +186
        +187
        +188
        +189
        +190
        +191
        +192
        +193
        +194
        +195
        +196
        +197
        +198
        +199
        +200
        +201
        +202
        +203
        +204
        +205
        +206
        +207
        +208
        +209
        +210
        +211
        +212
        +213
        +214
        +215
        +216
        +217
        +218
        +219
        +220
        +221
        +222
        +223
        +224
        +225
        +226
        +227
        +228
        +229
        +230
        +231
        +232
        +233
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 49
        +
        +def parser(options)
        +  OptionParser.new do |parser|
        +    parser.banner = "Usage: rspec [options] [files or directories]\n\n"
        +
        +    parser.on('-I PATH', 'Specify PATH to add to $LOAD_PATH (may be used more than once).') do |dir|
        +      options[:libs] ||= []
        +      options[:libs] << dir
        +    end
        +
        +    parser.on('-r', '--require PATH', 'Require a file.') do |path|
        +      options[:requires] ||= []
        +      options[:requires] << path
        +    end
        +
        +    parser.on('-O', '--options PATH', 'Specify the path to a custom options file.') do |path|
        +      options[:custom_options_file] = path
        +    end
        +
        +    parser.on('--order TYPE[:SEED]', 'Run examples by the specified order type.',
        +              '  [defined] groups and examples are run in the order they are defined',
        +              '  [default] deprecated alias for defined',
        +              '  [rand]    randomize the order of files, groups and examples',
        +              '  [random]  alias for rand',
        +              '  [random:SEED] e.g. --order random:123') do |o|
        +      options[:order] = if o == 'default'
        +                          RSpec.deprecate("RSpec's `--order default` CLI option", :replacement => "`--order defined`", :call_site => nil)
        +                          'defined'
        +                        else
        +                          o
        +                        end
        +    end
        +
        +    parser.on('--seed SEED', Integer, 'Equivalent of --order rand:SEED.') do |seed|
        +      options[:order] = "rand:#{seed}"
        +    end
        +
        +    parser.on('-d', '--debugger', 'Enable debugging.') do |o|
        +      options[:debug] = :cli
        +    end
        +
        +    parser.on('--fail-fast', 'Abort the run on first failure.') do |o|
        +      options[:fail_fast] = true
        +    end
        +
        +    parser.on('--failure-exit-code CODE', Integer, 'Override the exit code used when there are failing specs.') do |code|
        +      options[:failure_exit_code] = code
        +    end
        +
        +    parser.on('-X', '--[no-]drb', 'Run examples via DRb.') do |o|
        +      options[:drb] = o
        +    end
        +
        +    parser.on('--drb-port PORT', 'Port to connect to the DRb server.') do |o|
        +      options[:drb_port] = o.to_i
        +    end
        +
        +    parser.on('--init', 'Initialize your project with RSpec.') do |cmd|
        +      ProjectInitializer.new(cmd).run
        +      exit
        +    end
        +
        +    parser.on('--configure', 'Deprecated. Use --init instead.') do |cmd|
        +      warn "--configure is deprecated with no effect. Use --init instead."
        +      exit
        +    end
        +
        +    parser.separator("\n  **** Output ****\n\n")
        +
        +    parser.on('-f', '--format FORMATTER', 'Choose a formatter.',
        +            '  [p]rogress (default - dots)',
        +            '  [d]ocumentation (group and example names)',
        +            '  [h]tml',
        +            '  [t]extmate',
        +            '  [j]son',
        +            '  custom formatter class name') do |o|
        +      options[:formatters] ||= []
        +      options[:formatters] << [o]
        +    end
        +
        +    parser.on('-o', '--out FILE',
        +              'Write output to a file instead of $stdout. This option applies',
        +              '  to the previously specified --format, or the default format',
        +              '  if no format is specified.'
        +             ) do |o|
        +      options[:formatters] ||= [['progress']]
        +      options[:formatters].last << o
        +    end
        +
        +    parser.on('--deprecation-out FILE', 'Write deprecation warnings to a file instead of $stdout.') do |file|
        +      # Handled in `pre_parse` so we can set the deprecation stream as early as
        +      # possible in case any other options cause deprecations to be issued.
        +    end
        +
        +    parser.on('-b', '--backtrace', 'Enable full backtrace.') do |o|
        +      options[:full_backtrace] = true
        +    end
        +
        +    parser.on('-c', '--[no-]color', '--[no-]colour', 'Enable color in the output.') do |o|
        +      options[:color] = o
        +    end
        +
        +    parser.on('-p', '--[no-]profile [COUNT]', 'Enable profiling of examples and list the slowest examples (default: 10).') do |argument|
        +      options[:profile_examples] = if argument.nil?
        +                                     true
        +                                   elsif argument == false
        +                                     false
        +                                   else
        +                                     begin
        +                                       Integer(argument)
        +                                     rescue ArgumentError
        +                                       Kernel.warn "Non integer specified as profile count, seperate " +
        +                                                   "your path from options with -- e.g. " +
        +                                                   "`rspec --profile -- #{argument}`"
        +                                       true
        +                                     end
        +                                   end
        +    end
        +
        +    parser.on('-w', '--warnings', 'Enable ruby warnings') do
        +      options[:warnings] = true
        +    end
        +
        +    parser.separator <<-FILTERING
        +
        +  **** Filtering/tags ****
        +
        +In addition to the following options for selecting specific files, groups,
        +or examples, you can select a single example by appending the line number to
        +the filename:
        +
        +  rspec path/to/a_spec.rb:37
        +
        +FILTERING
        +
        +    parser.on('-P', '--pattern PATTERN', 'Load files matching pattern (default: "spec/**/*_spec.rb").') do |o|
        +      options[:pattern] = o
        +    end
        +
        +    parser.on('-e', '--example STRING', "Run examples whose full nested names include STRING (may be",
        +                                        "  used more than once)") do |o|
        +      (options[:full_description] ||= []) << Regexp.compile(Regexp.escape(o))
        +    end
        +
        +    parser.on('-l', '--line-number LINE', 'Specify line number of an example or group (may be',
        +                                          '  used more than once).') do |o|
        +      Metadata.line_number_filter_deprecation_issued = true
        +      RSpec.deprecate("The `--line-number`/`-l` CLI option",
        +                      :replacement => "the `path/to/file.rb:num` form",
        +                      :call_site => nil)
        +      (options[:line_numbers] ||= []) << o
        +    end
        +
        +    parser.on('-t', '--tag TAG[:VALUE]',
        +              'Run examples with the specified tag, or exclude examples',
        +              'by adding ~ before the tag.',
        +              '  - e.g. ~slow',
        +              '  - TAG is always converted to a symbol') do |tag|
        +      filter_type = tag =~ /^~/ ? :exclusion_filter : :inclusion_filter
        +
        +      name,value = tag.gsub(/^(~@|~|@)/, '').split(':')
        +      name = name.to_sym
        +
        +      options[filter_type] ||= {}
        +      options[filter_type][name] = value.nil? ? true : eval(value) rescue value
        +    end
        +
        +    parser.on('--default-path PATH', 'Set the default path where RSpec looks for examples (can',
        +                                     '  be a path to a file or a directory).') do |path|
        +      options[:default_path] = path
        +    end
        +
        +    parser.separator("\n  **** Utility ****\n\n")
        +
        +    parser.on('-v', '--version', 'Display the version.') do
        +      puts RSpec::Core::Version::STRING
        +      exit
        +    end
        +
        +    parser.on_tail('-h', '--help', "You're looking at it.") do
        +      puts parser
        +      exit
        +    end
        +
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) pre_parse(args) + + + + + +

        + + + + +
        +
        +
        +
        +235
        +236
        +237
        +238
        +239
        +240
        +241
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 235
        +
        +def pre_parse(args)
        +  args.each_cons(2) do |arg, value|
        +    if arg == "--deprecation-out"
        +      RSpec.configuration.deprecation_stream = value
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Pending.html b/source/documentation/2.99/rspec-core/RSpec/Core/Pending.html new file mode 100644 index 000000000..d9bf5e1d0 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Pending.html @@ -0,0 +1,633 @@ + + + + + + Module: RSpec::Core::Pending + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Pending + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/pending.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: SkipDeclaredInExample + + +

        + +

        Constant Summary

        + +
        + +
        NO_REASON_GIVEN = + +
        +
        'No reason given'
        + +
        NOT_YET_IMPLEMENTED = + +
        +
        'Not yet implemented'
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) const_missing(name) + + + + + +

        + + + + +
        +
        +
        +
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +
        +
        # File 'lib/rspec/core/pending.rb', line 146
        +
        +def self.const_missing(name)
        +  return super unless name == :PendingDeclaredInExample
        +
        +  RSpec.deprecate("RSpec::Core::PendingDeclaredInExample",
        +    :replacement => "RSpec::Core::Pending::SkipDeclaredInExample")
        +
        +  SkipDeclaredInExample
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + + - (Object) pending + + - (Object) pending(message) + + - (Object) pending(message, &block) + + + + + + +

        +
        + +
        + Note: +

        before(:each) hooks are eval'd when you use the pending +method within an example. If you want to declare an example pending +and bypass the before hooks as well, you can pass :pending => true +to the it method:

        + +
        it "does something", :pending => true do
        +  # ...
        +end
        +
        + +

        or pass :pending => "something else getting finished" to add a +message to the summary report:

        + +
        it "does something", :pending => "something else getting finished" do
        +  # ...
        +end
        +
        +
        +
        + +

        Stops execution of an example, and reports it as pending. Takes an +optional message and block.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe "an example" do
        +  # reported as "Pending: no reason given"
        +  it "is pending with no message" do
        +    pending
        +    this_does_not_get_executed
        +  end
        +
        +  # reported as "Pending: something else getting finished"
        +  it "is pending with a custom message" do
        +    pending("something else getting finished")
        +    this_does_not_get_executed
        +  end
        +
        +  # reported as "Pending: something else getting finished"
        +  it "is pending with a failing block" do
        +    pending("something else getting finished") do
        +      raise "this is the failure"
        +    end
        +  end
        +
        +  # reported as failure, saying we expected the block to fail but
        +  # it passed.
        +  it "is pending with a passing block" do
        +    pending("something else getting finished") do
        +      true.should be(true)
        +    end
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + + — +

          optional message to add to the summary report.

          +
          + +
        • + +
        • + + block + + + (Block) + + + + — +

          optional block. If it fails, the example is +reported as pending. If it executes cleanly the example fails.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +
        +
        # File 'lib/rspec/core/pending.rb', line 81
        +
        +def pending(*args, &block)
        +  RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, ''))
        +    |The semantics of `RSpec::Core::Pending#pending` are changing in
        +    |RSpec 3.  In RSpec 2.x, it caused the example to be skipped. In
        +    |RSpec 3, the rest of the example will still be run but is expected
        +    |to fail, and will be marked as a failure (rather than as pending)
        +    |if the example passes.
        +    |
        +    |Any passed block will no longer be executed. This feature is being
        +    |removed since it was semantically inconsistent, and the behaviour it
        +    |offered is being made available with the other ways of marking an
        +    |example pending.
        +    |
        +    |To keep the same skip semantics, change `pending` to `skip`.
        +    |Otherwise, if you want the new RSpec 3 behavior, you can safely
        +    |ignore this warning and continue to upgrade to RSpec 3 without
        +    |addressing it.
        +    |
        +    |Called from #{CallerFilter.first_non_rspec_line}.
        +    |
        +  EOS
        +
        +  pending_no_warning(*args, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) pending_no_warning(*args) + + + + + +

        +
        + + +
        +
        +
        + +

        Raises:

        + + +
        + + + + +
        +
        +
        +
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +
        +
        # File 'lib/rspec/core/pending.rb', line 106
        +
        +def pending_no_warning(*args)
        +  return self.class.before(:each) { pending(*args) } unless RSpec.current_example
        +
        +  options = args.last.is_a?(Hash) ? args.pop : {}
        +  message = args.first || NO_REASON_GIVEN
        +
        +  if options[:unless] || (options.has_key?(:if) && !options[:if])
        +    return block_given? ? yield : nil
        +  end
        +
        +  RSpec.current_example.[:pending] = true
        +  RSpec.current_example.[:execution_result][:pending_message] = message
        +  RSpec.current_example.execution_result[:pending_fixed] = false
        +  if block_given?
        +    begin
        +      result = begin
        +                 yield
        +                 RSpec.current_example.example_group_instance.instance_eval { verify_mocks_for_rspec }
        +               end
        +      RSpec.current_example.[:pending] = false
        +    rescue Exception => e
        +      RSpec.current_example.execution_result[:exception] = e
        +    ensure
        +      teardown_mocks_for_rspec
        +    end
        +    if result
        +      RSpec.current_example.execution_result[:pending_fixed] = true
        +      raise PendingExampleFixedError.new
        +    end
        +  end
        +  raise SkipDeclaredInExample.new(message)
        +end
        +
        +
        + +
        +

        + + - (Object) skip(*args) + + + + + +

        +
        +

        Backport from RSpec 3 to aid in upgrading.

        + +

        Not using alias method because we explictly want to discard any block.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +142
        +143
        +144
        +
        +
        # File 'lib/rspec/core/pending.rb', line 142
        +
        +def skip(*args)
        +  pending_no_warning(*args)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Pending/SkipDeclaredInExample.html b/source/documentation/2.99/rspec-core/RSpec/Core/Pending/SkipDeclaredInExample.html new file mode 100644 index 000000000..0c99d3dd4 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Pending/SkipDeclaredInExample.html @@ -0,0 +1,285 @@ + + + + + + Exception: RSpec::Core::Pending::SkipDeclaredInExample + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Exception: RSpec::Core::Pending::SkipDeclaredInExample + + + +

        + +
        + +
        Inherits:
        +
        + StandardError + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/pending.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) argument + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute argument.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (SkipDeclaredInExample) initialize(argument) + + + + + +

        +
        +

        Returns a new instance of SkipDeclaredInExample

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/pending.rb', line 7
        +
        +def initialize(argument)
        +  super(argument.to_s)
        +  @argument = argument
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) argument (readonly) + + + + + +

        +
        +

        Returns the value of attribute argument

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/core/pending.rb', line 5
        +
        +def argument
        +  @argument
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/ProjectInitializer.html b/source/documentation/2.99/rspec-core/RSpec/Core/ProjectInitializer.html new file mode 100644 index 000000000..bc3435b16 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/ProjectInitializer.html @@ -0,0 +1,622 @@ + + + + + + Class: RSpec::Core::ProjectInitializer + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::ProjectInitializer + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/project_initializer.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ProjectInitializer) initialize(arg = nil) + + + + + +

        +
        +

        Returns a new instance of ProjectInitializer

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 4
        +
        +def initialize(arg=nil)
        +  @arg = arg
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) create_dot_rspec_file + + + + + +

        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 22
        +
        +def create_dot_rspec_file
        +  if File.exist?('.rspec')
        +    report_exists('.rspec')
        +  else
        +    report_creating('.rspec')
        +    File.open('.rspec','w') do |f|
        +      f.write <<-CONTENT
        +--color
        +--format progress
        +CONTENT
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) create_spec_helper_file + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 36
        +
        +def create_spec_helper_file
        +  if File.exist?('spec/spec_helper.rb')
        +    report_exists("spec/spec_helper.rb")
        +  else
        +    report_creating("spec/spec_helper.rb")
        +    FileUtils.mkdir_p('spec')
        +    File.open('spec/spec_helper.rb','w') do |f|
        +      f.write <<-CONTENT
        +# This file was generated by the `rspec --init` command. Conventionally, all
        +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
        +# Require this file using `require "spec_helper"` to ensure that it is only
        +# loaded once.
        +#
        +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
        +RSpec.configure do |config|
        +  config.treat_symbols_as_metadata_keys_with_true_values = true
        +  config.run_all_when_everything_filtered = true
        +  config.filter_run :focus
        +
        +  # Run specs in random order to surface order dependencies. If you find an
        +  # order dependency and want to debug it, you can fix the order by providing
        +  # the seed, which is printed after each run.
        +  #     --seed 1234
        +  config.order = 'random'
        +end
        +CONTENT
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) delete_if_confirmed(path, message) + + + + + +

        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 66
        +
        +def delete_if_confirmed(path, message)
        +  if File.exist?(path)
        +    puts
        +    puts message
        +    puts
        +    puts "  delete   #{path}? [y/n]"
        +    FileUtils.rm_rf(path) if gets =~ /y/i
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) report_creating(file) + + + + + +

        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 80
        +
        +def report_creating(file)
        +  puts "  create   #{file}"
        +end
        +
        +
        + +
        +

        + + - (Object) report_exists(file) + + + + + +

        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 76
        +
        +def report_exists(file)
        +  puts "   exist   #{file}"
        +end
        +
        +
        + +
        +

        + + - (Object) run + + + + + +

        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 8
        +
        +def run
        +  create_spec_helper_file
        +  create_dot_rspec_file
        +  delete_if_confirmed("autotest/discover.rb", <<-MESSAGE)
        +  RSpec registers its own discover.rb with Autotest, so autotest/discover.rb is
        +  no longer needed.
        +  MESSAGE
        +
        +  delete_if_confirmed("lib/tasks/rspec.rake", <<-MESSAGE)
        +  If the file in lib/tasks/rspec.rake is the one generated by rspec-rails-1x,
        +  you can get rid of it, as it is no longer needed with rspec-2.
        +  MESSAGE
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/RakeTask.html b/source/documentation/2.99/rspec-core/RSpec/Core/RakeTask.html new file mode 100644 index 000000000..bad60929f --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/RakeTask.html @@ -0,0 +1,1578 @@ + + + + + + Class: RSpec::Core::RakeTask + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::RakeTask + + + +

        + +
        + +
        Inherits:
        +
        + Rake::TaskLib + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Rake::DSL
        + + + + + +
        Defined in:
        +
        lib/rspec/core/rake_task.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) fail_on_error + + + + + + + + + + + + + + + + +

          Whether or not to fail Rake when an error occurs (typically when examples fail).

          +
          + +
        • + + +
        • + + + - (Object) failure_message + + + + + + + + + + + + + + + + +

          A message to print to stderr when there are failures.

          +
          + +
        • + + +
        • + + + - (Object) name + + + + + + + + + + + + + + + + +

          Name of task.

          +
          + +
        • + + +
        • + + + - (Object) pattern + + + + + + + + + + + + + + + + +

          Glob pattern to match files.

          +
          + +
        • + + +
        • + + + - (Object) rspec_opts + + + + + + + + + + + + + + + + +

          Command line options to pass to rspec.

          +
          + +
        • + + +
        • + + + - (Object) rspec_path + + + + + + + + + + + + + + + + +

          Path to rspec.

          +
          + +
        • + + +
        • + + + - (Object) ruby_opts + + + + + + + + + + + + + + + + +

          Command line options to pass to ruby.

          +
          + +
        • + + +
        • + + + - (Object) verbose + + + + + + + + + + + + + + + + +

          Use verbose output.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (RakeTask) initialize(*args, &task_block) + + + + + +

        +
        +

        Returns a new instance of RakeTask

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 140
        +
        +def initialize(*args, &task_block)
        +  setup_ivars(args)
        +
        +  desc "Run RSpec code examples" unless ::Rake.application.last_comment
        +
        +  task name, *args do |_, task_args|
        +    RakeFileUtils.send(:verbose, verbose) do
        +      task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
        +      run_task verbose
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) fail_on_error + + + + + +

        +
        +

        Whether or not to fail Rake when an error occurs (typically when examples fail).

        + +

        default: + true

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 53
        +
        +def fail_on_error
        +  @fail_on_error
        +end
        +
        +
        + + + +
        +

        + + - (Object) failure_message + + + + + +

        +
        +

        A message to print to stderr when there are failures.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 56
        +
        +def failure_message
        +  @failure_message
        +end
        +
        +
        + + + +
        +

        + + - (Object) name + + + + + +

        +
        +

        Name of task.

        + +

        default: + :spec

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 16
        +
        +def name
        +  @name
        +end
        +
        +
        + + + +
        +

        + + - (Object) pattern + + + + + +

        +
        +

        Glob pattern to match files.

        + +

        default: + 'spec/*/_spec.rb'

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 22
        +
        +def pattern
        +  @pattern
        +end
        +
        +
        + + + +
        +

        + + - (Object) rspec_opts + + + + + +

        +
        +

        Command line options to pass to rspec.

        + +

        default: + nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +126
        +127
        +128
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 126
        +
        +def rspec_opts
        +  @rspec_opts
        +end
        +
        +
        + + + +
        +

        + + - (Object) rspec_path + + + + + +

        +
        +

        Path to rspec

        + +

        default: + 'rspec'

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 120
        +
        +def rspec_path
        +  @rspec_path
        +end
        +
        +
        + + + +
        +

        + + - (Object) ruby_opts + + + + + +

        +
        +

        Command line options to pass to ruby.

        + +

        default: + nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 114
        +
        +def ruby_opts
        +  @ruby_opts
        +end
        +
        +
        + + + +
        +

        + + - (Object) verbose + + + + + +

        +
        +

        Use verbose output. If this is set to true, the task will print the +executed spec command to stdout.

        + +

        default: + true

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 63
        +
        +def verbose
        +  @verbose
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) gemfile= + + + + + +

        +
        +
        Deprecated.
        +

        Has no effect. The rake task now checks ENV['BUNDLE_GEMFILE'] instead.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 32
        +
        +def gemfile=(*)
        +  deprecate("RSpec::Core::RakeTask#gemfile=", :replacement => 'ENV["BUNDLE_GEMFILE"]')
        +end
        +
        +
        + +
        +

        + + - (Object) rcov + + + + + +

        +
        +

        Use rcov for code coverage?

        + +

        Due to the many ways rcov can run, if this option is enabled, it is +required that require 'rspec/autorun' appears in spec_helper.rb

        + +

        default: + false

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 72
        +
        +def rcov
        +  deprecate("RSpec::Core::RakeTask#rcov")
        +  @rcov
        +end
        +
        +
        + +
        +

        + + - (Object) rcov=(true_or_false) + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +80
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 77
        +
        +def rcov=(true_or_false)
        +  deprecate("RSpec::Core::RakeTask#rcov=")
        +  @rcov = true_or_false
        +end
        +
        +
        + +
        +

        + + - (Object) rcov_opts + + + + + +

        +
        +

        Command line options to pass to rcov.

        + +

        default: + nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 100
        +
        +def rcov_opts
        +  deprecate("RSpec::Core::RakeTask#rcov_opts")
        +  @rcov_opts
        +end
        +
        +
        + +
        +

        + + - (Object) rcov_opts=(opts) + + + + + +

        + + + + +
        +
        +
        +
        +105
        +106
        +107
        +108
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 105
        +
        +def rcov_opts=(opts)
        +  deprecate("RSpec::Core::RakeTask#rcov_opts=")
        +  @rcov_opts = opts
        +end
        +
        +
        + +
        +

        + + - (Object) rcov_path + + + + + +

        +
        +

        Path to rcov.

        + +

        default: + 'rcov'

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 86
        +
        +def rcov_path
        +  deprecate("RSpec::Core::RakeTask#rcov_path")
        +  @rcov_path
        +end
        +
        +
        + +
        +

        + + - (Object) rcov_path=(path) + + + + + +

        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 91
        +
        +def rcov_path=(path)
        +  deprecate("RSpec::Core::RakeTask#rcov_path=")
        +  @rcov_path = path
        +end
        +
        +
        + +
        +

        + + - (Object) run_task(verbose) + + + + + +

        + + + + +
        +
        +
        +
        +164
        +165
        +166
        +167
        +168
        +169
        +170
        +171
        +172
        +173
        +174
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 164
        +
        +def run_task(verbose)
        +  command = spec_command
        +
        +  begin
        +    puts command if verbose
        +    success = system(command)
        +  rescue
        +    puts failure_message if failure_message
        +  end
        +  abort("#{command} failed") if fail_on_error unless success
        +end
        +
        +
        + +
        +

        + + - (Object) setup_ivars(args) + + + + + +

        + + + + +
        +
        +
        +
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 153
        +
        +def setup_ivars(args)
        +  @name = args.shift || :spec
        +  @rcov_opts, @ruby_opts, @rspec_opts = nil, nil, nil
        +  @warning, @rcov = false, false
        +  @verbose, @fail_on_error = true, true
        +
        +  @rcov_path  = 'rcov'
        +  @rspec_path = 'rspec'
        +  @pattern    = './spec{,/*/**}/*_spec.rb'
        +end
        +
        +
        + +
        +

        + + - (Object) skip_bundler= + + + + + +

        +
        +
        Deprecated.
        +

        Has no effect. The rake task now checks ENV['BUNDLE_GEMFILE'] instead.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 26
        +
        +def skip_bundler=(*)
        +  deprecate("RSpec::Core::RakeTask#skip_bundler=")
        +end
        +
        +
        + +
        +

        + + - (Object) spec_opts=(opts) + + + + + +

        +
        +
        Deprecated.
        +

        Use rspec_opts instead.

        + +

        Command line options to pass to rspec.

        + +

        default: + nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +135
        +136
        +137
        +138
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 135
        +
        +def spec_opts=(opts)
        +  deprecate('RSpec::Core::RakeTask#spec_opts=', :replacement => 'rspec_opts=')
        +  @rspec_opts = opts
        +end
        +
        +
        + +
        +

        + + - (Object) warning=(true_or_false) + + + + + +

        +
        +
        Deprecated.
        +

        Use ruby_opts="-w" instead.

        + +

        When true, requests that the specs be run with the warning flag set. +e.g. "ruby -w"

        + +

        default: + false

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +44
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 44
        +
        +def warning=(true_or_false)
        +  deprecate("RSpec::Core::RakeTask#warning=", :replacement => 'ruby_opts="-w"')
        +  @warning = true_or_false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Reporter.html b/source/documentation/2.99/rspec-core/RSpec/Core/Reporter.html new file mode 100644 index 000000000..70ee1dece --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Reporter.html @@ -0,0 +1,1244 @@ + + + + + + Class: RSpec::Core::Reporter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Reporter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/reporter.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        NOTIFICATIONS = + +
        +
        start message example_group_started example_group_finished example_started
        +example_passed example_failed example_pending start_dump dump_pending
        +dump_failures dump_summary seed close stop deprecation deprecation_summary].map { |n| n.to_sym }
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Reporter) initialize(*formatters) + + + + + +

        +
        +

        Returns a new instance of Reporter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 7
        +
        +def initialize(*formatters)
        +  @listeners = Hash.new { |h,k| h[k] = [] }
        +  formatters.each do |formatter|
        +    register_listener(formatter, *NOTIFICATIONS)
        +  end
        +  @example_count = @failure_count = @pending_count = 0
        +  @duration = @start = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) abort(seed) + + + + + +

        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +121
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 118
        +
        +def abort(seed)
        +  RSpec.deprecate "RSpec::Core::Reporter#abort", :replacement => "RSpec::Core::Reporter#finish"
        +  finish(seed)
        +end
        +
        +
        + +
        +

        + + - (Object) deprecation(message) + + + + + +

        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 100
        +
        +def deprecation(message)
        +  notify :deprecation, message
        +end
        +
        +
        + +
        +

        + + - (Object) example_failed(example) + + + + + +

        + + + + +
        +
        +
        +
        +90
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 90
        +
        +def example_failed(example)
        +  @failure_count += 1
        +  notify :example_failed, example
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_finished(group) + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 77
        +
        +def example_group_finished(group)
        +  notify :example_group_finished, group unless group.descendant_filtered_examples.empty?
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_started(group) + + + + + +

        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 73
        +
        +def example_group_started(group)
        +  notify :example_group_started, group unless group.descendant_filtered_examples.empty?
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 86
        +
        +def example_passed(example)
        +  notify :example_passed, example
        +end
        +
        +
        + +
        +

        + + - (Object) example_pending(example) + + + + + +

        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +98
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 95
        +
        +def example_pending(example)
        +  @pending_count += 1
        +  notify :example_pending, example
        +end
        +
        +
        + +
        +

        + + - (Object) example_started(example) + + + + + +

        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 81
        +
        +def example_started(example)
        +  @example_count += 1
        +  notify :example_started, example
        +end
        +
        +
        + +
        +

        + + - (Object) finish(seed) + + + + + +

        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 104
        +
        +def finish(seed)
        +  begin
        +    stop
        +    notify :start_dump
        +    notify :dump_pending
        +    notify :dump_failures
        +    notify :deprecation_summary
        +    notify :dump_summary, @duration, @example_count, @failure_count, @pending_count
        +    notify :seed, seed if seed
        +  ensure
        +    notify :close
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        + + + + +
        +
        +
        +
        +69
        +70
        +71
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 69
        +
        +def message(message)
        +  notify :message, message
        +end
        +
        +
        + +
        +

        + + - (Object) notify(event, *args, &block) + + + + + +

        + + + + +
        +
        +
        +
        +128
        +129
        +130
        +131
        +132
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 128
        +
        +def notify(event, *args, &block)
        +  registered_listeners(event).each do |formatter|
        +    formatter.send(event, *args, &block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) register_listener(listener, *notifications) + + + + + +

        +
        +

        Registers a listener to a list of notifications. The reporter will send notification of +events to all registered listeners

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + An + + + (Object) + + + + — +

          obect that wishes to be notified of reporter events

          +
          + +
        • + +
        • + + Array + + + (Array) + + + + — +

          of symbols represents the events a listener wishes to subscribe too

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 22
        +
        +def register_listener(listener, *notifications)
        +  notifications.each do |notification|
        +    @listeners[notification.to_sym] << listener if listener.respond_to?(notification)
        +  end
        +  true
        +end
        +
        +
        + +
        +

        + + - (Object) registered_listeners(notification) + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 29
        +
        +def registered_listeners(notification)
        +  @listeners[notification]
        +end
        +
        +
        + +
        +

        + + + - (Object) report(count, &block) + + - (Object) report(count, seed, &block) + + + + + + +

        +
        +

        Initializes the report run and yields itself for further reporting. The +block is required, so that the reporter can manage cleaning up after the +run.

        + +

        Warning:

        + +

        The seed argument is an internal API and is not guaranteed to be +supported in the future.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +reporter.report(group.examples.size) do |r|
        +  example_groups.map {|g| g.run(r) }
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + count + + + (Integer) + + + + — +

          the number of examples being run

          +
          + +
        • + +
        • + + seed + + + (Integer) + + + (defaults to: nil) + + + — +

          the seed used to randomize the spec run

          +
          + +
        • + +
        • + + block + + + (Block) + + + + — +

          yields itself for further reporting.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 55
        +
        +def report(expected_example_count, seed=nil)
        +  start(expected_example_count)
        +  begin
        +    yield self
        +  ensure
        +    finish(seed)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) start(expected_example_count) + + + + + +

        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 64
        +
        +def start(expected_example_count)
        +  @start = RSpec::Core::Time.now
        +  notify :start, expected_example_count
        +end
        +
        +
        + +
        +

        + + - (Object) stop + + + + + +

        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 123
        +
        +def stop
        +  @duration = (RSpec::Core::Time.now - @start).to_f if @start
        +  notify :stop
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/RubyProject.html b/source/documentation/2.99/rspec-core/RSpec/Core/RubyProject.html new file mode 100644 index 000000000..03015bfe4 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/RubyProject.html @@ -0,0 +1,438 @@ + + + + + + Module: RSpec::Core::RubyProject + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::RubyProject + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/ruby_project.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) add_dir_to_load_path(dir) + + + + + +

        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 14
        +
        +def add_dir_to_load_path(dir)
        +  $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)
        +end
        +
        +
        + +
        +

        + + + (Object) add_to_load_path(*dirs) + + + + + +

        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 10
        +
        +def add_to_load_path(*dirs)
        +  dirs.map {|dir| add_dir_to_load_path(File.join(root, dir))}
        +end
        +
        +
        + +
        +

        + + + (Object) ascend_until + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 30
        +
        +def ascend_until
        +  Pathname(File.expand_path('.')).ascend do |path|
        +    return path if yield(path)
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) determine_root + + + + + +

        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 22
        +
        +def determine_root
        +  find_first_parent_containing('spec') || '.'
        +end
        +
        +
        + +
        +

        + + + (Object) find_first_parent_containing(dir) + + + + + +

        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 26
        +
        +def find_first_parent_containing(dir)
        +  ascend_until {|path| File.exists?(File.join(path, dir))}
        +end
        +
        +
        + +
        +

        + + + (Object) root + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 18
        +
        +def root
        +  @project_root ||= determine_root
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Runner.html b/source/documentation/2.99/rspec-core/RSpec/Core/Runner.html new file mode 100644 index 000000000..b7fbd7b9c --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Runner.html @@ -0,0 +1,923 @@ + + + + + + Class: RSpec::Core::Runner + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Runner + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/runner.rb,
        + lib/rspec/core/command_line.rb
        +
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        CommandLine

        +
        + +

        Constant Summary

        + +
        + +
        AT_EXIT_HOOK_BACKTRACE_LINE = + +
        +
        "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Runner) initialize(options, configuration = RSpec::configuration, world = RSpec::world) + + + + + +

        +
        +

        Returns a new instance of Runner

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/core/command_line.rb', line 4
        +
        +def initialize(options, configuration=RSpec::configuration, world=RSpec::world)
        +  @options       = options
        +  @configuration = configuration
        +  @world         = world
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) autorun + + + + + +

        +
        +

        Register an at_exit hook that runs the suite.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/core/runner.rb', line 6
        +
        +def self.autorun
        +  return if autorun_disabled? || installed_at_exit? || running_in_drb?
        +  at_exit do
        +    # Don't bother running any specs and just let the program terminate
        +    # if we got here due to an unrescued exception (anything other than
        +    # SystemExit, which is raised when somebody calls Kernel#exit).
        +    next unless $!.nil? || $!.kind_of?(SystemExit)
        +
        +    # We got here because either the end of the program was reached or
        +    # somebody called Kernel#exit.  Run the specs and then override any
        +    # existing exit status with RSpec's exit status if any specs failed.
        +    status = run(ARGV, $stderr, $stdout).to_i
        +    exit status if status != 0
        +  end
        +  @installed_at_exit = true
        +end
        +
        +
        + +
        +

        + + + (Boolean) autorun_disabled? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/runner.rb', line 28
        +
        +def self.autorun_disabled?
        +  @autorun_disabled ||= false
        +end
        +
        +
        + +
        +

        + + + (Object) disable_autorun! + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/runner.rb', line 24
        +
        +def self.disable_autorun!
        +  @autorun_disabled = true
        +end
        +
        +
        + +
        +

        + + + (Boolean) installed_at_exit? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/runner.rb', line 32
        +
        +def self.installed_at_exit?
        +  @installed_at_exit ||= false
        +end
        +
        +
        + +
        +

        + + + (Object) run(args, err = $stderr, out = $stdout) + + + + + +

        +
        +

        Run a suite of RSpec examples.

        + +

        This is used internally by RSpec to run a suite, but is available +for use by any other automation tool.

        + +

        If you want to run this multiple times in the same process, and you +want files like spec_helper.rb to be reloaded, be sure to load load +instead of require.

        + +

        Parameters

        + +
          +
        • +args+ - an array of command-line-supported arguments
        • +
        • +err+ - error stream (Default: $stderr)
        • +
        • +out+ - output stream (Default: $stdout)
        • +
        + +

        Returns

        + +
          +
        • +Fixnum+ - exit status code (0/1)
        • +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +
        +
        # File 'lib/rspec/core/runner.rb', line 78
        +
        +def self.run(args, err=$stderr, out=$stdout)
        +  warn_about_calling_reset if RSpec.resets_required > 0
        +  RSpec.resets_required += 1
        +  trap_interrupt
        +  options = ConfigurationOptions.new(args)
        +  options.parse_options
        +
        +  major, minor, point = RUBY_VERSION.split('.').map { |v| v.to_i }
        +
        +  if major == 1 && ( (minor == 9 && point < 2) || (minor == 8 && point < 7) )
        +    RSpec.deprecate "RSpec support for Ruby #{RUBY_VERSION}",
        +                    :replacement => "1.8.7 or >= 1.9.2",
        +                    :call_site   => nil
        +  end
        +
        +
        +  if options.options[:drb]
        +    require 'rspec/core/drb_command_line'
        +    begin
        +      DRbCommandLine.new(options).run(err, out)
        +    rescue DRb::DRbConnError
        +      err.puts "No DRb server is running. Running in local process instead ..."
        +      new(options).run(err, out)
        +    end
        +  else
        +    new(options).run(err, out)
        +  end
        +ensure
        +  RSpec.internal_reset
        +end
        +
        +
        + +
        +

        + + + (Boolean) running_in_drb? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/core/runner.rb', line 36
        +
        +def self.running_in_drb?
        +  defined?(DRb) &&
        +  (DRb.current_server rescue false) &&
        +   DRb.current_server.uri =~ /druby\:\/\/127.0.0.1\:/
        +end
        +
        +
        + +
        +

        + + + (Object) trap_interrupt + + + + + +

        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/runner.rb', line 42
        +
        +def self.trap_interrupt
        +  trap('INT') do
        +    exit!(1) if RSpec.wants_to_quit
        +    RSpec.wants_to_quit = true
        +    STDERR.puts "\nExiting... Interrupt again to exit immediately."
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) run(err, out) + + + + + +

        +
        +

        Configures and runs a suite

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + err + + + (IO) + + + +
        • + +
        • + + out + + + (IO) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/core/command_line.rb', line 14
        +
        +def run(err, out)
        +  @configuration.error_stream = err
        +  @configuration.output_stream = out if @configuration.output_stream == $stdout
        +  @options.configure(@configuration)
        +  @configuration.load_spec_files
        +  @world.announce_filters
        +
        +  @configuration.reporter.report(@world.example_count, @configuration.send(:_randomize?) ? @configuration.seed : nil) do |reporter|
        +    begin
        +      @configuration.run_hook(:before, :suite)
        +      @world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
        +    ensure
        +      @configuration.run_hook(:after, :suite)
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/SharedContext.html b/source/documentation/2.99/rspec-core/RSpec/Core/SharedContext.html new file mode 100644 index 000000000..b17d71733 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/SharedContext.html @@ -0,0 +1,388 @@ + + + + + + Module: RSpec::Core::SharedContext + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedContext + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_context.rb
        + +
        +
        + +

        Overview

        +
        +

        Exposes ExampleGroup-level methods to a module, so you can include that +module in an ExampleGroup.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module LoggedInAsAdmin
        +  extend RSpec::Core::SharedContext
        +  before(:each) do
        +     :admin
        +  end
        +end
        +
        +describe "admin section" do
        +  include LoggedInAsAdmin
        +  # ...
        +end
        + +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: Recording + + +

        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) record(methods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 39
        +
        +def self.record(methods)
        +  methods.each do |meth|
        +    class_eval <<-EOS, __FILE__, __LINE__ + 1
        +      def #{meth}(*args, &block)
        +        __shared_context_recordings << Recording.new(:#{meth}, args, block)
        +      end
        +    EOS
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) __shared_context_recordings + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 28
        +
        +def __shared_context_recordings
        +  @__shared_context_recordings ||= []
        +end
        +
        +
        + +
        +

        + + - (Object) included(group) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 21
        +
        +def included(group)
        +  __shared_context_recordings.each do |recording|
        +    recording.playback_onto(group)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/SharedContext/Recording.html b/source/documentation/2.99/rspec-core/RSpec/Core/SharedContext/Recording.html new file mode 100644 index 000000000..ee3bf36d1 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/SharedContext/Recording.html @@ -0,0 +1,388 @@ + + + + + + Class: RSpec::Core::SharedContext::Recording + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::SharedContext::Recording + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_context.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) args + + + + + + + + + + + + + + + + +

          Returns the value of attribute args.

          +
          + +
        • + + +
        • + + + - (Object) block + + + + + + + + + + + + + + + + +

          Returns the value of attribute block.

          +
          + +
        • + + +
        • + + + - (Object) method_name + + + + + + + + + + + + + + + + +

          Returns the value of attribute method_name.

          +
          + +
        • + + +
        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) args + + + + + +

        +
        +

        Returns the value of attribute args

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of args

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 32
        +
        +def args
        +  @args
        +end
        +
        +
        + + + +
        +

        + + - (Object) block + + + + + +

        +
        +

        Returns the value of attribute block

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of block

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 32
        +
        +def block
        +  @block
        +end
        +
        +
        + + + +
        +

        + + - (Object) method_name + + + + + +

        +
        +

        Returns the value of attribute method_name

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of method_name

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 32
        +
        +def method_name
        +  @method_name
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup.html b/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup.html new file mode 100644 index 000000000..33c14f313 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup.html @@ -0,0 +1,518 @@ + + + + + + Module: RSpec::Core::SharedExampleGroup + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedExampleGroup + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup, ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group.rb,
        + lib/rspec/core/shared_example_group/collection.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: TopLevelDSL + + + + Classes: Collection + + +

        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) registry + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 77
        +
        +def self.registry
        +  @registry ||= Registry.new
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) share_as(name, &block) + + + + + +

        +
        +
        Deprecated.
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +44
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 44
        +
        +def share_as(name, &block)
        +  RSpec.deprecate("Rspec::Core::SharedExampleGroup#share_as",
        +                  :replacement => "RSpec::SharedContext or shared_examples")
        +  SharedExampleGroup.registry.add_const(self, name, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) share_examples_for(*args, &block) + + + + + +

        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 38
        +
        +def share_examples_for(*args, &block)
        +  RSpec.deprecate("`share_examples_for`", :replacement => "`shared_examples` or `shared_examples_for`")
        +  shared_examples(*args, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) shared_example_groups + + + + + +

        + + + + +
        +
        +
        +
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 50
        +
        +def shared_example_groups
        +  SharedExampleGroup.registry.shared_example_groups_for('main', *ancestors[0..-1])
        +end
        +
        +
        + +
        +

        + + + - (Object) shared_examples(name, &block) + + - (Object) shared_examples(name, tags, &block) + + + + + Also known as: + shared_context, shared_examples_for + + + + +

        +
        +

        Wraps the block in a module which can then be included in example +groups using include_examples, include_context, or +it_behaves_like.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +shared_examples "auditable" do
        +  it "stores an audit record on save!" do
        +    lambda { auditable.save! }.should change(Audit, :count).by(1)
        +  end
        +end
        +
        +class Account do
        +  it_behaves_like "auditable" do
        +    def auditable; Account.new; end
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + + — +

          to match when looking up this shared group

          +
          + +
        • + +
        • + + block + + + + + + + — +

          to be eval'd in a nested example group generated by it_behaves_like

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 31
        +
        +def shared_examples(*args, &block)
        +  SharedExampleGroup.registry.add_group(self, *args, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup/Collection.html b/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup/Collection.html new file mode 100644 index 000000000..90b86fd01 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup/Collection.html @@ -0,0 +1,258 @@ + + + + + + Class: RSpec::Core::SharedExampleGroup::Collection + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::SharedExampleGroup::Collection + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group/collection.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Collection) initialize(sources, examples) + + + + + +

        +
        +

        Returns a new instance of Collection

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/core/shared_example_group/collection.rb', line 6
        +
        +def initialize(sources, examples)
        +  @sources, @examples = sources, examples
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) [](key) + + + + + +

        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/shared_example_group/collection.rb', line 10
        +
        +def [](key)
        +  fetch_examples(key) || warn_deprecation_and_fetch_anyway(key)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html b/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html new file mode 100644 index 000000000..d6e968ddd --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html @@ -0,0 +1,340 @@ + + + + + + Module: RSpec::Core::SharedExampleGroup::TopLevelDSL + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedExampleGroup::TopLevelDSL + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) share_as(name, &block) + + + + + +

        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 67
        +
        +def share_as(name, &block)
        +  RSpec.deprecate("`share_as`", :replacement => "`RSpec::SharedContext` or `shared_examples`")
        +  SharedExampleGroup.registry.add_const('main', name, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) share_examples_for(*args, &block) + + + + + +

        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 62
        +
        +def share_examples_for(*args, &block)
        +  RSpec.deprecate("`share_examples_for`", :replacement => "`shared_examples` or `shared_examples_for`")
        +  shared_examples(*args, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) shared_example_groups + + + + + +

        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 72
        +
        +def shared_example_groups
        +  SharedExampleGroup.registry.shared_example_groups_for('main')
        +end
        +
        +
        + +
        +

        + + - (Object) shared_examples(*args, &block) + + + + Also known as: + shared_context, shared_examples_for + + + + +

        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 55
        +
        +def shared_examples(*args, &block)
        +  SharedExampleGroup.registry.add_group('main', *args, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/Version.html b/source/documentation/2.99/rspec-core/RSpec/Core/Version.html new file mode 100644 index 000000000..0e907953d --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/Version.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Core::Version + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Version + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/version.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        STRING = + +
        +
        '2.99.2'
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Core/World.html b/source/documentation/2.99/rspec-core/RSpec/Core/World.html new file mode 100644 index 000000000..a1ef43808 --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Core/World.html @@ -0,0 +1,1232 @@ + + + + + + Class: RSpec::Core::World + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::World + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Hooks
        + + + + + +
        Defined in:
        +
        lib/rspec/core/world.rb
        + +
        +
        + + +

        Constant Summary

        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) example_groups + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute example_groups.

          +
          + +
        • + + +
        • + + + - (Object) filtered_examples + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute filtered_examples.

          +
          + +
        • + + +
        • + + + - (Object) wants_to_quit + + + + + + + + + + + + + + + + +

          Returns the value of attribute wants_to_quit.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Hooks

        +

        #after, #append_after, #around, #before, #prepend_before

        + + + + + + + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (World) initialize(configuration = RSpec.configuration) + + + + + +

        +
        +

        Returns a new instance of World

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/core/world.rb', line 10
        +
        +def initialize(configuration=RSpec.configuration)
        +  @configuration = configuration
        +  @example_groups = [].extend(Extensions::Ordered::ExampleGroups)
        +  @filtered_examples = Hash.new { |hash,group|
        +    hash[group] = begin
        +      examples = group.examples.dup
        +      examples = filter_manager.prune(examples)
        +      examples.uniq
        +      examples.extend(Extensions::Ordered::Examples)
        +    end
        +  }
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) example_groups (readonly) + + + + + +

        +
        +

        Returns the value of attribute example_groups

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/world.rb', line 7
        +
        +def example_groups
        +  @example_groups
        +end
        +
        +
        + + + +
        +

        + + - (Object) filtered_examples (readonly) + + + + + +

        +
        +

        Returns the value of attribute filtered_examples

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/world.rb', line 7
        +
        +def filtered_examples
        +  @filtered_examples
        +end
        +
        +
        + + + +
        +

        + + - (Object) wants_to_quit + + + + + +

        +
        +

        Returns the value of attribute wants_to_quit

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/world.rb', line 8
        +
        +def wants_to_quit
        +  @wants_to_quit
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) announce_exclusion_filter(announcements) + + + + + +

        + + + + +
        +
        +
        +
        +111
        +112
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/core/world.rb', line 111
        +
        +def announce_exclusion_filter(announcements)
        +  unless exclusion_filter.rules_empty?
        +    announcements << "exclude #{exclusion_filter.description}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) announce_filters + + + + + +

        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/core/world.rb', line 65
        +
        +def announce_filters
        +  filter_announcements = []
        +
        +  announce_inclusion_filter filter_announcements
        +  announce_exclusion_filter filter_announcements
        +
        +  unless filter_manager.empty?
        +    if filter_announcements.length == 1
        +      reporter.message("Run options: #{filter_announcements[0]}")
        +    else
        +      reporter.message("Run options:\n  #{filter_announcements.join("\n  ")}")
        +    end
        +  end
        +
        +  if @configuration.run_all_when_everything_filtered? && example_count.zero?
        +    reporter.message("#{everything_filtered_message}; ignoring #{inclusion_filter.description}")
        +    filtered_examples.clear
        +    inclusion_filter.clear
        +  end
        +
        +  if example_count.zero?
        +    example_groups.clear
        +    if filter_manager.empty?
        +      reporter.message("No examples found.")
        +    elsif exclusion_filter.rules_empty?
        +      message = everything_filtered_message
        +      if @configuration.run_all_when_everything_filtered?
        +        message << "; ignoring #{inclusion_filter.description}"
        +      end
        +      reporter.message(message)
        +    elsif inclusion_filter.empty?
        +      reporter.message(everything_filtered_message)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) announce_inclusion_filter(announcements) + + + + + +

        + + + + +
        +
        +
        +
        +105
        +106
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/core/world.rb', line 105
        +
        +def announce_inclusion_filter(announcements)
        +  unless inclusion_filter.empty?
        +    announcements << "include #{inclusion_filter.description}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) configure_group(group) + + + + + +

        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/core/world.rb', line 45
        +
        +def configure_group(group)
        +  @configuration.configure_group(group)
        +end
        +
        +
        + +
        +

        + + - (Object) everything_filtered_message + + + + + +

        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/core/world.rb', line 101
        +
        +def everything_filtered_message
        +  "\nAll examples were filtered out"
        +end
        +
        +
        + +
        +

        + + - (Object) example_count + + + + + +

        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/core/world.rb', line 49
        +
        +def example_count
        +  example_groups.collect {|g| g.descendants}.flatten.inject(0) do |sum, g|
        +    sum += g.filtered_examples.size
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) exclusion_filter + + + + + +

        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/core/world.rb', line 41
        +
        +def exclusion_filter
        +  @configuration.exclusion_filter
        +end
        +
        +
        + +
        +

        + + - (Object) filter_manager + + + + + +

        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/world.rb', line 28
        +
        +def filter_manager
        +  @configuration.filter_manager
        +end
        +
        +
        + +
        +

        + + - (Object) inclusion_filter + + + + + +

        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/core/world.rb', line 37
        +
        +def inclusion_filter
        +  @configuration.inclusion_filter
        +end
        +
        +
        + +
        +

        + + - (Object) preceding_declaration_line(filter_line) + + + + + +

        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/core/world.rb', line 55
        +
        +def preceding_declaration_line(filter_line)
        +  declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
        +    line <= filter_line ? line : highest_prior_declaration_line
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) register(example_group) + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/core/world.rb', line 32
        +
        +def register(example_group)
        +  example_groups << example_group
        +  example_group
        +end
        +
        +
        + +
        +

        + + - (Object) reporter + + + + + +

        + + + + +
        +
        +
        +
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/core/world.rb', line 61
        +
        +def reporter
        +  @configuration.reporter
        +end
        +
        +
        + +
        +

        + + - (Object) reset + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/world.rb', line 23
        +
        +def reset
        +  example_groups.clear
        +  SharedExampleGroup.registry.clear
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/RSpec/Runner.html b/source/documentation/2.99/rspec-core/RSpec/Runner.html new file mode 100644 index 000000000..6e683838c --- /dev/null +++ b/source/documentation/2.99/rspec-core/RSpec/Runner.html @@ -0,0 +1,188 @@ + + + + + + Module: RSpec::Runner + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Runner + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/backward_compatibility.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) configure(&block) + + + + + +

        +
        +
        Deprecated.

        use RSpec.configure instead.

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/core/backward_compatibility.rb', line 26
        +
        +def self.configure(&block)
        +  RSpec.deprecate("Spec::Runner.configure", :replacement => "RSpec.configure")
        +  RSpec.configure(&block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/_index.html b/source/documentation/2.99/rspec-core/_index.html new file mode 100644 index 000000000..a83130f33 --- /dev/null +++ b/source/documentation/2.99/rspec-core/_index.html @@ -0,0 +1,790 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.6

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + + + + + + + + + + + + + + + + +
          +
        • F
        • + +
        + + + + + +
        + + + + + +
          +
        • I
        • +
            + +
          • + ImmediatePrinter + + (RSpec::Core::Formatters::DeprecationFormatter) + +
          • + +
          +
        + + +
          +
        • J
        • + +
        + + +
          +
        • K
        • + +
        + + +
          +
        • L
        • +
            + +
          • + Loader + + (RSpec::Core::Formatters) + +
          • + +
          +
        + + + + + +
          +
        • N
        • +
            + +
          • + NullConverter + + (RSpec::Core::Formatters::SnippetExtractor) + +
          • + +
          +
        + + + + + +
        + + + + + + + + + + + +
          +
        • V
        • +
            + +
          • + Version + + (RSpec::Core) + +
          • + +
          +
        + + +
          +
        • W
        • +
            + +
          • + World + + (RSpec::Core) + +
          • + +
          +
        + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/class_list.html b/source/documentation/2.99/rspec-core/class_list.html new file mode 100644 index 000000000..1fd752f31 --- /dev/null +++ b/source/documentation/2.99/rspec-core/class_list.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-core/file.Changelog.html b/source/documentation/2.99/rspec-core/file.Changelog.html new file mode 100644 index 000000000..7d57405ef --- /dev/null +++ b/source/documentation/2.99/rspec-core/file.Changelog.html @@ -0,0 +1,1445 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        2.99.2 / 2014-08-19

        + +

        Full Changelog

        + +

        Enhancements:

        + +
          +
        • Improve deprecation warning for RSpec 3 change in describe <a symbol> +behavior. (Jon Rowe, #1667)
        • +
        + +

        2.99.1 / 2014-06-19

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Add missing deprecation warning for when RSpec::Core::Runner is used +multiple times in the same process. In 2.x RSpec's global state was +automatically cleared between runs but in 3.0 you need to call RSpec.reset +manually in these situations. (Sam Phippen, #1587)
        • +
        • Prevent deprecation being accidentally issues when doubles used with be_ +matchers due to automatically generated descriptions. (Jon Rowe, #1573)
        • +
        • Load rspec/core when loading rspec/core/rake_task to ensure we can +issue deprecations correctly. (Jon Rowe, #1612)
        • +
        + +

        2.99.0 / 2014-06-01

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix BaseTextFormatter so that it does not re-close a closed output +stream. (Myron Marston)
        • +
        • Use RSpec::Configuration#backtrace_exclusion_patterns rather than the +deprecated RSpec::Configuration#backtrace_clean_patterns when mocking +with rr. (David Dollar)
        • +
        + +

        2.99.0.rc1 / 2014-05-18

        + +

        Full Changelog

        + +

        Enhancements:

        + +
          +
        • Add --deprecation-out CLI option which directs deprecation warnings +to the named file. (Myron Marston)
        • +
        • Backport support for skip in metadata to skip execution of an example. +(Xavier Shay, #1472)
        • +
        • Add Pathname support for setting all output streams. (Aaron Kromer)
        • +
        • Add test_unit and minitest expectation frameworks. (Aaron Kromer)
        • +
        + +

        Deprecations:

        + +
          +
        • Deprecate RSpec::Core::Pending::PendingDeclaredInExample, use +SkipDeclaredInExample instead. (Xavier Shay)
        • +
        • Issue a deprecation when described_class is accessed from within +a nested describe <SomeClass> example group, since described_class +will return the innermost described class in RSpec 3 rather than the +outermost described class, as it behaved in RSpec 2. (Myron Marston)
        • +
        • Deprecate RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS, +RSpec::Core::FilterManager::STANDALONE_FILTERS and use of +#empty_without_conditional_filters? on those filters. (Sergey Pchelincev)
        • +
        • Deprecate RSpec::Core::Example#options in favor of +RSpec::Core::Example#metadata. (Myron Marston)
        • +
        • Issue warning when passing a symbol or hash to describe or context +as the first argument. In RSpec 2.x this would be treated as metadata +but in RSpec 3 it'll be treated as the described object. To continue +having it treated as metadata, pass a description before the symbol or +hash. (Myron Marston)
        • +
        • Deprecate RSpec::Core::BaseTextFormatter::VT100_COLORS and +RSpec::Core::BaseTextFormatter::VT100_COLOR_CODES in favour +of RSpec::Core::BaseTextFormatter::ConsoleCodes::VT100_CODES and +RSpec::Core::BaseTextFormatter::ConsoleCodes::VT100_CODE_VALUES. +(Jon Rowe)
        • +
        • Deprecate RSpec::Core::ExampleGroup.display_name in favor of +RSpec::Core::ExampleGroup.description. (Myron Marston)
        • +
        • Deprecate RSpec::Core::ExampleGroup.describes in favor of +RSpec::Core::ExampleGroup.described_class. (Myron Marston)
        • +
        • Deprecate RSpec::Core::ExampleGroup.alias_example_to in favor of +RSpec::Core::Configuration#alias_example_to. (Myron Marston)
        • +
        • Deprecate RSpec::Core::ExampleGroup.alias_it_behaves_like_to in favor +of RSpec::Core::Configuration#alias_it_behaves_like_to. (Myron Marston)
        • +
        • Deprecate RSpec::Core::ExampleGroup.focused in favor of +RSpec::Core::ExampleGroup.focus. (Myron Marston)
        • +
        • Add deprecation warning for config.filter_run :focused since +example aliases fit and focus will no longer include +:focused metadata but will continue to include :focus. (Myron Marston)
        • +
        • Deprecate filtering by :line_number (e.g. --line-number from the +CLI). Use location filtering instead. (Myron Marston)
        • +
        • Deprecate --default_path as an alternative to --default-path. (Jon Rowe)
        • +
        • Deprecate RSpec::Core::Configuration#warnings in favor of +RSpec::Core::Configuration#warnings?. (Myron Marston)
        • +
        • Deprecate share_examples_for in favor of shared_examples_for or +just shared_examples. (Myron Marston)
        • +
        • Deprecate RSpec::Core::CommandLine in favor of +RSpec::Core::Runner. (Myron Marston)
        • +
        • Deprecate #color_enabled, #color_enabled= and #color? in favour of +#color, #color= and #color_enabled? output. (Jon Rowe)
        • +
        • Deprecate #filename_pattern in favour of #pattern. (Jon Rowe)
        • +
        • Deprecate #backtrace_cleaner in favour of #backtrace_formatter. (Jon Rowe)
        • +
        • Deprecate mutating RSpec::Configuration#formatters. (Jon Rowe)
        • +
        • Deprecate stdlib as an available expectation framework in favour of +test_unit and minitest. (Aaron Kromer)
        • +
        + +

        Bug Fixes:

        + +
          +
        • Issue a warning when you set config.deprecation_stream too late for +it to take effect because the reporter has already been setup. (Myron Marston)
        • +
        • skip with a block should not execute the block. (Xavier Shay)
        • +
        + +

        2.99.0.beta2 / 2014-02-17

        + +

        Full Changelog

        + +

        Enhancements:

        + +
          +
        • Add is_expected for one-liners that read well with the +expect-based syntax. is_expected is simply defined as +expect(subject) and can be used in an expression like: +it { is_expected.to read_well }. (Myron Marston)
        • +
        • Backport skip from RSpec 3, which acts like pending did in RSpec 2 +when not given a block, since the behavior of pending is changing in +RSpec 3. (Xavier Shay)
        • +
        + +

        Deprecations:

        + +
          +
        • Deprecate inexact mock_with config options. RSpec 3 will only support +the exact symbols :rspec, :mocha, :flexmock, :rr or :nothing +(or any module that implements the adapter interface). RSpec 2 did +fuzzy matching but this will not be supported going forward. +(Myron Marston)
        • +
        • Deprecate show_failures_in_pending_blocks config option. To achieve +the same behavior as the option enabled, you can use a custom +formatter instead. (Xavier Shay)
        • +
        • Add a deprecation warning for the fact that the behavior of pending +is changing in RSpec 3 -- rather than skipping the example (as it did +in 2.x when no block was provided), it will run the example and mark +it as failed if no exception is raised. Use skip instead to preserve +the old behavior. (Xavier Shay)
        • +
        • Deprecate 's', 'n', 'spec' and 'nested' as aliases for documentation +formatter. (Jon Rowe)
        • +
        • Deprecate RSpec::Core::Reporter#abort in favor of +RSpec::Core::Reporter#finish. (Jon Rowe)
        • +
        + +

        Bug Fixes:

        + +
          +
        • Fix failure (undefined method path) in end-of-run summary +when raise_errors_for_deprecations! is configured. (Myron Marston)
        • +
        • Fix issue were overridding spec ordering from the command line wasnt +fully recognised interally. (Jon Rowe)
        • +
        + +

        2.99.0.beta1 / 2013-11-07

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Block-based DSL methods that run in the context of an example +(it, before(:each), after(:each), let and subject) +now yield the example as a block argument. (David Chelimsky)
        • +
        • Warn when the name of more than one example group is submitted to +include_examples and it's aliases. (David Chelimsky)
        • +
        • Add expose_current_running_example_as config option for +use during the upgrade process when external gems use the +deprecated RSpec::Core::ExampleGroup#example and +RSpec::Core::ExampleGroup#running_example methods. (Myron Marston)
        • +
        • Limit spamminess of deprecation messages. (Bradley Schaefer, Loren Segal)
        • +
        • Add config.raise_errors_for_deprecations! option, which turns +deprecations warnings into errors to surface the full backtrace +of the call site. (Myron Marston)
        • +
        + +

        Deprecations

        + +
          +
        • Deprecate RSpec::Core::ExampleGroup#example and +RSpec::Core::ExampleGroup#running_example methods. If you need +access to the example (e.g. to get its metadata), use a block argument +instead. (David Chelimsky)
        • +
        • Deprecate use of autotest/rspec2 in favour of rspec-autotest. (Jon Rowe)
        • +
        • Deprecate RSpec's built-in debugger support. Use a CLI option like +-rruby-debug (for the ruby-debug gem) or -rdebugger (for the +debugger gem) instead. (Myron Marston)
        • +
        • Deprecate RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values = false. +RSpec 3 will not support having this option set to false. (Myron Marston)
        • +
        • Deprecate accessing a let or subject declaration in +a after(:all) hook. (Myron Marston, Jon Rowe)
        • +
        • Deprecate built-in its usage in favor of rspec-its gem due to planned +removal in RSpec 3. (Peter Alfvin)
        • +
        • Deprecate RSpec::Core::PendingExampleFixedError in favor of +RSpec::Core::Pending::PendingExampleFixedError. (Myron Marston)
        • +
        • Deprecate RSpec::Core::Configuration#out and +RSpec::Core::Configuration#output in favor of +RSpec::Core::Configuration#output_stream. (Myron Marston)
        • +
        • Deprecate legacy ordering APIs. + +
            +
          • You should use register_ordering(:global) instead of these:
          • +
          • RSpec::Core::Configuration#order_examples
          • +
          • RSpec::Core::Configuration#order_groups
          • +
          • RSpec::Core::Configuration#order_groups_and_examples
          • +
          • These are deprecated with no replacement because in RSpec 3 +ordering is a property of individual example groups rather than +just a global property of the entire test suite:
          • +
          • RSpec::Core::Configuration#order
          • +
          • RSpec::Core::Configuration#randomize?
          • +
          • --order default is deprecated in favor of --order defined +(Myron Marston)
          • +
        • +
        + +

        2.14.8 / 2014-02-27

        + +

        Full Changelog

        + +

        Bug fixes:

        + +
          +
        • Fix regression with the textmateformatter that prevented backtrace links +from being clickable. (Stefan Daschek)
        • +
        + +

        2.14.7 / 2013-10-29

        + +

        Full Changelog

        + +

        Bug fixes:

        + +
          +
        • Fix regression in 2.14.6 that broke the Fivemat formatter. +It depended upon either +example.execution_result[:exception].pending_fixed? (which +was removed in 2.14.6 to fix an issue with frozen error objects) +or RSpec::Core::PendingExampleFixedError (which was renamed +to RSpec::Core::Pending::PendingExampleFixedError in 2.8. +This fix makes a constant alias for the old error name. +(Myron Marston)
        • +
        + +

        2.14.6 / 2013-10-15

        + +

        Full Changelog

        + +

        Bug fixes:

        + +
          +
        • Format stringified numbers correctly when mathn library is loaded. +(Jay Hayes)
        • +
        • Fix an issue that prevented the use of frozen error objects. (Lars +Gierth)
        • +
        + +

        2.14.5 / 2013-08-13

        + +

        Full Changelog

        + +

        Bug fixes:

        + +
          +
        • Fix a NoMethodError that was being raised when there were no shared +examples or contexts declared and RSpec.world.reset is invoked. +(thepoho, Jon Rowe, Myron Marston)
        • +
        • Fix a deprecation warning that was being incorrectly displayed when +shared_examples are declared at top level in a module scope. +(Jon Rowe)
        • +
        • Fix after(:all) hooks so consecutive (same context) scopes will run even if +one raises an error. (Jon Rowe, Trejkaz)
        • +
        • JsonFormatter no longer dies if dump_profile isn't defined (Alex / @MasterLambaster, Jon Rowe)
        • +
        + +

        2.14.4 / 2013-07-21

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix regression in 2.14: ensure configured requires (via -r option) +are loaded before spec files are loaded. This allows the spec files +to programatically change the file pattern (Jon Rowe).
        • +
        • Autoload RSpec::Mocks and RSpec::Expectations when referenced if +they are not already loaded (RSpec::Matches has been autoloaded +for a while). In the rspec gem, we changed it recently to stop +loading rspec/mocks and rspec/expectations by default, as some +users reported problems where they were intending to use mocha, +not rspec-mocks, but rspec-mocks was loaded and causing a conflict. +rspec-core loads mocks and expectations at the appropriate time, so +it seemed like a safe change -- but caused a problem for some authors +of libraries that integrate with RSpec. This fixes that problem. +(Myron Marston)
        • +
        • Gracefully handle a command like rspec --profile path/to/spec.rb: +the path/to/spec.rb arg was being wrongly treated as the profile +integer arg, which got cast 0 using to_i, causing no profiled +examples to be printed. (Jon Rowe)
        • +
        + +

        2.14.3 / 2013-07-13

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix deprecation notices issued from RSpec::Core::RakeTask so +that they work properly when all of rspec-core is not loaded. +(This was a regression in 2.14) (Jon Rowe)
        • +
        + +

        2.14.2 / 2013-07-09

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix regression caused by 2.14.1 release: formatters that +report that they respond_to? a notification, but had +no corresponding method would raise an error when registered. +The new fix is to just implement start on the deprecation +formatter to fix the original JRuby/ruby-debug issue. +(Jon Rowe)
        • +
        + +

        2.14.1 / 2013-07-08

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Address deprecation formatter failure when using ruby-debug on +JRuby: fix RSpec::Core::Reporter to not send a notification +when the formatter's implementation of the notification method +comes from Kernel (Alex Portnov, Jon Rowe).
        • +
        + +

        2.14.0 / 2013-07-06

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Apply focus to examples defined with fit (equivalent of +it "description", focus: true) (Michael de Silva)
        • +
        + +

        Bug fix

        + +
          +
        • Ensure methods defined by let take precedence over others +when there is a name collision (e.g. from an included module). +(Jon Rowe, Andy Lindeman and Myron Marston)
        • +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Improved Windows detection inside Git Bash, for better --color handling.
        • +
        • Add profiling of the slowest example groups to --profile option. +The output is sorted by the slowest average example groups.
        • +
        • Don't show slow examples if there's a failure and both --fail-fast +and --profile options are used (Paweł Gościcki).
        • +
        • Rather than always adding spec to the load path, add the configured +--default-path to the load path (which defaults to spec). This +better supports folks who choose to put their specs in a different +directory (John Feminella).
        • +
        • Add some logic to test time duration precision. Make it a +function of time, dropping precision as the time increases. (Aaron Kromer)
        • +
        • Add new backtrace_inclusion_patterns config option. Backtrace lines +that match one of these patterns will always be included in the +backtrace, even if they match an exclusion pattern, too (Sam Phippen).
        • +
        • Support ERB trim mode using the - when parsing .rspec as ERB +(Gabor Garami).
        • +
        • Give a better error message when let and subject are called without a block. +(Sam Phippen).
        • +
        • List the precedence of .rspec-local in the configuration documentation +(Sam Phippen)
        • +
        • Support {a,b} shell expansion syntax in --pattern option +(Konstantin Haase).
        • +
        • Add cucumber documentation for --require command line option +(Bradley Schaefer)
        • +
        • Expose configuration options via config: + +
            +
          • config.libs returns the libs configured to be added onto the load path
          • +
          • full_backtrace? returns the state of the backtrace cleaner
          • +
          • debug? returns true when the debugger is loaded
          • +
          • line_numbers returns the line numbers we are filtering by (if any)
          • +
          • full_description returns the RegExp used to filter descriptions +(Jon Rowe)
          • +
        • +
        • Add setters for RSpec.world and RSpec.configuration (Alex Soulim)
        • +
        • Configure ruby's warning behaviour with --warnings (Jon Rowe)
        • +
        • Fix an obscure issue on old versions of 1.8.7 where Time.dup wouldn't +allow access to Time.now (Jon Rowe)
        • +
        • Make shared_examples_for context aware, so that keys may be safely reused +in multiple contexts without colliding. (Jon Rowe)
        • +
        • Add a configurable deprecation_stream (Jon Rowe)
        • +
        • Publish deprecations through a formatter (David Chelimsky)
        • +
        + +

        Bug fixes

        + +
          +
        • Make JSON formatter behave the same when it comes to --profile as +the text formatter (Paweł Gościcki).
        • +
        • Fix named subjects so that if an inner group defines a method that +overrides the named method, subject still retains the originally +declared value (Myron Marston).
        • +
        • Fix random ordering so that it does not cause rand in examples in +nested sibling contexts to return the same value (Max Shytikov).
        • +
        • Use the new backtrace_inclusion_patterns config option to ensure +that folks who develop code in a directory matching one of the default +exclusion patterns (e.g. gems) still get the normal backtrace +filtering (Sam Phippen).
        • +
        • Fix ordering of before hooks so that before hooks declared in +RSpec.configure run before before hooks declared in a shared +context (Michi Huber and Tejas Dinkar).
        • +
        • Fix Example#full_description so that it gets filled in by the last +matcher description (as Example#description already did) when no +doc string has been provided (David Chelimsky).
        • +
        • Fix the memoized methods (let and subject) leaking define_method +as a public method. (Thomas Holmes and Jon Rowe) (#873)
        • +
        • Fix warnings coming from the test suite. (Pete Higgins)
        • +
        + +

        Deprecations

        + +
          +
        • Deprecate Configuration#backtrace_clean_patterns in favor of +Configuration#backtrace_exclusion_patterns for greater consistency +and symmetry with new backtrace_inclusion_patterns config option +(Sam Phippen).
        • +
        • Deprecate Configuration#requires= in favor of using ruby's +require. Requires specified by the command line can still be +accessed by the Configuration#require reader. (Bradley Schaefer)
        • +
        • Deprecate calling SharedExampleGroups defined across sibling contexts +(Jon Rowe)
        • +
        + +

        2.13.1 / 2013-03-12

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Use hook classes as proxies rather than extending hook blocks to support +lambdas for before/after/around hooks. (David Chelimsky)
        • +
        • Fix regression in 2.13.0 that caused confusing behavior when overriding +a named subject with an unnamed subject in an inner group and then +referencing the outer group subject's name. The fix for this required +us to disallow using super in a named subject (which is confusing, +anyway -- named subjects create 2 methods, so which method on the +parent example group are you supering to?) but super in an unnamed +subject continues to work (Myron Marston).
        • +
        • Do not allow a referenced let or subject in before(:all) to cause +other let declarations to leak across examples (Myron Marston).
        • +
        • Work around odd ruby 1.9 bug with String#match that was triggered +by passing it a regex from a let declaration. For more info, see +http://bugs.ruby-lang.org/issues/8059 (Aaron Kromer).
        • +
        • Add missing require 'set' to base_text_formatter.rb (Tom +Anderson).
        • +
        + +

        Deprecations

        + +
          +
        • Deprecate accessing let or subject declarations in before(:all). +These were not intended to be called in a before(:all) hook, as +they exist to define state that is reset between each example, while +before(:all) exists to define state that is shared across examples +in an example group (Myron Marston).
        • +
        + +

        2.13.0 / 2013-02-23

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Allow --profile option to take a count argument that +determines the number of slow examples to dump +(Greggory Rothmeier).
        • +
        • Add subject! that is the analog to let!. It defines an +explicit subject and sets a before hook that will invoke +the subject (Zubin Henner).
        • +
        • Fix let and subject declaration so that super +and return can be used in them, just like in a normal +method. (Myron Marston)
        • +
        • Allow output colors to be configured individually. +(Charlie Maffitt)
        • +
        • Always dump slow examples when --profile option is given, +even when an example failed (Myron Marston).
        • +
        + +

        Bug fixes

        + +
          +
        • Don't blow up when dumping error output for instances +of anonymous error classes (Myron Marston).
        • +
        • Fix default backtrace filters so lines from projects +containing "gems" in the name are not filtered, but +lines from installed gems still are (Myron Marston).
        • +
        • Fix autotest command so that is uses double quotes +rather than single quotes for windows compatibility +(Jonas Tingeborn).
        • +
        • Fix its so that uses of subject in a before or let +declaration in the parent group continue to reference the +parent group's subject. (Olek Janiszewski)
        • +
        + +

        2.12.2 / 2012-12-13

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix RSpec::Core::RakeTask so that it is compatible with rake 0.8.7 +on ruby 1.8.7. We had accidentally broke it in the 2.12 release +(Myron Marston).
        • +
        • Fix RSpec::Core::RakeTask so it is tolerant of the Rspec constant +for backwards compatibility (Patrick Van Stee)
        • +
        + +

        2.12.1 / 2012-12-01

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Specs are run even if another at_exit hook calls exit. This allows +Test::Unit and RSpec to run together. (Suraj N. Kurapati)
        • +
        • Fix full doc string concatenation so that it handles the case of a +method string (e.g. "#foo") being nested under a context string +(e.g. "when it is tuesday"), so that we get "when it is tuesday #foo" +rather than "when it is tuesday#foo". (Myron Marston)
        • +
        • Restore public API I unintentionally broke in 2.12.0: +RSpec::Core::Formatters::BaseFormatter#format_backtrce(backtrace, example) +(Myron Marston).
        • +
        + +

        2.12.0 / 2012-11-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Add support for custom ordering strategies for groups and examples. +(Myron Marston)
        • +
        • JSON Formatter (Alex Chaffee)
        • +
        • Refactor rake task internals (Sam Phippen)
        • +
        • Refactor HtmlFormatter (Pete Hodgson)
        • +
        • Autotest supports a path to Ruby that contains spaces (dsisnero)
        • +
        • Provide a helpful warning when a shared example group is redefined. +(Mark Burns).
        • +
        • --default_path can be specified as --default-line. --line_number can be +specified as --line-number. Hyphens are more idiomatic command line argument +separators (Sam Phippen).
        • +
        • A more useful error message is shown when an invalid command line option is +used (Jordi Polo).
        • +
        • Add format_docstrings { |str| } config option. It can be used to +apply formatting rules to example group and example docstrings. +(Alex Tan)
        • +
        • Add support for an .rspec-local options file. This is intended to +allow individual developers to set options in a git-ignored file that +override the common project options in .rspec. (Sam Phippen)
        • +
        • Support for mocha 0.13.0. (Andy Lindeman)
        • +
        + +

        Bug fixes

        + +
          +
        • Remove override of ExampleGroup#ancestors. This is a core ruby method that +RSpec shouldn't override. Instead, define ExampleGroup#parent_groups. (Myron +Marston)
        • +
        • Limit monkey patching of shared example/context declaration methods +(shared_examples_for, etc.) to just the objects that need it rather than +every object in the system (Myron Marston).
        • +
        • Fix Metadata#fetch to support computed values (Sam Goldman).
        • +
        • Named subject can now be referred to from within subject block in a nested +group (tomykaira).
        • +
        • Fix fail_fast so that it properly exits when an error occurs in a +before(:all) hook (Bradley Schaefer).
        • +
        • Make the order spec files are loaded consistent, regardless of the +order of the files returned by the OS or the order passed at +the command line (Jo Liss and Sam Phippen).
        • +
        • Ensure instance variables from before(:all) are always exposed +from after(:all), even if an error occurs in before(:all) +(Sam Phippen).
        • +
        • rspec --init no longer generates an incorrect warning about --configure +being deprecated (Sam Phippen).
        • +
        • Fix pluralization of 1 seconds (Odin Dutton)
        • +
        • Fix ANSICON url (Jarmo Pertman)
        • +
        • Use dup of Time so reporting isn't clobbered by examples that modify Time +without properly restoring it. (David Chelimsky)
        • +
        + +

        Deprecations

        + +
          +
        • share_as is no longer needed. shared_context and/or +RSpec::SharedContext provide better mechanisms (Sam Phippen).
        • +
        • Deprecate RSpec.configuration with a block (use RSpec.configure).
        • +
        + +

        2.11.1 / 2012-07-18

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix the way we autoload RSpec::Matchers so that custom matchers can be +defined before rspec-core has been configured to definitely use +rspec-expectations. (Myron Marston)
        • +
        • Fix typo in --help message printed for -e option. (Jo Liss)
        • +
        • Fix ruby warnings. (Myron Marston)
        • +
        • Ignore mock expectation failures when the example has already failed. +Mock expectation failures have always been ignored in this situation, +but due to my changes in 27059bf1 it was printing a confusing message. +(Myron Marston).
        • +
        + +

        2.11.0 / 2012-07-07

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Support multiple --example options. (Daniel Doubrovkine @dblock)
        • +
        • Named subject e.g. subject(:article) { Article.new } + +
        • +
        • config.mock_with and config.expect_with yield custom config object to a +block if given + +
            +
          • aids decoupling from rspec-core's configuation
          • +
        • +
        • include_context and include_examples support a block, which gets eval'd +in the current context (vs the nested context generated by it_behaves_like).
        • +
        • Add config.order = 'random' to the spec_helper.rb generated by rspec +--init.
        • +
        • Delay the loading of DRb (Myron Marston).
        • +
        • Limit monkey patching of describe onto just the objects that need it rather +than every object in the system (Myron Marston).
        • +
        + +

        Bug fixes

        + +
          +
        • Support alternative path separators. For example, on Windows, you can now do +this: rspec spec\subdir. (Jarmo Pertman @jarmo)
        • +
        • When an example raises an error and an after or around hook does as +well, print out the hook error. Previously, the error was silenced and +the user got no feedback about what happened. (Myron Marston)
        • +
        • --require and -I are merged among different configuration sources (Andy +Lindeman)
        • +
        • Delegate to mocha methods instead of aliasing them in mocha adapter.
        • +
        + +

        2.10.1 / 2012-05-19

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • RSpec.reset properly reinits configuration and world
        • +
        • Call to_s before split on exception messages that might not always be +Strings (slyphon)
        • +
        + +

        2.10.0 / 2012-05-03

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Add prepend_before and append_after hooks (preethiramdev) + +
            +
          • intended for extension libs
          • +
          • restores rspec-1 behavior
          • +
        • +
        • Reporting of profiled examples (moro) + +
            +
          • Report the total amount of time taken for the top slowest examples.
          • +
          • Report what percentage the slowest examples took from the total runtime.
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • Properly parse SPEC_OPTS options.
        • +
        • example.description returns the location of the example if there is no +explicit description or matcher-generated description.
        • +
        • RDoc fixes (Grzegorz Świrski)
        • +
        • Do not modify example ancestry when dumping errors (Michael Grosser)
        • +
        + +

        2.9.0 / 2012-03-17

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Support for "X minutes X seconds" spec run duration in formatter. (uzzz)
        • +
        • Strip whitespace from group and example names in doc formatter.
        • +
        • Removed spork-0.9 shim. If you're using spork-0.8.x, you'll need to upgrade +to 0.9.0.
        • +
        + +

        Bug fixes

        + +
          +
        • Restore --full_backtrace option
        • +
        • Ensure that values passed to config.filter_run are respected when running +over DRb (using spork).
        • +
        • Ensure shared example groups are reset after a run (as example groups are).
        • +
        • Remove rescue false from calls to filters represented as Procs
        • +
        • Ensure described_class gets the closest constant (pyromaniac)
        • +
        • In "autorun", don't run the specs in the at_exit hook if there was an +exception (most likely due to a SyntaxError). (sunaku)
        • +
        • Don't extend groups with modules already used to extend ancestor groups.
        • +
        • its correctly memoizes nil or false values (Yamada Masaki)
        • +
        + +

        2.8.0 / 2012-01-04

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • For metadata filtering, restore passing the entire array to the proc, rather +than each item in the array (weidenfreak)
        • +
        • Ensure each spec file is loaded only once + +
            +
          • Fixes a bug that caused all the examples in a file to be run when +referenced twice with line numbers in a command, e.g. + +
              +
            • rspec path/to/file:37 path/to/file:42
            • +
          • +
        • +
        + +

        2.8.0.rc2 / 2011-12-19

        + +

        Full Changelog

        + +

        Enhancments

        + +
          +
        • new --init command (Peter Schröder) + +
            +
          • generates spec/spec_helper.rb
          • +
          • deletes obsolete files (on confirmation)
          • +
          • merged with and deprecates --configure command, which generated +.rspec
          • +
        • +
        • use require_relative when available (Ian Leitch)
        • +
        • include_context and include_examples accept params (Calvin Bascom)
        • +
        • print the time for every example in the html formatter (Richie Vos)
        • +
        • several tasty refactoring niblets (Sasha)
        • +
        • `it "does something", :x => :foo,'bar',/baz/ + +
            +
          • supports matching n command line tag values with an example or group
          • +
        • +
        + +

        2.8.0.rc1 / 2011-11-06

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • --order (Justin Ko) + +
            +
          • run examples in random order: --order rand
          • +
          • specify the seed: --order rand:123
          • +
        • +
        • --seed SEED + +
            +
          • equivalent of --order rand:SEED
          • +
        • +
        • SharedContext supports let (David Chelimsky)
        • +
        • Filter improvements (David Chelimsky) + +
            +
          • override opposing tags from the command line
          • +
          • override RSpec.configure tags from the command line
          • +
          • --line_number 37 overrides all other filters
          • +
          • path/to/file.rb:37 overrides all other filters
          • +
          • refactor: consolidate filter management in a FilterManger object
          • +
        • +
        • Eliminate Ruby warnings (Matijs van Zuijlen)
        • +
        • Make reporter.report an API (David Chelimsky) + +
            +
          • supports extension tools like interative_rspec
          • +
        • +
        + +

        Changes

        + +
          +
        • change config.color_enabled (getter/setter/predicate) to color to align +with --[no]-color CLI option. + +
            +
          • color_enabled is still supported for now, but will likley be deprecated +in a 2.x release so we can remove it in 3.0.
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • Make sure the bar in --tag foo:bar makes it to DRb (Aaron Gibralter)
        • +
        • Fix bug where full descriptions of groups nested 3 deep were repeated.
        • +
        • Restore report of time to run to start after files are loaded. + +
            +
          • fixes bug where run times were cumalitive in spork
          • +
          • fixes compatibility with time-series metrics
          • +
        • +
        • Don't error out when config.mock_with or expect_with is re-specifying the +current config (Myron Marston)

        • +
        • Deprecations

          + +
            +
          • :alias option on configuration.add_setting. Use :alias_with on the +original setting declaration instead.
          • +
        • +
        + +

        2.7.1 / 2011-10-20

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • tell autotest the correct place to find the rspec executable
        • +
        + +

        2.7.0 / 2011-10-16

        + +

        Full Changelog

        + +

        NOTE: RSpec's release policy dictates that there should not be any backward +incompatible changes in minor releases, but we're making an exception to +release a change to how RSpec interacts with other command line tools.

        + +

        As of 2.7.0, you must explicity require "rspec/autorun" unless you use the +rspec command (which already does this for you).

        + +

        Enhancements

        + +
          +
        • Add example.exception (David Chelimsky)
        • +
        • --default_path command line option (Justin Ko)
        • +
        • support multiple --line_number options (David J. Hamilton) + +
            +
          • also supports path/to/file.rb:5:9 (runs examples on lines 5 and 9)
          • +
        • +
        • Allow classes/modules to be used as shared example group identifiers (Arthur +Gunn)
        • +
        • Friendly error message when shared context cannot be found (Sławosz +Sławiński)
        • +
        • Clear formatters when resetting config (John Bintz)
        • +
        • Add xspecify and xexample as temp-pending methods (David Chelimsky)
        • +
        • Add --no-drb option (Iain Hecker)
        • +
        • Provide more accurate run time by registering start time before code is +loaded (David Chelimsky) + +
            +
          • reverted in 2.8.0
          • +
        • +
        • Rake task default pattern finds specs in symlinked dirs (Kelly Felkins)
        • +
        • Rake task no longer does anything to invoke bundler since Bundler already +handles it for us. Thanks to Andre Arko for the tip.
        • +
        • Add --failure-exit-code option (Chris Griego)
        • +
        + +

        Bug fixes

        + +
          +
        • Include Rake::DSL to remove deprecation warnings in Rake > 0.8.7 (Pivotal +Casebook)
        • +
        • Only eval let block once even if it returns nil (Adam Meehan)
        • +
        • Fix --pattern option (wasn't being recognized) (David Chelimsky)
        • +
        • Only implicitly require "rspec/autorun" with the rspec command (David +Chelimsky)
        • +
        • Ensure that rspec's at_exit defines the exit code (Daniel Doubrovkine)
        • +
        • Show the correct snippet in the HTML and TextMate formatters (Brian Faherty)
        • +
        + +

        2.6.4 / 2011-06-06

        + +

        Full Changelog

        + +

        NOTE: RSpec's release policy dictates that there should not be new +functionality in patch releases, but this minor enhancement slipped in by +accident. As it doesn't add a new API, we decided to leave it in rather than +roll back this release.

        + +

        Enhancements

        + +
          +
        • Add summary of commands to run individual failed examples.
        • +
        + +

        Bug fixes

        + +
          +
        • Support exclusion filters in DRb. (Yann Lugrin)
        • +
        • Fix --example escaping when run over DRb. (Elliot Winkler)
        • +
        • Use standard ANSI codes for color formatting so colors work in a wider set of +color schemes.
        • +
        + +

        2.6.3 / 2011-05-24

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Explicitly convert exit code to integer, avoiding TypeError when return +value of run is IO object proxied by DRb::DRbObject (Julian Scheid)
        • +
        • Clarify behavior of --example command line option
        • +
        • Build using a rubygems-1.6.2 to avoid downstream yaml parsing error
        • +
        + +

        2.6.2 / 2011-05-21

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Warn rather than raise when HOME env var is not defined
        • +
        • Properly merge command-line exclusions with default :if and :unless (joshcooper)
        • +
        + +

        2.6.1 / 2011-05-19

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Don't extend nil when filters are nil
        • +
        • require 'rspec/autorun' when running rcov.
        • +
        + +

        2.6.0 / 2011-05-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • shared_context (Damian Nurzynski) + +
            +
          • extend groups matching specific metadata with: + +
              +
            • method definitions
            • +
            • subject declarations
            • +
            • let/let! declarations
            • +
            • etc (anything you can do in a group)
            • +
          • +
        • +
        • its([:key]) works for any subject with #[]. (Peter Jaros)
        • +
        • treat_symbols_as_metadata_keys_with_true_values (Myron Marston)
        • +
        • Print a deprecation warning when you configure RSpec after defining an +example. All configuration should happen before any examples are defined. +(Myron Marston)
        • +
        • Pass the exit status of a DRb run to the invoking process. This causes specs +run via DRb to not just return true or false. (Ilkka Laukkanen)
        • +
        • Refactoring of ConfigurationOptions#parse_options (Rodrigo Rosenfeld Rosas)
        • +
        • Report excluded filters in runner output (tip from andyl)
        • +
        • Clean up messages for filters/tags.
        • +
        • Restore --pattern/-P command line option from rspec-1
        • +
        • Support false as well as true in config.full_backtrace= (Andreas Tolf +Tolfsen)
        • +
        + +

        Bug fixes

        + +
          +
        • Don't stumble over an exception without a message (Hans Hasselberg)
        • +
        • Remove non-ascii characters from comments that were choking rcov (Geoffrey +Byers)
        • +
        • Fixed backtrace so it doesn't include lines from before the autorun at_exit +hook (Myron Marston)
        • +
        • Include RSpec::Matchers when first example group is defined, rather than just +before running the examples. This works around an obscure bug in ruby 1.9 +that can cause infinite recursion. (Myron Marston)
        • +
        • Don't send example_group_[started|finished] to formatters for empty groups.
        • +
        • Get specs passing on jruby (Sidu Ponnappa)
        • +
        • Fix bug where mixing nested groups and outer-level examples gave +unpredictable :line_number behavior (Artur Małecki)
        • +
        • Regexp.escape the argument to --example (tip from Elliot Winkler)
        • +
        • Correctly pass/fail pending block with message expectations
        • +
        • CommandLine returns exit status (0/1) instead of true/false
        • +
        • Create path to formatter output file if it doesn't exist (marekj).
        • +
        + +

        2.5.1 / 2011-02-06

        + +

        Full Changelog

        + +

        NOTE: this release breaks compatibility with rspec/autotest/bundler +integration, but does so in order to greatly simplify it.

        + +

        With this release, if you want the generated autotest command to include +'bundle exec', require Autotest's bundler plugin in a .autotest file in the +project's root directory or in your home directory:

        + +
        require "autotest/bundler"
        +
        + +

        Now you can just type 'autotest' on the commmand line and it will work as you expect.

        + +

        If you don't want 'bundle exec', there is nothing you have to do.

        + +

        2.5.0 / 2011-02-05

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Autotest::Rspec2 parses command line args passed to autotest after '--'
        • +
        • --skip-bundler option for autotest command
        • +
        • Autotest regexp fixes (Jon Rowe)
        • +
        • Add filters to html and textmate formatters (Daniel Quimper)
        • +
        • Explicit passing of block (need for JRuby 1.6) (John Firebaugh)
        • +
        + +

        Bug fixes

        + +
          +
        • fix dom IDs in HTML formatter (Brian Faherty)
        • +
        • fix bug with --drb + formatters when not running in drb
        • +
        • include --tag options in drb args (monocle)
        • +
        • fix regression so now SPEC_OPTS take precedence over CLI options again (Roman +Chernyatchik)
        • +
        • only call its(:attribute) once (failing example from Brian Dunn)
        • +
        • fix bizarre bug where rspec would hang after String.alias :to_int :to_i +(Damian Nurzynski)
        • +
        + +

        Deprecations

        + +
          +
        • implicit inclusion of 'bundle exec' when Gemfile present (use autotest's +bundler plugin instead)
        • +
        + +

        2.4.0 / 2011-01-02

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • start the debugger on -d so the stack trace is visible when it stops +(Clifford Heath)
        • +
        • apply hook filtering to examples as well as groups (Myron Marston)
        • +
        • support multiple formatters, each with their own output
        • +
        • show exception classes in failure messages unless they come from RSpec +matchers or message expectations
        • +
        • before(:all) { pending } sets all examples to pending
        • +
        + +

        Bug fixes

        + +
          +
        • fix bug due to change in behavior of reject in Ruby 1.9.3-dev (Shota +Fukumori)
        • +
        • fix bug when running in jruby: be explicit about passing block to super (John +Firebaugh)
        • +
        • rake task doesn't choke on paths with quotes (Janmejay Singh)
        • +
        • restore --options option from rspec-1
        • +
        • require 'ostruct' to fix bug with its([key]) (Kim Burgestrand)
        • +
        • --configure option generates .rspec file instead of autotest/discover.rb
        • +
        + +

        2.3.1 / 2010-12-16

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • send debugger warning message to $stdout if RSpec.configuration.error_stream +has not been defined yet.
        • +
        • HTML Formatter finally properly displays nested groups (Jarmo Pertman)
        • +
        • eliminate some warnings when running RSpec's own suite (Jarmo Pertman)
        • +
        + +

        2.3.0 / 2010-12-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • tell autotest to use "rspec2" if it sees a .rspec file in the project's root +directory + +
            +
          • replaces the need for ./autotest/discover.rb, which will not work with +all versions of ZenTest and/or autotest
          • +
        • +
        • config.expect_with + +
            +
          • :rspec # => rspec/expectations
          • +
          • :stdlib # => test/unit/assertions
          • +
          • :rspec, :stdlib # => both
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • fix dev Gemfile to work on non-mac-os machines (Lake Denman)
        • +
        • ensure explicit subject is only eval'd once (Laszlo Bacsi)
        • +
        + +

        2.2.1 / 2010-11-28

        + +

        Full Changelog

        + +

        Bug fixes +* alias_method instead of override Kernel#method_missing (John Wilger) +* changed --autotest to --tty in generated command (MIKAMI Yoshiyuki) +* revert change to debugger (had introduced conflict with Rails) + * also restored --debugger/-debug option

        + +

        2.2.0 / 2010-11-28

        + +

        Full Changelog

        + +

        Deprecations/changes

        + +
          +
        • --debug/-d on command line is deprecated and now has no effect
        • +
        • win32console is now ignored; Windows users must use ANSICON for color support +(Bosko Ivanisevic)
        • +
        + +

        Enhancements

        + +
          +
        • When developing locally rspec-core now works with the rspec-dev setup or your +local gems
        • +
        • Raise exception with helpful message when rspec-1 is loaded alongside rspec-2 +(Justin Ko)
        • +
        • debugger statements just work as long as ruby-debug is installed + +
            +
          • otherwise you get warned, but not fired
          • +
        • +
        • Expose example.metadata in around hooks
        • +
        • Performance improvments (much faster now)
        • +
        + +

        Bug fixes

        + +
          +
        • Make sure --fail-fast makes it across drb
        • +
        • Pass -Ilib:spec to rcov
        • +
        + +

        2.1.0 / 2010-11-07

        + +

        Full Changelog

        + +

        Enhancments

        + +
          +
        • Add skip_bundler option to rake task to tell rake task to ignore the presence +of a Gemfile (jfelchner)
        • +
        • Add gemfile option to rake task to tell rake task what Gemfile to look for +(defaults to 'Gemfile')
        • +
        • Allow passing caller trace into Metadata to support extensions (Glenn +Vanderburg)
        • +
        • Add deprecation warning for Spec::Runner.configure to aid upgrade from +RSpec-1
        • +
        • Add deprecated Spec::Rake::SpecTask to aid upgrade from RSpec-1
        • +
        • Add 'autospec' command with helpful message to aid upgrade from RSpec-1
        • +
        • Add support for filtering with tags on CLI (Lailson Bandeira)
        • +
        • Add a helpful message about RUBYOPT when require fails in bin/rspec (slyphon)
        • +
        • Add "-Ilib" to the default rcov options (Tianyi Cui)
        • +
        • Make the expectation framework configurable (default rspec, of course) +(Justin Ko)
        • +
        • Add 'pending' to be conditional (Myron Marston)
        • +
        • Add explicit support for :if and :unless as metadata keys for conditional run +of examples (Myron Marston)
        • +
        • Add --fail-fast command line option (Jeff Kreeftmeijer)
        • +
        + +

        Bug fixes

        + +
          +
        • Eliminate stack overflow with "subject { self }"
        • +
        • Require 'rspec/core' in the Raketask (ensures it required when running rcov)
        • +
        + +

        2.0.1 / 2010-10-18

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Restore color when using spork + autotest
        • +
        • Pending examples without docstrings render the correct message (Josep M. +Bach)
        • +
        • Fixed bug where a failure in a spec file ending in anything but _spec.rb +would fail in a confusing way.
        • +
        • Support backtrace lines from erb templates in html formatter (Alex Crichton)
        • +
        + +

        2.0.0 / 2010-10-10

        + +

        Full Changelog

        + +

        RSpec-1 compatibility

        + +
          +
        • Rake task uses ENV["SPEC"] as file list if present
        • +
        + +

        Bug fixes

        + +
          +
        • Bug Fix: optparse --out foo.txt (Leonardo Bessa)
        • +
        • Suppress color codes for non-tty output (except autotest)
        • +
        + +

        2.0.0.rc / 2010-10-05

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • implicitly require unknown formatters so you don't have to require the file +explicitly on the commmand line (Michael Grosser)
        • +
        • add --out/-o option to assign output target
        • +
        • added fail_fast configuration option to abort on first failure
        • +
        • support a Hash subject (its([:key]) { should == value }) (Josep M. Bach)
        • +
        + +

        Bug fixes

        + +
          +
        • Explicitly require rspec version to fix broken rdoc task (Hans de Graaff)
        • +
        • Ignore backtrace lines that come from other languages, like Java or +Javascript (Charles Lowell)
        • +
        • Rake task now does what is expected when setting (or not setting) +fail_on_error and verbose
        • +
        • Fix bug in which before/after(:all) hooks were running on excluded nested +groups (Myron Marston)
        • +
        • Fix before(:all) error handling so that it fails examples in nested groups, +too (Myron Marston)
        • +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • removed at_exit hook
        • +
        • CTRL-C stops the run (almost) immediately + +
            +
          • first it cleans things up by running the appropriate after(:all) and +after(:suite) hooks
          • +
          • then it reports on any examples that have already run
          • +
        • +
        • cleaned up rake task + +
            +
          • generate correct task under variety of conditions
          • +
          • options are more consistent
          • +
          • deprecated redundant options
          • +
        • +
        • run 'bundle exec autotest' when Gemfile is present
        • +
        • support ERB in .rspec options files (Justin Ko)
        • +
        • depend on bundler for development tasks (Myron Marston)
        • +
        • add example_group_finished to formatters and reporter (Roman Chernyatchik)
        • +
        + +

        Bug fixes

        + +
          +
        • support paths with spaces when using autotest (Andreas Neuhaus)
        • +
        • fix module_exec with ruby 1.8.6 (Myron Marston)
        • +
        • remove context method from top-level + +
            +
          • was conflicting with irb, for example
          • +
        • +
        • errors in before(:all) are now reported correctly (Chad Humphries)
        • +
        + +

        Removals

        + +
          +
        • removed -o --options-file command line option + +
            +
          • use ./.rspec and ~/.rspec
          • +
        • +
        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/file.License.html b/source/documentation/2.99/rspec-core/file.License.html new file mode 100644 index 000000000..00105c92c --- /dev/null +++ b/source/documentation/2.99/rspec-core/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2009 Chad Humphries, David Chelimsky
        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/file.README.html b/source/documentation/2.99/rspec-core/file.README.html new file mode 100644 index 000000000..6c63123e4 --- /dev/null +++ b/source/documentation/2.99/rspec-core/file.README.html @@ -0,0 +1,325 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        rspec-core Build Status Code Climate

        + +

        rspec-core provides the structure for writing executable examples of how your +code should behave, and an rspec command with tools to constrain which +examples get run and tailor the output.

        + +

        install

        + +
        gem install rspec      # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-core # for rspec-core only
        +rspec --help
        +
        + +

        basic structure

        + +

        RSpec uses the words "describe" and "it" so we can express concepts like a conversation:

        + +
        "Describe an order."
        +"It sums the prices of its line items."
        +
        + +
        describe Order do
        +  it "sums the prices of its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        The describe method creates an ExampleGroup. Within the +block passed to describe you can declare examples using the it method.

        + +

        Under the hood, an example group is a class in which the block passed to +describe is evaluated. The blocks passed to it are evaluated in the +context of an instance of that class.

        + +

        nested groups

        + +

        You can also declare nested nested groups using the describe or context +methods:

        + +
        describe Order do
        +  context "with no items" do
        +    it "behaves one way" do
        +      # ...
        +    end
        +  end
        +
        +  context "with one item" do
        +    it "behaves another way" do
        +      # ...
        +    end
        +  end
        +end
        +
        + +

        aliases

        + +

        You can declare example groups using either describe or context, though +only describe is available at the top level.

        + +

        You can declare examples within a group using any of it, specify, or +example.

        + +

        shared examples and contexts

        + +

        Declare a shared example group using shared_examples, and then include it +in any group using include_examples.

        + +
        shared_examples "collections" do |collection_class|
        +  it "is empty when first created" do
        +    expect(collection_class.new).to be_empty
        +  end
        +end
        +
        +describe Array do
        +  include_examples "collections", Array
        +end
        +
        +describe Hash do
        +  include_examples "collections", Hash
        +end
        +
        + +

        Nearly anything that can be declared within an example group can be declared +within a shared example group. This includes before, after, and around +hooks, let declarations, and nested groups/contexts.

        + +

        You can also use the names shared_context and include_context. These are +pretty much the same as shared_examples and include_examples, providing +more accurate naming when you share hooks, let declarations, helper methods, +etc, but no examples.

        + +

        metadata

        + +

        rspec-core stores a metadata hash with every example and group, which +contains their descriptions, the locations at which they were +declared, etc, etc. This hash powers many of rspec-core's features, +including output formatters (which access descriptions and locations), +and filtering before and after hooks.

        + +

        Although you probably won't ever need this unless you are writing an +extension, you can access it from an example like this:

        + +
        it "does something" do
        +  expect(example.[:description]).to eq("does something")
        +end
        +
        + +

        described_class

        + +

        When a class is passed to describe, you can access it from an example +using the described_class method, which is a wrapper for +example.metadata[:described_class].

        + +
        describe Widget do
        +  example do
        +    expect(described_class).to equal(Widget)
        +  end
        +end
        +
        + +

        This is useful in extensions or shared example groups in which the specific +class is unknown. Taking the collections shared example group from above, we can +clean it up a bit using described_class:

        + +
        shared_examples "collections" do
        +  it "is empty when first created" do
        +    expect(described_class.new).to be_empty
        +  end
        +end
        +
        +describe Array do
        +  include_examples "collections"
        +end
        +
        +describe Hash do
        +  include_examples "collections"
        +end
        +
        + +

        the rspec command

        + +

        When you install the rspec-core gem, it installs the rspec executable, +which you'll use to run rspec. The rspec command comes with many useful +options. +Run rspec --help to see the complete list.

        + +

        store command line options .rspec

        + +

        You can store command line options in a .rspec file in the project's root +directory, and the rspec command will read them as though you typed them on +the command line.

        + +

        autotest integration

        + +

        rspec-core ships with an Autotest extension, which is loaded automatically if +there is a .rspec file in the project's root directory.

        + +

        rcov integration

        + +

        rcov is best integrated via the rcov rake +task.

        + +

        rcov can also be integrated via the rspec rake task, but it requires a bit +more setup:

        + +
        # Rakefile
        +require 'rspec/core/rake_task'
        +
        +RSpec::Core::RakeTask.new(:spec) do |config|
        +  config.rcov = true
        +end
        +
        +task :default => :spec
        +
        +# spec/spec_helper.rb
        +require 'rspec/autorun' # **add this**
        +
        + +

        get started

        + +

        Start with a simple example of behavior you expect from your system. Do +this before you write any implementation code:

        + +
        # in spec/calculator_spec.rb
        +describe Calculator do
        +  describe '#add' do
        +    it 'returns the sum of its arguments' do
        +      expect(Calculator.new.add(1, 2)).to eq(3)
        +    end
        +  end
        +end
        +
        + +

        Run this with the rspec command, and watch it fail:

        + +
        $ rspec spec/calculator_spec.rb
        +./spec/calculator_spec.rb:1: uninitialized constant Calculator
        +
        + +

        Implement the simplest solution:

        + +
        # in lib/calculator.rb
        +class Calculator
        +  def add(a,b)
        +    a + b
        +  end
        +end
        +
        + +

        Be sure to require the implementation file in the spec:

        + +
        # in spec/calculator_spec.rb
        +# - RSpec adds ./lib to the $LOAD_PATH
        +require "calculator"
        +
        + +

        Now run the spec again, and watch it pass:

        + +
        $ rspec spec/calculator_spec.rb
        +.
        +
        +Finished in 0.000315 seconds
        +1 example, 0 failures
        +
        + +

        Use the documentation formatter to see the resulting spec:

        + +
        $ rspec spec/calculator_spec.rb --format doc
        +Calculator
        +  #add
        +    returns the sum of its arguments
        +
        +Finished in 0.000379 seconds
        +1 example, 0 failures
        +
        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/file_list.html b/source/documentation/2.99/rspec-core/file_list.html new file mode 100644 index 000000000..4fbe39987 --- /dev/null +++ b/source/documentation/2.99/rspec-core/file_list.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-core/frames.html b/source/documentation/2.99/rspec-core/frames.html new file mode 100644 index 000000000..87a4a6df1 --- /dev/null +++ b/source/documentation/2.99/rspec-core/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + diff --git a/source/documentation/2.99/rspec-core/index.html b/source/documentation/2.99/rspec-core/index.html new file mode 100644 index 000000000..6c63123e4 --- /dev/null +++ b/source/documentation/2.99/rspec-core/index.html @@ -0,0 +1,325 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        rspec-core Build Status Code Climate

        + +

        rspec-core provides the structure for writing executable examples of how your +code should behave, and an rspec command with tools to constrain which +examples get run and tailor the output.

        + +

        install

        + +
        gem install rspec      # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-core # for rspec-core only
        +rspec --help
        +
        + +

        basic structure

        + +

        RSpec uses the words "describe" and "it" so we can express concepts like a conversation:

        + +
        "Describe an order."
        +"It sums the prices of its line items."
        +
        + +
        describe Order do
        +  it "sums the prices of its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        The describe method creates an ExampleGroup. Within the +block passed to describe you can declare examples using the it method.

        + +

        Under the hood, an example group is a class in which the block passed to +describe is evaluated. The blocks passed to it are evaluated in the +context of an instance of that class.

        + +

        nested groups

        + +

        You can also declare nested nested groups using the describe or context +methods:

        + +
        describe Order do
        +  context "with no items" do
        +    it "behaves one way" do
        +      # ...
        +    end
        +  end
        +
        +  context "with one item" do
        +    it "behaves another way" do
        +      # ...
        +    end
        +  end
        +end
        +
        + +

        aliases

        + +

        You can declare example groups using either describe or context, though +only describe is available at the top level.

        + +

        You can declare examples within a group using any of it, specify, or +example.

        + +

        shared examples and contexts

        + +

        Declare a shared example group using shared_examples, and then include it +in any group using include_examples.

        + +
        shared_examples "collections" do |collection_class|
        +  it "is empty when first created" do
        +    expect(collection_class.new).to be_empty
        +  end
        +end
        +
        +describe Array do
        +  include_examples "collections", Array
        +end
        +
        +describe Hash do
        +  include_examples "collections", Hash
        +end
        +
        + +

        Nearly anything that can be declared within an example group can be declared +within a shared example group. This includes before, after, and around +hooks, let declarations, and nested groups/contexts.

        + +

        You can also use the names shared_context and include_context. These are +pretty much the same as shared_examples and include_examples, providing +more accurate naming when you share hooks, let declarations, helper methods, +etc, but no examples.

        + +

        metadata

        + +

        rspec-core stores a metadata hash with every example and group, which +contains their descriptions, the locations at which they were +declared, etc, etc. This hash powers many of rspec-core's features, +including output formatters (which access descriptions and locations), +and filtering before and after hooks.

        + +

        Although you probably won't ever need this unless you are writing an +extension, you can access it from an example like this:

        + +
        it "does something" do
        +  expect(example.[:description]).to eq("does something")
        +end
        +
        + +

        described_class

        + +

        When a class is passed to describe, you can access it from an example +using the described_class method, which is a wrapper for +example.metadata[:described_class].

        + +
        describe Widget do
        +  example do
        +    expect(described_class).to equal(Widget)
        +  end
        +end
        +
        + +

        This is useful in extensions or shared example groups in which the specific +class is unknown. Taking the collections shared example group from above, we can +clean it up a bit using described_class:

        + +
        shared_examples "collections" do
        +  it "is empty when first created" do
        +    expect(described_class.new).to be_empty
        +  end
        +end
        +
        +describe Array do
        +  include_examples "collections"
        +end
        +
        +describe Hash do
        +  include_examples "collections"
        +end
        +
        + +

        the rspec command

        + +

        When you install the rspec-core gem, it installs the rspec executable, +which you'll use to run rspec. The rspec command comes with many useful +options. +Run rspec --help to see the complete list.

        + +

        store command line options .rspec

        + +

        You can store command line options in a .rspec file in the project's root +directory, and the rspec command will read them as though you typed them on +the command line.

        + +

        autotest integration

        + +

        rspec-core ships with an Autotest extension, which is loaded automatically if +there is a .rspec file in the project's root directory.

        + +

        rcov integration

        + +

        rcov is best integrated via the rcov rake +task.

        + +

        rcov can also be integrated via the rspec rake task, but it requires a bit +more setup:

        + +
        # Rakefile
        +require 'rspec/core/rake_task'
        +
        +RSpec::Core::RakeTask.new(:spec) do |config|
        +  config.rcov = true
        +end
        +
        +task :default => :spec
        +
        +# spec/spec_helper.rb
        +require 'rspec/autorun' # **add this**
        +
        + +

        get started

        + +

        Start with a simple example of behavior you expect from your system. Do +this before you write any implementation code:

        + +
        # in spec/calculator_spec.rb
        +describe Calculator do
        +  describe '#add' do
        +    it 'returns the sum of its arguments' do
        +      expect(Calculator.new.add(1, 2)).to eq(3)
        +    end
        +  end
        +end
        +
        + +

        Run this with the rspec command, and watch it fail:

        + +
        $ rspec spec/calculator_spec.rb
        +./spec/calculator_spec.rb:1: uninitialized constant Calculator
        +
        + +

        Implement the simplest solution:

        + +
        # in lib/calculator.rb
        +class Calculator
        +  def add(a,b)
        +    a + b
        +  end
        +end
        +
        + +

        Be sure to require the implementation file in the spec:

        + +
        # in spec/calculator_spec.rb
        +# - RSpec adds ./lib to the $LOAD_PATH
        +require "calculator"
        +
        + +

        Now run the spec again, and watch it pass:

        + +
        $ rspec spec/calculator_spec.rb
        +.
        +
        +Finished in 0.000315 seconds
        +1 example, 0 failures
        +
        + +

        Use the documentation formatter to see the resulting spec:

        + +
        $ rspec spec/calculator_spec.rb --format doc
        +Calculator
        +  #add
        +    returns the sum of its arguments
        +
        +Finished in 0.000379 seconds
        +1 example, 0 failures
        +
        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-core/method_list.html b/source/documentation/2.99/rspec-core/method_list.html new file mode 100644 index 000000000..35b3eb979 --- /dev/null +++ b/source/documentation/2.99/rspec-core/method_list.html @@ -0,0 +1,2829 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-core/top-level-namespace.html b/source/documentation/2.99/rspec-core/top-level-namespace.html new file mode 100644 index 000000000..2f462e4f9 --- /dev/null +++ b/source/documentation/2.99/rspec-core/top-level-namespace.html @@ -0,0 +1,144 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + +
        Extended by:
        +
        RSpec::Core::DSL, RSpec::Core::SharedExampleGroup::TopLevelDSL
        + + + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Kernel, RSpec + + + + +

        + + + + + + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from RSpec::Core::SharedExampleGroup::TopLevelDSL

        +

        share_as, share_examples_for, shared_example_groups, shared_examples

        + + + + + + + + + +

        Methods included from RSpec::Core::DSL

        +

        describe

        + + +
        + + + + + \ No newline at end of file From 47268ed9241e70dcf61dd0984e29d5f31b108c0c Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:21:59 +1100 Subject: [PATCH 08/14] rspec-core 2.14 documentation --- .../2.14/rspec-core/Autotest/Rspec2.html | 539 +++ .../documentation/2.14/rspec-core/Kernel.html | 186 + .../documentation/2.14/rspec-core/RSpec.html | 448 ++ .../2.14/rspec-core/RSpec/Core.html | 152 + .../RSpec/Core/BacktraceCleaner.html | 583 +++ .../RSpec/Core/BacktraceFormatter.html | 198 + .../rspec-core/RSpec/Core/CommandLine.html | 333 ++ .../rspec-core/RSpec/Core/Configuration.html | 4129 +++++++++++++++++ ...tBeConfiguredBeforeExampleGroupsError.html | 123 + .../rspec-core/RSpec/Core/DRbCommandLine.html | 322 ++ .../2.14/rspec-core/RSpec/Core/DSL.html | 213 + .../rspec-core/RSpec/Core/Deprecation.html | 109 + .../2.14/rspec-core/RSpec/Core/Example.html | 928 ++++ .../rspec-core/RSpec/Core/Example/Procsy.html | 408 ++ .../rspec-core/RSpec/Core/ExampleGroup.html | 2237 +++++++++ .../rspec-core/RSpec/Core/FilterManager.html | 1128 +++++ .../FilterManager/BackwardCompatibility.html | 362 ++ .../RSpec/Core/FilterManager/Describable.html | 265 ++ .../rspec-core/RSpec/Core/Formatters.html | 197 + .../RSpec/Core/Formatters/BaseFormatter.html | 2171 +++++++++ .../Core/Formatters/BaseTextFormatter.html | 1211 +++++ .../Core/Formatters/DeprecationFormatter.html | 394 ++ .../Formatters/DocumentationFormatter.html | 866 ++++ .../RSpec/Core/Formatters/Helpers.html | 644 +++ .../RSpec/Core/Formatters/HtmlFormatter.html | 1268 +++++ .../RSpec/Core/Formatters/HtmlPrinter.html | 974 ++++ .../RSpec/Core/Formatters/JsonFormatter.html | 657 +++ .../Core/Formatters/ProgressFormatter.html | 427 ++ .../Core/Formatters/SnippetExtractor.html | 669 +++ .../SnippetExtractor/NullConverter.html | 211 + .../Core/Formatters/TextMateFormatter.html | 497 ++ .../NonEscapingHtmlPrinter.html | 214 + .../2.14/rspec-core/RSpec/Core/Hooks.html | 897 ++++ .../RSpec/Core/Hooks/AfterAllHook.html | 283 ++ .../RSpec/Core/Hooks/AfterHook.html | 265 ++ .../RSpec/Core/Hooks/AroundHook.html | 213 + .../Core/Hooks/AroundHookCollection.html | 320 ++ .../RSpec/Core/Hooks/BeforeHook.html | 265 ++ .../RSpec/Core/Hooks/GroupHookCollection.html | 246 + .../rspec-core/RSpec/Core/Hooks/Hook.html | 436 ++ .../RSpec/Core/Hooks/HookCollection.html | 310 ++ .../Core/Hooks/HookCollectionAliases.html | 109 + .../RSpec/Core/Hooks/RegistersGlobals.html | 182 + .../RSpec/Core/MemoizedHelpers.html | 436 ++ .../Core/MemoizedHelpers/ClassMethods.html | 822 ++++ .../2.14/rspec-core/RSpec/Core/Metadata.html | 382 ++ .../Core/Metadata/ExampleMetadataHash.html | 243 + .../Core/Metadata/GroupMetadataHash.html | 337 ++ .../RSpec/Core/MockFrameworkAdapter.html | 401 ++ .../2.14/rspec-core/RSpec/Core/Parser.html | 800 ++++ .../2.14/rspec-core/RSpec/Core/Pending.html | 390 ++ .../Pending/PendingDeclaredInExample.html | 123 + .../RSpec/Core/ProjectInitializer.html | 622 +++ .../2.14/rspec-core/RSpec/Core/RakeTask.html | 1425 ++++++ .../2.14/rspec-core/RSpec/Core/Reporter.html | 1196 +++++ .../rspec-core/RSpec/Core/RubyProject.html | 438 ++ .../2.14/rspec-core/RSpec/Core/Runner.html | 692 +++ .../rspec-core/RSpec/Core/SharedContext.html | 388 ++ .../RSpec/Core/SharedContext/Recording.html | 388 ++ .../RSpec/Core/SharedExampleGroup.html | 464 ++ .../Core/SharedExampleGroup/Collection.html | 258 + .../Core/SharedExampleGroup/TopLevelDSL.html | 288 ++ .../2.14/rspec-core/RSpec/Core/Version.html | 117 + .../2.14/rspec-core/RSpec/Core/World.html | 1232 +++++ .../2.14/rspec-core/RSpec/Runner.html | 188 + .../documentation/2.14/rspec-core/_index.html | 704 +++ .../2.14/rspec-core/class_list.html | 58 + .../2.14/rspec-core/file.Changelog.html | 1228 +++++ .../2.14/rspec-core/file.License.html | 73 + .../2.14/rspec-core/file.README.html | 325 ++ .../2.14/rspec-core/file_list.html | 66 + .../documentation/2.14/rspec-core/frames.html | 26 + .../documentation/2.14/rspec-core/index.html | 325 ++ .../2.14/rspec-core/method_list.html | 2307 +++++++++ .../2.14/rspec-core/top-level-namespace.html | 144 + 75 files changed, 43475 insertions(+) create mode 100644 source/documentation/2.14/rspec-core/Autotest/Rspec2.html create mode 100644 source/documentation/2.14/rspec-core/Kernel.html create mode 100644 source/documentation/2.14/rspec-core/RSpec.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/BacktraceCleaner.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/BacktraceFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/CommandLine.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Configuration.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Configuration/MustBeConfiguredBeforeExampleGroupsError.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/DRbCommandLine.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/DSL.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Deprecation.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Example.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Example/Procsy.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/ExampleGroup.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/FilterManager.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/FilterManager/BackwardCompatibility.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/FilterManager/Describable.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/DeprecationFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/DocumentationFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/Helpers.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/HtmlFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/HtmlPrinter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/JsonFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/ProgressFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/SnippetExtractor/NullConverter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/TextMateFormatter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Formatters/TextMateFormatter/NonEscapingHtmlPrinter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AfterAllHook.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AfterHook.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AroundHook.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AroundHookCollection.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/BeforeHook.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/GroupHookCollection.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/Hook.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/HookCollection.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/HookCollectionAliases.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Hooks/RegistersGlobals.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/MemoizedHelpers.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Metadata.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Metadata/ExampleMetadataHash.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Metadata/GroupMetadataHash.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/MockFrameworkAdapter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Parser.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Pending.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Pending/PendingDeclaredInExample.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/ProjectInitializer.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/RakeTask.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Reporter.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/RubyProject.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Runner.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/SharedContext.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/SharedContext/Recording.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup/Collection.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/Version.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Core/World.html create mode 100644 source/documentation/2.14/rspec-core/RSpec/Runner.html create mode 100644 source/documentation/2.14/rspec-core/_index.html create mode 100644 source/documentation/2.14/rspec-core/class_list.html create mode 100644 source/documentation/2.14/rspec-core/file.Changelog.html create mode 100644 source/documentation/2.14/rspec-core/file.License.html create mode 100644 source/documentation/2.14/rspec-core/file.README.html create mode 100644 source/documentation/2.14/rspec-core/file_list.html create mode 100644 source/documentation/2.14/rspec-core/frames.html create mode 100644 source/documentation/2.14/rspec-core/index.html create mode 100644 source/documentation/2.14/rspec-core/method_list.html create mode 100644 source/documentation/2.14/rspec-core/top-level-namespace.html diff --git a/source/documentation/2.14/rspec-core/Autotest/Rspec2.html b/source/documentation/2.14/rspec-core/Autotest/Rspec2.html new file mode 100644 index 000000000..55a2f163c --- /dev/null +++ b/source/documentation/2.14/rspec-core/Autotest/Rspec2.html @@ -0,0 +1,539 @@ + + + + + + Class: Autotest::Rspec2 + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: Autotest::Rspec2 + + + +

        + +
        + +
        Inherits:
        +
        + Autotest + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/autotest/rspec2.rb
        + +
        +
        + +

        Overview

        +
        + +
        + Note: +

        this will be extracted to a separate gem when we release rspec-3.

        +
        +
        + +

        Derived from the Autotest class, extends the autotest command to work +with RSpec.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + +
        + +
        RSPEC_EXECUTABLE = + +
        +
        File.expand_path('../../../exe/rspec', __FILE__)
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Rspec2) initialize + + + + + +

        +
        +

        Returns a new instance of Rspec2

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/autotest/rspec2.rb', line 12
        +
        +def initialize
        +  super()
        +  clear_mappings
        +  setup_rspec_project_mappings
        +
        +  # Example for Ruby 1.8: http://rubular.com/r/AOXNVDrZpx
        +  # Example for Ruby 1.9: http://rubular.com/r/85ag5AZ2jP
        +  self.failed_results_re = /^\s*\d+\).*\n\s+(?:\e\[\d*m)?Failure.*(\n(?:\e\[\d*m)?\s+#\s(.*)?:\d+(?::.*)?(?:\e\[\d*m)?)+$/m
        +  self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) consolidate_failures(failed) + + + + + +

        +
        +

        Overrides Autotest's implementation to read rspec output

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +
        +
        # File 'lib/autotest/rspec2.rb', line 37
        +
        +def consolidate_failures(failed)
        +  filters = new_hash_of_arrays
        +  failed.each do |spec, trace|
        +    if trace =~ /(.*spec\.rb)/
        +      filters[$1] << spec
        +    end
        +  end
        +  return filters
        +end
        +
        +
        + +
        +

        + + - (Object) make_test_cmd(files_to_test) + + + + + +

        +
        +

        Overrides Autotest's implementation to generate the rspec command to run

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/autotest/rspec2.rb', line 48
        +
        +def make_test_cmd(files_to_test)
        +  files_to_test.empty? ? '' :
        +    %|#{prefix}"#{ruby}"#{suffix} -S "#{RSPEC_EXECUTABLE}" --tty #{normalize(files_to_test).keys.flatten.map { |f| %|"#{f}"|}.join(' ')}|
        +end
        +
        +
        + +
        +

        + + - (Object) normalize(files_to_test) + + + + + +

        +
        +

        Generates a map of filenames to Arrays for Autotest

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/autotest/rspec2.rb', line 54
        +
        +def normalize(files_to_test)
        +  files_to_test.keys.inject({}) do |result, filename|
        +    result.merge!(File.expand_path(filename) => [])
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) setup_rspec_project_mappings + + + + + +

        +
        +

        Adds conventional spec-to-file mappings to Autotest configuation.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/autotest/rspec2.rb', line 24
        +
        +def setup_rspec_project_mappings
        +  add_mapping(%r%^spec/.*_spec\.rb$%) { |filename, _|
        +    filename
        +  }
        +  add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
        +    ["spec/#{m[1]}_spec.rb"]
        +  }
        +  add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) {
        +    files_matching %r%^spec/.*_spec\.rb$%
        +  }
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/Kernel.html b/source/documentation/2.14/rspec-core/Kernel.html new file mode 100644 index 000000000..268f4c3cb --- /dev/null +++ b/source/documentation/2.14/rspec-core/Kernel.html @@ -0,0 +1,186 @@ + + + + + + Module: Kernel + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: Kernel + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/extensions/kernel.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) debugger(*args) + + + + + + + + + + + + + +

          If not already defined by ruby-debug, this implementation prints helpful message to STDERR when ruby-debug is not loaded.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) debugger(*args) + + + + + +

        +
        +

        If not already defined by ruby-debug, this implementation prints helpful +message to STDERR when ruby-debug is not loaded.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/core/extensions/kernel.rb', line 5
        +
        +def debugger(*args)
        +  (RSpec.configuration.error_stream || $stderr).puts "\n***** debugger statement ignored, use -d or --debug option to enable debugging\n#{caller(0)[1]}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec.html b/source/documentation/2.14/rspec-core/RSpec.html new file mode 100644 index 000000000..38d051531 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec.html @@ -0,0 +1,448 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec + + + +

        + +
        + + + +
        Extended by:
        +
        Core::Deprecation
        + + + + + + + +
        Defined in:
        +
        lib/rspec/core.rb,
        + lib/rspec/core/dsl.rb,
        lib/rspec/core/hooks.rb,
        lib/rspec/core/world.rb,
        lib/rspec/core/runner.rb,
        lib/rspec/core/example.rb,
        lib/rspec/core/version.rb,
        lib/rspec/core/pending.rb,
        lib/rspec/core/metadata.rb,
        lib/rspec/core/rake_task.rb,
        lib/rspec/core/deprecation.rb,
        lib/rspec/core/ruby_project.rb,
        lib/rspec/core/command_line.rb,
        lib/rspec/core/configuration.rb,
        lib/rspec/core/example_group.rb,
        lib/rspec/core/filter_manager.rb,
        lib/rspec/core/shared_context.rb,
        lib/rspec/core/mocking/with_rr.rb,
        lib/rspec/core/memoized_helpers.rb,
        lib/rspec/core/drb_command_line.rb,
        lib/rspec/core/backtrace_cleaner.rb,
        lib/rspec/core/formatters/helpers.rb,
        lib/rspec/core/extensions/ordered.rb,
        lib/rspec/core/mocking/with_rspec.rb,
        lib/rspec/core/mocking/with_mocha.rb,
        lib/rspec/core/project_initializer.rb,
        lib/rspec/core/shared_example_group.rb,
        lib/rspec/core/configuration_options.rb,
        lib/rspec/core/mocking/with_flexmock.rb,
        lib/rspec/core/metadata_hash_builder.rb,
        lib/rspec/core/backward_compatibility.rb,
        lib/rspec/core/formatters/html_printer.rb,
        lib/rspec/core/formatters/html_formatter.rb,
        lib/rspec/core/formatters/base_formatter.rb,
        lib/rspec/core/formatters/json_formatter.rb,
        lib/rspec/core/formatters/snippet_extractor.rb,
        lib/rspec/core/formatters/progress_formatter.rb,
        lib/rspec/core/formatters/base_text_formatter.rb,
        lib/rspec/core/formatters/text_mate_formatter.rb,
        lib/rspec/core/mocking/with_absolutely_nothing.rb,
        lib/rspec/core/shared_example_group/collection.rb,
        lib/rspec/core/extensions/module_eval_with_args.rb,
        lib/rspec/core/formatters/deprecation_formatter.rb,
        lib/rspec/core/extensions/instance_eval_with_args.rb,
        lib/rspec/core/formatters/documentation_formatter.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Core, Runner + + + + +

        + +

        Constant Summary

        + +
        + +
        MODULES_TO_AUTOLOAD = + +
        +
        {
        +  :Matchers     => "rspec/expectations",
        +  :Expectations => "rspec/expectations",
        +  :Mocks        => "rspec/mocks"
        +}
        + +
        SharedContext = + +
        +
        Core::SharedContext
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) configuration + + + + + +

        +
        +

        Returns the global Configuration object. While you +can use this method to access the configuration, the more common +convention is to use RSpec.configure.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configuration.drb_port = 1234
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/core.rb', line 87
        +
        +def self.configuration
        +  if block_given?
        +    RSpec.warn_deprecation <<-WARNING
        +
        +*****************************************************************
        +DEPRECATION WARNING
        +
        +* RSpec.configuration with a block is deprecated and has no effect.
        +* please use RSpec.configure with a block instead.
        +
        +Called from #{caller(0)[1]}
        +*****************************************************************
        +
        +WARNING
        +  end
        +  @configuration ||= RSpec::Core::Configuration.new
        +end
        +
        +
        + +
        +

        + + + (Object) configure {|Configuration| ... } + + + + + +

        +
        +

        Yields the global configuration to a block.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.add_formatter 'documentation'
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Configuration) + + + + — +

          global configuration

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +119
        +120
        +121
        +
        +
        # File 'lib/rspec/core.rb', line 119
        +
        +def self.configure
        +  yield configuration if block_given?
        +end
        +
        +
        + +
        +

        + + + (Object) const_missing(name) + + + + + +

        + + + + +
        +
        +
        +
        +152
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +165
        +166
        +
        +
        # File 'lib/rspec/core.rb', line 152
        +
        +def self.const_missing(name)
        +  # Load rspec-expectations when RSpec::Matchers is referenced. This allows
        +  # people to define custom matchers (using `RSpec::Matchers.define`) before
        +  # rspec-core has loaded rspec-expectations (since it delays the loading of
        +  # it to allow users to configure a different assertion/expectation
        +  # framework). `autoload` can't be used since it works with ruby's built-in
        +  # require (e.g. for files that are available relative to a load path dir),
        +  # but not with rubygems' extended require.
        +  #
        +  # As of rspec 2.14.1, we no longer require `rspec/mocks` and
        +  # `rspec/expectations` when `rspec` is required, so we want
        +  # to make them available as an autoload. For more info, see:
        +  require MODULES_TO_AUTOLOAD.fetch(name) { return super }
        +  ::RSpec.const_get(name)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core.html b/source/documentation/2.14/rspec-core/RSpec/Core.html new file mode 100644 index 000000000..8d8290b1f --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core.html @@ -0,0 +1,152 @@ + + + + + + Module: RSpec::Core + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/drb_options.rb,
        + lib/rspec/core.rb,
        lib/rspec/core/dsl.rb,
        lib/rspec/core/hooks.rb,
        lib/rspec/core/world.rb,
        lib/rspec/core/runner.rb,
        lib/rspec/core/example.rb,
        lib/rspec/core/version.rb,
        lib/rspec/core/pending.rb,
        lib/rspec/core/reporter.rb,
        lib/rspec/core/metadata.rb,
        lib/rspec/core/rake_task.rb,
        lib/rspec/core/deprecation.rb,
        lib/rspec/core/ruby_project.rb,
        lib/rspec/core/command_line.rb,
        lib/rspec/core/option_parser.rb,
        lib/rspec/core/configuration.rb,
        lib/rspec/core/example_group.rb,
        lib/rspec/core/filter_manager.rb,
        lib/rspec/core/shared_context.rb,
        lib/rspec/core/mocking/with_rr.rb,
        lib/rspec/core/memoized_helpers.rb,
        lib/rspec/core/drb_command_line.rb,
        lib/rspec/core/backtrace_cleaner.rb,
        lib/rspec/core/formatters/helpers.rb,
        lib/rspec/core/extensions/ordered.rb,
        lib/rspec/core/mocking/with_rspec.rb,
        lib/rspec/core/mocking/with_mocha.rb,
        lib/rspec/core/project_initializer.rb,
        lib/rspec/core/shared_example_group.rb,
        lib/rspec/core/configuration_options.rb,
        lib/rspec/core/mocking/with_flexmock.rb,
        lib/rspec/core/metadata_hash_builder.rb,
        lib/rspec/core/backward_compatibility.rb,
        lib/rspec/core/formatters/html_printer.rb,
        lib/rspec/core/formatters/html_formatter.rb,
        lib/rspec/core/formatters/base_formatter.rb,
        lib/rspec/core/formatters/json_formatter.rb,
        lib/rspec/core/formatters/snippet_extractor.rb,
        lib/rspec/core/formatters/progress_formatter.rb,
        lib/rspec/core/formatters/base_text_formatter.rb,
        lib/rspec/core/formatters/text_mate_formatter.rb,
        lib/rspec/core/mocking/with_absolutely_nothing.rb,
        lib/rspec/core/shared_example_group/collection.rb,
        lib/rspec/core/extensions/module_eval_with_args.rb,
        lib/rspec/core/formatters/deprecation_formatter.rb,
        lib/rspec/core/extensions/instance_eval_with_args.rb,
        lib/rspec/core/formatters/documentation_formatter.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        Builds command line arguments to pass to the rspec command over DRb

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: BacktraceFormatter, DSL, Deprecation, Formatters, Hooks, MemoizedHelpers, MockFrameworkAdapter, Pending, RubyProject, SharedContext, SharedExampleGroup, Version + + + + Classes: BacktraceCleaner, CommandLine, Configuration, DRbCommandLine, Example, ExampleGroup, FilterManager, Metadata, Parser, ProjectInitializer, RakeTask, Reporter, Runner, World + + +

        + +

        Constant Summary

        + +
        + +
        PendingExampleFixedError = +
        +
        +

        Alias the error for compatibility with extension gems (e.g. formatters) +that depend on the const name of the error in RSpec <= 2.8.

        + + +
        +
        +
        + + +
        +
        +
        Pending::PendingExampleFixedError
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/BacktraceCleaner.html b/source/documentation/2.14/rspec-core/RSpec/Core/BacktraceCleaner.html new file mode 100644 index 000000000..bd8ea2f5c --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/BacktraceCleaner.html @@ -0,0 +1,583 @@ + + + + + + Class: RSpec::Core::BacktraceCleaner + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::BacktraceCleaner + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/backtrace_cleaner.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        DEFAULT_EXCLUSION_PATTERNS = + +
        +
        [
        +  /\/lib\d*\/ruby\//,
        +  /org\/jruby\//,
        +  /bin\//,
        +  %r|/gems/|,
        +  /spec\/spec_helper\.rb/,
        +  /lib\/rspec\/(core|expectations|matchers|mocks)/
        +]
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (BacktraceCleaner) initialize(inclusion_patterns = nil, exclusion_patterns = DEFAULT_EXCLUSION_PATTERNS.dup) + + + + + +

        +
        +

        Returns a new instance of BacktraceCleaner

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 17
        +
        +def initialize(inclusion_patterns=nil, exclusion_patterns=DEFAULT_EXCLUSION_PATTERNS.dup)
        +  @exclusion_patterns = exclusion_patterns
        +
        +  if inclusion_patterns.nil?
        +    @inclusion_patterns = (matches_an_exclusion_pattern? Dir.getwd) ? [Regexp.new(Dir.getwd)] : []
        +  else
        +    @inclusion_patterns = inclusion_patterns
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) exclusion_patterns + + + + + +

        +
        +

        Returns the value of attribute exclusion_patterns

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 15
        +
        +def exclusion_patterns
        +  @exclusion_patterns
        +end
        +
        +
        + + + +
        +

        + + - (Object) inclusion_patterns + + + + + +

        +
        +

        Returns the value of attribute inclusion_patterns

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 14
        +
        +def inclusion_patterns
        +  @inclusion_patterns
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) exclude?(line) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 27
        +
        +def exclude?(line)
        +  @inclusion_patterns.none? {|p| line =~ p} and matches_an_exclusion_pattern?(line)
        +end
        +
        +
        + +
        +

        + + - (Object) full_backtrace=(true_or_false) + + + + + +

        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 31
        +
        +def full_backtrace=(true_or_false)
        +  @exclusion_patterns = true_or_false ? [] : DEFAULT_EXCLUSION_PATTERNS.dup
        +end
        +
        +
        + +
        +

        + + - (Boolean) full_backtrace? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/core/backtrace_cleaner.rb', line 35
        +
        +def full_backtrace?
        +  @exclusion_patterns.empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/BacktraceFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/BacktraceFormatter.html new file mode 100644 index 000000000..a05b655be --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/BacktraceFormatter.html @@ -0,0 +1,198 @@ + + + + + + Module: RSpec::Core::BacktraceFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::BacktraceFormatter + + + +

        + +
        + + + +
        Extended by:
        +
        BacktraceFormatter
        + + + + + + +
        Included in:
        +
        BacktraceFormatter, Formatters::Helpers
        + + + +
        Defined in:
        +
        lib/rspec/core/formatters/helpers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) format_backtrace(backtrace, options = {}) + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 6
        +
        +def format_backtrace(backtrace, options = {})
        +  return "" unless backtrace
        +  return backtrace if options[:full_backtrace] == true
        +
        +  if at_exit_index = backtrace.index(RSpec::Core::Runner::AT_EXIT_HOOK_BACKTRACE_LINE)
        +    backtrace = backtrace[0, at_exit_index]
        +  end
        +
        +  cleansed = backtrace.map { |line| backtrace_line(line) }.compact
        +  cleansed.empty? ? backtrace : cleansed
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/CommandLine.html b/source/documentation/2.14/rspec-core/RSpec/Core/CommandLine.html new file mode 100644 index 000000000..0549a735d --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/CommandLine.html @@ -0,0 +1,333 @@ + + + + + + Class: RSpec::Core::CommandLine + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::CommandLine + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/command_line.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (CommandLine) initialize(options, configuration = RSpec::configuration, world = RSpec::world) + + + + + +

        +
        +

        Returns a new instance of CommandLine

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/command_line.rb', line 4
        +
        +def initialize(options, configuration=RSpec::configuration, world=RSpec::world)
        +  if Array === options
        +    options = ConfigurationOptions.new(options)
        +    options.parse_options
        +  end
        +  @options       = options
        +  @configuration = configuration
        +  @world         = world
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) run(err, out) + + + + + +

        +
        +

        Configures and runs a suite

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + err + + + (IO) + + + +
        • + +
        • + + out + + + (IO) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/core/command_line.rb', line 18
        +
        +def run(err, out)
        +  @configuration.error_stream = err
        +  @configuration.output_stream ||= out
        +  @options.configure(@configuration)
        +  @configuration.load_spec_files
        +  @world.announce_filters
        +
        +  @configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
        +    begin
        +      @configuration.run_hook(:before, :suite)
        +      @world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
        +    ensure
        +      @configuration.run_hook(:after, :suite)
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Configuration.html b/source/documentation/2.14/rspec-core/RSpec/Core/Configuration.html new file mode 100644 index 000000000..7b36b3118 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Configuration.html @@ -0,0 +1,4129 @@ + + + + + + Class: RSpec::Core::Configuration + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Hooks
        + + + + + +
        Defined in:
        +
        lib/rspec/core/configuration.rb
        + +
        +
        + +

        Overview

        +
        +

        Stores runtime configuration information.

        + +

        Configuration options are loaded from ~/.rspec, .rspec, +.rspec-local, command line switches, and the SPEC_OPTS environment +variable (listed in lowest to highest precedence; for example, an option +in ~/.rspec can be overridden by an option in .rspec-local).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        Standard settings

        +

        + +
        RSpec.configure do |c|
        +  c.drb          = true
        +  c.drb_port     = 1234
        +  c.default_path = 'behavior'
        +end
        + + +

        Hooks

        +

        + +
        RSpec.configure do |c|
        +  c.before(:suite) { establish_connection }
        +  c.before(:each)  {  :authorized }
        +  c.around(:each)  { |ex| Database.transaction(&ex) }
        +end
        + +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + + + Classes: MustBeConfiguredBeforeExampleGroupsError + + +

        + +

        Constant Summary

        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) backtrace_cleaner + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute backtrace_cleaner.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Hooks

        +

        #after, #append_after, #around, #before, #prepend_before

        + + + + + + + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Configuration) initialize + + + + + +

        +
        +

        Returns a new instance of Configuration

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +186
        +187
        +188
        +189
        +190
        +191
        +192
        +193
        +194
        +195
        +196
        +197
        +198
        +199
        +200
        +201
        +202
        +203
        +204
        +205
        +206
        +207
        +208
        +209
        +210
        +211
        +212
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 186
        +
        +def initialize
        +  @expectation_frameworks = []
        +  @include_or_extend_modules = []
        +  @mock_framework = nil
        +  @files_to_run = []
        +  @formatters = []
        +  @color = false
        +  @pattern = '**/*_spec.rb'
        +  @failure_exit_code = 1
        +
        +  @backtrace_cleaner = BacktraceCleaner.new
        +
        +  @default_path = 'spec'
        +  @deprecation_stream = $stderr
        +  @filter_manager = FilterManager.new
        +  @preferred_options = {}
        +  @seed = srand % 0xFFFF
        +  @failure_color = :red
        +  @success_color = :green
        +  @pending_color = :yellow
        +  @default_color = :white
        +  @fixed_color = :blue
        +  @detail_color = :cyan
        +  @profile_examples = false
        +  @requires = []
        +  @libs = []
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) backtrace_cleaner (readonly) + + + + + +

        +
        +

        Returns the value of attribute backtrace_cleaner

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +184
        +185
        +186
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 184
        +
        +def backtrace_cleaner
        +  @backtrace_cleaner
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_formatter(formatter) + + + + Also known as: + formatter= + + + + +

        +
        +

        Adds a formatter to the formatters collection. formatter can be a +string representing any of the built-in formatters (see +built_in_formatter), or a custom formatter class.

        + +

        Note

        + +

        For internal purposes, add_formatter also accepts the name of a class +and paths to use for output streams, but you should consider that a +private api that may change at any time without notice.

        + + +
        +
        +
        + + + + +
        + + + + +
        +
        +
        +
        +571
        +572
        +573
        +574
        +575
        +576
        +577
        +578
        +579
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 571
        +
        +def add_formatter(formatter_to_use, *paths)
        +  formatter_class =
        +    built_in_formatter(formatter_to_use) ||
        +    custom_formatter(formatter_to_use) ||
        +    (raise ArgumentError, "Formatter '#{formatter_to_use}' unknown - maybe you meant 'documentation' or 'progress'?.")
        +
        +  paths << output if paths.empty?
        +  formatters << formatter_class.new(*paths.map {|p| String === p ? file_at(p) : p})
        +end
        +
        +
        + +
        +

        + + + - (Object) add_setting(name) + + - (Object) add_setting(name, opts) + + + + + + +

        +
        +

        Adds a custom setting to the RSpec.configuration object.

        + +
        RSpec.configuration.add_setting :foo
        +
        + +

        Used internally and by extension frameworks like rspec-rails, so they +can add config settings that are domain specific. For example:

        + +
        RSpec.configure do |c|
        +  c.add_setting :use_transactional_fixtures,
        +    :default => true,
        +    :alias_with => :use_transactional_examples
        +end
        +
        + +

        add_setting creates three methods on the configuration object, a +setter, a getter, and a predicate:

        + +
        RSpec.configuration.foo=(value)
        +RSpec.configuration.foo
        +RSpec.configuration.foo? # returns true if foo returns anything but nil or false
        +
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +

          a customizable set of options

          +
          + +
        • + +
        + + + + + + +

        Options Hash (opts):

        +
          + +
        • + :default + (Symbol) + + + + + —

          set a default value for the generated getter and predicate methods:

          + +
          add_setting(:foo, :default => "default value")
          +
          +
          + +
        • + +
        • + :alias_with + (Symbol) + + + + + —

          Use :alias_with to alias the setter, getter, and predicate to another +name, or names:

          + +
          add_setting(:foo, :alias_with => :bar)
          +add_setting(:foo, :alias_with => [:bar, :baz])
          +
          +
          + +
        • + +
        + + + +
        + + + + +
        +
        +
        +
        +268
        +269
        +270
        +271
        +272
        +273
        +274
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 268
        +
        +def add_setting(name, opts={})
        +  default = opts.delete(:default)
        +  (class << self; self; end).class_eval do
        +    add_setting(name, opts)
        +  end
        +  send("#{name}=", default) if default
        +end
        +
        +
        + +
        +

        + + - (Object) alias_example_to(new_name, *args) + + + + + +

        +
        +

        Creates a method that delegates to example including the submitted +args. Used internally to add variants of example like pending:

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        alias_example_to :pending, :pending => true
        +
        +# This lets you do this:
        +
        +describe Thing do
        +  pending "does something" do
        +    thing = Thing.new
        +  end
        +end
        +
        +# ... which is the equivalent of
        +
        +describe Thing do
        +  it "does something", :pending => true do
        +    thing = Thing.new
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +636
        +637
        +638
        +639
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 636
        +
        +def alias_example_to(new_name, *args)
        +  extra_options = (args)
        +  RSpec::Core::ExampleGroup.alias_example_to(new_name, extra_options)
        +end
        +
        +
        + +
        +

        + + - (Object) alias_it_behaves_like_to(new_name, report_label = '') + + + + Also known as: + alias_it_should_behave_like_to + + + + +

        +
        +

        Define an alias for it_should_behave_like that allows different +language (like "it_has_behavior" or "it_behaves_like") to be +employed when including shared examples.

        + +

        Example:

        + +
        alias_it_behaves_like_to(:it_has_behavior, 'has behavior:')
        +
        + +

        allows the user to include a shared example group like:

        + +
        describe Entity do
        +  it_has_behavior 'sortability' do
        +    let(:sortable) { Entity.new }
        +  end
        +end
        +
        + +

        which is reported in the output as:

        + +
        Entity
        +  has behavior: sortability
        +    # sortability examples here
        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +662
        +663
        +664
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 662
        +
        +def alias_it_behaves_like_to(new_name, report_label = '')
        +  RSpec::Core::ExampleGroup.alias_it_behaves_like_to(new_name, report_label)
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_clean_patterns + + + + + +

        +
        +

        The patterns to discard from backtraces. Deprecated, use +Configuration#backtrace_exclusion_patterns instead

        + +

        Defaults to RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS

        + +

        One can replace the list by using the setter or modify it through the +getter

        + +

        To override this behaviour and display a full backtrace, use +--backtraceon the command line, in a .rspec file, or in the +rspec_options attribute of RSpec's rake task.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +298
        +299
        +300
        +301
        +302
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 298
        +
        +def backtrace_clean_patterns
        +  RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
        +                  :replacement => "RSpec::Core::Configuration#backtrace_exclusion_patterns")
        +  @backtrace_cleaner.exclusion_patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_clean_patterns=(patterns) + + + + + +

        + + + + +
        +
        +
        +
        +304
        +305
        +306
        +307
        +308
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 304
        +
        +def backtrace_clean_patterns=(patterns)
        +  RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
        +                  :replacement => "RSpec::Core::Configuration#backtrace_exclusion_patterns")
        +  @backtrace_cleaner.exclusion_patterns = patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_exclusion_patterns + + + + + +

        +
        +

        The patterns to discard from backtraces.

        + +

        Defaults to RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS

        + +

        One can replace the list by using the setter or modify it through the +getter

        + +

        To override this behaviour and display a full backtrace, use +--backtraceon the command line, in a .rspec file, or in the +rspec_options attribute of RSpec's rake task.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +335
        +336
        +337
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 335
        +
        +def backtrace_exclusion_patterns
        +  @backtrace_cleaner.exclusion_patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_exclusion_patterns=(patterns) + + + + + +

        + + + + +
        +
        +
        +
        +339
        +340
        +341
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 339
        +
        +def backtrace_exclusion_patterns=(patterns)
        +  @backtrace_cleaner.exclusion_patterns = patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_inclusion_patterns + + + + + +

        +
        +

        The patterns to always include to backtraces.

        + +

        Defaults to [Regexp.new Dir.getwd] if the current working directory +matches any of the exclusion patterns. Otherwise it defaults to empty.

        + +

        One can replace the list by using the setter or modify it through the +getter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +317
        +318
        +319
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 317
        +
        +def backtrace_inclusion_patterns
        +  @backtrace_cleaner.inclusion_patterns
        +end
        +
        +
        + +
        +

        + + - (Object) backtrace_inclusion_patterns=(patterns) + + + + + +

        + + + + +
        +
        +
        +
        +321
        +322
        +323
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 321
        +
        +def backtrace_inclusion_patterns=(patterns)
        +  @backtrace_cleaner.inclusion_patterns = patterns
        +end
        +
        +
        + +
        +

        + + - (Object) color(output = output_stream) + + + + Also known as: + color_enabled + + + + +

        + + + + +
        +
        +
        +
        +479
        +480
        +481
        +482
        +483
        +484
        +485
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 479
        +
        +def color(output=output_stream)
        +  # rspec's built-in formatters all call this with the output argument,
        +  # but defaulting to output_stream for backward compatibility with
        +  # formatters in extension libs
        +  return false unless output_to_tty?(output)
        +  value_for(:color, @color)
        +end
        +
        +
        + +
        +

        + + - (Object) color=(bool) + + + + Also known as: + color_enabled= + + + + +

        + + + + +
        +
        +
        +
        +487
        +488
        +489
        +490
        +491
        +492
        +493
        +494
        +495
        +496
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 487
        +
        +def color=(bool)
        +  if bool
        +    if RSpec.windows_os? and not ENV['ANSICON']
        +      warn "You must use ANSICON 1.31 or later (http://adoxa.3eeweb.com/ansicon/) to use colour on Windows"
        +      @color = false
        +    else
        +      @color = true
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) debug=(bool) + + + + + +

        + + + + +
        +
        +
        +
        +518
        +519
        +520
        +521
        +522
        +523
        +524
        +525
        +526
        +527
        +528
        +529
        +530
        +531
        +532
        +533
        +534
        +535
        +536
        +537
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 518
        +
        +def debug=(bool)
        +  return unless bool
        +  begin
        +    require 'ruby-debug'
        +    Debugger.start
        +  rescue LoadError => e
        +    raise <<-EOM
        +
        +#{'*'*50}
        +#{e.message}
        +
        +If you have it installed as a ruby gem, then you need to either require
        +'rubygems' or configure the RUBYOPT environment variable with the value
        +'rubygems'.
        +
        +#{e.backtrace.join("\n")}
        +#{'*'*50}
        +EOM
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) debug? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +539
        +540
        +541
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 539
        +
        +def debug?
        +  !!defined?(Debugger)
        +end
        +
        +
        + +
        +

        + + - (Object) exclusion_filter + + + + + +

        +
        +

        Returns the exclusion_filter. If none has been set, returns an empty +hash.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +774
        +775
        +776
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 774
        +
        +def exclusion_filter
        +  filter_manager.exclusions
        +end
        +
        +
        + +
        +

        + + - (Object) exclusion_filter=(filter) + + + + + +

        +
        +

        Clears and reassigns the exclusion_filter. Set to nil if you don't +want any exclusion filter at all.

        + +

        Warning

        + +

        This overrides any exclusion filters/tags set on the command line or in +configuration files.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +768
        +769
        +770
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 768
        +
        +def exclusion_filter=(filter)
        +  filter_manager.exclude! ([filter])
        +end
        +
        +
        + +
        +

        + + - (Object) expect_with(*frameworks) + + + + + +

        +
        +

        Sets the expectation framework module(s) to be included in each example +group.

        + +

        frameworks can be :rspec, :stdlib, a custom module, or any +combination thereof:

        + +
        config.expect_with :rspec
        +config.expect_with :stdlib
        +config.expect_with :rspec, :stdlib
        +config.expect_with OtherExpectationFramework
        +
        + +

        RSpec will translate :rspec and :stdlib into the appropriate +modules.

        + +

        Configuration

        + +

        If the module responds to configuration, expect_with will +yield the configuration object if given a block:

        + +
        config.expect_with OtherExpectationFramework do |custom_config|
        +  custom_config.custom_setting = true
        +end
        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +441
        +442
        +443
        +444
        +445
        +446
        +447
        +448
        +449
        +450
        +451
        +452
        +453
        +454
        +455
        +456
        +457
        +458
        +459
        +460
        +461
        +462
        +463
        +464
        +465
        +466
        +467
        +468
        +469
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 441
        +
        +def expect_with(*frameworks)
        +  modules = frameworks.map do |framework|
        +    case framework
        +    when Module
        +      framework
        +    when :rspec
        +      require 'rspec/expectations'
        +      self.expecting_with_rspec = true
        +      ::RSpec::Matchers
        +    when :stdlib
        +      require 'test/unit/assertions'
        +      ::Test::Unit::Assertions
        +    else
        +      raise ArgumentError, "#{framework.inspect} is not supported"
        +    end
        +  end
        +
        +  if (modules - @expectation_frameworks).any?
        +    assert_no_example_groups_defined(:expect_with)
        +  end
        +
        +  if block_given?
        +    raise "expect_with only accepts a block with a single argument. Call expect_with #{modules.length} times, once with each argument, instead." if modules.length > 1
        +    raise "#{modules.first} must respond to `configuration` so that expect_with can yield it." unless modules.first.respond_to?(:configuration)
        +    yield modules.first.configuration
        +  end
        +
        +  @expectation_frameworks.push(*modules)
        +end
        +
        +
        + +
        +

        + + - (Object) expectation_framework=(framework) + + + + + +

        +
        +

        Delegates to expect_with(framework)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +415
        +416
        +417
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 415
        +
        +def expectation_framework=(framework)
        +  expect_with(framework)
        +end
        +
        +
        + +
        +

        + + - (Object) expectation_frameworks + + + + + +

        +
        +

        Returns the configured expectation framework adapter module(s)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +409
        +410
        +411
        +412
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 409
        +
        +def expectation_frameworks
        +  expect_with :rspec if @expectation_frameworks.empty?
        +  @expectation_frameworks
        +end
        +
        +
        + +
        +

        + + - (Object) extend(mod, *filters) + + + + + +

        +
        +

        Tells RSpec to extend example groups with mod. Methods defined in +mod are exposed to example groups (not examples). Use filters to +constrain the groups to extend.

        + +

        Similar to include, but behavior is added to example groups, which +are classes, rather than the examples, which are instances of those +classes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module UiHelpers
        +  def run_in_browser
        +    # ...
        +  end
        +end
        +
        +RSpec.configure do |config|
        +  config.extend(UiHelpers, :type => :request)
        +end
        +
        +describe "edit profile", :type => :request do
        +  run_in_browser
        +
        +  it "does stuff in the client" do
        +    # ...
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +843
        +844
        +845
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 843
        +
        +def extend(mod, *filters)
        +  include_or_extend_modules << [:extend, mod, (filters)]
        +end
        +
        +
        + +
        +

        + + - (Object) filter_run_excluding(*args) + + + + + +

        +
        +

        Adds key/value pairs to the exclusion_filter. If the +treat_symbols_as_metadata_keys_with_true_values config option is set +to true and args excludes any symbols that are not part of a hash, +each symbol is treated as a key in the hash with the value true.

        + +

        Note

        + +

        Filters set using this method can be overridden from the command line +or config files (e.g. .rspec).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # given this declaration
        +describe "something", :foo => 'bar' do
        +  # ...
        +end
        +
        +# any of the following will exclude that group
        +config.filter_run_excluding :foo => 'bar'
        +config.filter_run_excluding :foo => /^ba/
        +config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
        +config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# given a proc with an arity of 1, the lambda is passed the value related to the key, e.g.
        +config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
        +
        +# given a proc with an arity of 2, the lambda is passed the value related to the key,
        +# and the metadata itself e.g.
        +config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# with treat_symbols_as_metadata_keys_with_true_values = true
        +filter_run_excluding :foo # same as filter_run_excluding :foo => true
        + +
        + + +
        + + + + +
        +
        +
        +
        +757
        +758
        +759
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 757
        +
        +def filter_run_excluding(*args)
        +  filter_manager.exclude_with_low_priority (args)
        +end
        +
        +
        + +
        +

        + + - (Object) filter_run_including(*args) + + + + Also known as: + filter_run + + + + +

        +
        +

        Adds key/value pairs to the inclusion_filter. If the +treat_symbols_as_metadata_keys_with_true_values config option is set +to true and args includes any symbols that are not part of a hash, +each symbol is treated as a key in the hash with the value true.

        + +

        Note

        + +

        Filters set using this method can be overridden from the command line +or config files (e.g. .rspec).

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # given this declaration
        +describe "something", :foo => 'bar' do
        +  # ...
        +end
        +
        +# any of the following will include that group
        +config.filter_run_including :foo => 'bar'
        +config.filter_run_including :foo => /^ba/
        +config.filter_run_including :foo => lambda {|v| v == 'bar'}
        +config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# given a proc with an arity of 1, the lambda is passed the value related to the key, e.g.
        +config.filter_run_including :foo => lambda {|v| v == 'bar'}
        +
        +# given a proc with an arity of 2, the lambda is passed the value related to the key,
        +# and the metadata itself e.g.
        +config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
        +
        +# with treat_symbols_as_metadata_keys_with_true_values = true
        +filter_run_including :foo # same as filter_run_including :foo => true
        + +
        + + +
        + + + + +
        +
        +
        +
        +699
        +700
        +701
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 699
        +
        +def filter_run_including(*args)
        +  filter_manager.include_with_low_priority (args)
        +end
        +
        +
        + +
        +

        + + - (Object) format_docstrings(&block) + + + + + +

        +
        +

        Formats the docstring output using the block provided.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        # This will strip the descriptions of both examples and example groups.
        +RSpec.configure do |config|
        +  config.format_docstrings { |s| s.strip }
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +910
        +911
        +912
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 910
        +
        +def format_docstrings(&block)
        +  @format_docstrings_block = block_given? ? block : DEFAULT_FORMATTER
        +end
        +
        +
        + +
        +

        + + - (Object) formatters + + + + + +

        + + + + +
        +
        +
        +
        +583
        +584
        +585
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 583
        +
        +def formatters
        +  @formatters ||= []
        +end
        +
        +
        + +
        +

        + + - (Object) full_backtrace=(true_or_false) + + + + + +

        + + + + +
        +
        +
        +
        +475
        +476
        +477
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 475
        +
        +def full_backtrace=(true_or_false)
        +  @backtrace_cleaner.full_backtrace = true_or_false
        +end
        +
        +
        + +
        +

        + + - (Boolean) full_backtrace? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +471
        +472
        +473
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 471
        +
        +def full_backtrace?
        +  @backtrace_cleaner.full_backtrace?
        +end
        +
        +
        + +
        +

        + + - (Object) full_description + + + + + +

        + + + + +
        +
        +
        +
        +556
        +557
        +558
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 556
        +
        +def full_description
        +  filter.fetch :full_description, nil
        +end
        +
        +
        + +
        +

        + + - (Object) full_description=(description) + + + + + +

        + + + + +
        +
        +
        +
        +552
        +553
        +554
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 552
        +
        +def full_description=(description)
        +  filter_run :full_description => Regexp.union(*Array(description).map {|d| Regexp.new(d) })
        +end
        +
        +
        + +
        +

        + + - (Object) include(mod, *filters) + + + + + +

        +
        +

        Tells RSpec to include mod in example groups. Methods defined in +mod are exposed to examples (not example groups). Use filters to +constrain the groups in which to include the module.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module AuthenticationHelpers
        +  def (user)
        +    # ...
        +  end
        +end
        +
        +module UserHelpers
        +  def users(username)
        +    # ...
        +  end
        +end
        +
        +RSpec.configure do |config|
        +  config.include(UserHelpers) # included in all modules
        +  config.include(AuthenticationHelpers, :type => :request)
        +end
        +
        +describe "edit profile", :type => :request do
        +  it "can be viewed by owning user" do
        +     users(:jdoe)
        +    get "/profiles/jdoe"
        +    assert_select ".username", :text => 'jdoe'
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +810
        +811
        +812
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 810
        +
        +def include(mod, *filters)
        +  include_or_extend_modules << [:include, mod, (filters)]
        +end
        +
        +
        + +
        +

        + + - (Object) inclusion_filter + + + + Also known as: + filter + + + + +

        +
        +

        Returns the inclusion_filter. If none has been set, returns an empty +hash.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +720
        +721
        +722
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 720
        +
        +def inclusion_filter
        +  filter_manager.inclusions
        +end
        +
        +
        + +
        +

        + + - (Object) inclusion_filter=(filter) + + + + Also known as: + filter= + + + + +

        +
        +

        Clears and reassigns the inclusion_filter. Set to nil if you don't +want any inclusion filter at all.

        + +

        Warning

        + +

        This overrides any inclusion filters/tags set on the command line or in +configuration files.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +712
        +713
        +714
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 712
        +
        +def inclusion_filter=(filter)
        +  filter_manager.include! ([filter])
        +end
        +
        +
        + +
        +

        + + - (Object) libs=(libs) + + + + + +

        + + + + +
        +
        +
        +
        +504
        +505
        +506
        +507
        +508
        +509
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 504
        +
        +def libs=(libs)
        +  libs.map do |lib|
        +    @libs.unshift lib
        +    $LOAD_PATH.unshift lib
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) line_numbers + + + + + +

        + + + + +
        +
        +
        +
        +548
        +549
        +550
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 548
        +
        +def line_numbers
        +  filter.fetch(:line_numbers,[])
        +end
        +
        +
        + +
        +

        + + - (Object) line_numbers=(line_numbers) + + + + + +

        +
        +

        Run examples defined on line_numbers in all files to run.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +544
        +545
        +546
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 544
        +
        +def line_numbers=(line_numbers)
        +  filter_run :line_numbers => line_numbers.map{|l| l.to_i}
        +end
        +
        +
        + +
        +

        + + - (Object) mock_framework + + + + + +

        +
        +

        Returns the configured mock framework adapter module

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +277
        +278
        +279
        +280
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 277
        +
        +def mock_framework
        +  mock_with :rspec unless @mock_framework
        +  @mock_framework
        +end
        +
        +
        + +
        +

        + + - (Object) mock_framework=(framework) + + + + + +

        +
        +

        Delegates to mock_framework=(framework)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +283
        +284
        +285
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 283
        +
        +def mock_framework=(framework)
        +  mock_with framework
        +end
        +
        +
        + +
        +

        + + - (Object) mock_with(framework) + + + + + +

        +
        +

        Sets the mock framework adapter module.

        + +

        framework can be a Symbol or a Module.

        + +

        Given any of :rspec, :mocha, :flexmock, or :rr, configures the +named framework.

        + +

        Given :nothing, configures no framework. Use this if you don't use +any mocking framework to save a little bit of overhead.

        + +

        Given a Module, includes that module in every example group. The module +should adhere to RSpec's mock framework adapter API:

        + +
        setup_mocks_for_rspec
        +  - called before each example
        +
        +verify_mocks_for_rspec
        +  - called after each example. Framework should raise an exception
        +    when expectations fail
        +
        +teardown_mocks_for_rspec
        +  - called after verify_mocks_for_rspec (even if there are errors)
        +
        + +

        If the module responds to configuration and mock_with receives a block, +it will yield the configuration object to the block e.g.

        + +
        config.mock_with OtherMockFrameworkAdapter do |mod_config|
        +  mod_config.custom_setting = true
        +end
        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +372
        +373
        +374
        +375
        +376
        +377
        +378
        +379
        +380
        +381
        +382
        +383
        +384
        +385
        +386
        +387
        +388
        +389
        +390
        +391
        +392
        +393
        +394
        +395
        +396
        +397
        +398
        +399
        +400
        +401
        +402
        +403
        +404
        +405
        +406
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 372
        +
        +def mock_with(framework)
        +  framework_module = case framework
        +  when Module
        +    framework
        +  when String, Symbol
        +    require case framework.to_s
        +            when /rspec/i
        +              'rspec/core/mocking/with_rspec'
        +            when /mocha/i
        +              'rspec/core/mocking/with_mocha'
        +            when /rr/i
        +              'rspec/core/mocking/with_rr'
        +            when /flexmock/i
        +              'rspec/core/mocking/with_flexmock'
        +            else
        +              'rspec/core/mocking/with_absolutely_nothing'
        +            end
        +    RSpec::Core::MockFrameworkAdapter
        +  end
        +
        +  new_name, old_name = [framework_module, @mock_framework].map do |mod|
        +    mod.respond_to?(:framework_name) ?  mod.framework_name : :unnamed
        +  end
        +
        +  unless new_name == old_name
        +    assert_no_example_groups_defined(:mock_framework)
        +  end
        +
        +  if block_given?
        +    raise "#{framework_module} must respond to `configuration` so that mock_with can yield it." unless framework_module.respond_to?(:configuration)
        +    yield framework_module.configuration
        +  end
        +
        +  @mock_framework = framework_module
        +end
        +
        +
        + +
        +

        + + - (Object) order=(type) + + + + + +

        +
        +

        Sets the order and, if order is 'rand:<seed>', also sets the seed.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +929
        +930
        +931
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 929
        +
        +def order=(type)
        +  order_and_seed_from_order(type)
        +end
        +
        +
        + +
        +

        + + - (Object) order_examples(&block) + + + + + +

        +
        +

        Sets a strategy by which to order examples.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.order_examples do |examples|
        +    examples.reverse
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +961
        +962
        +963
        +964
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 961
        +
        +def order_examples(&block)
        +  @example_ordering_block = block
        +  @order = "custom" unless built_in_orderer?(block)
        +end
        +
        +
        + +
        +

        + + - (Object) order_groups(&block) + + + + + +

        +
        +

        Sets a strategy by which to order groups.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.order_groups do |groups|
        +    groups.reverse
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +984
        +985
        +986
        +987
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 984
        +
        +def order_groups(&block)
        +  @group_ordering_block = block
        +  @order = "custom" unless built_in_orderer?(block)
        +end
        +
        +
        + +
        +

        + + - (Object) order_groups_and_examples(&block) + + + + + +

        +
        +

        Sets a strategy by which to order groups and examples.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |config|
        +  config.order_groups_and_examples do |groups_or_examples|
        +    groups_or_examples.reverse
        +  end
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +1007
        +1008
        +1009
        +1010
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1007
        +
        +def order_groups_and_examples(&block)
        +  order_groups(&block)
        +  order_examples(&block)
        +end
        +
        +
        + +
        +

        + + - (Object) profile_examples + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Defaults profile_examples to 10 examples when @profile_examples is true.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +599
        +600
        +601
        +602
        +603
        +604
        +605
        +606
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 599
        +
        +def profile_examples
        +  profile = value_for(:profile_examples, @profile_examples)
        +  if profile && !profile.is_a?(Integer)
        +    10
        +  else
        +    profile
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) randomize? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +933
        +934
        +935
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 933
        +
        +def randomize?
        +  order.to_s.match(/rand/)
        +end
        +
        +
        + +
        +

        + + - (Object) reporter + + + + + +

        + + + + +
        +
        +
        +
        +587
        +588
        +589
        +590
        +591
        +592
        +593
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 587
        +
        +def reporter
        +  @reporter ||= begin
        +                  add_formatter('progress') if formatters.empty?
        +                  add_formatter(RSpec::Core::Formatters::DeprecationFormatter, deprecation_stream, output_stream)
        +                  Reporter.new(*formatters)
        +                end
        +end
        +
        +
        + +
        +

        + + - (Object) requires=(paths) + + + + + +

        + + + + +
        +
        +
        +
        +511
        +512
        +513
        +514
        +515
        +516
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 511
        +
        +def requires=(paths)
        +  RSpec.deprecate("RSpec::Core::Configuration#requires=(paths)",
        +                  :replacement => "paths.each {|path| require path}")
        +  paths.map {|path| require path}
        +  @requires += paths
        +end
        +
        +
        + +
        +

        + + - (Object) safe_extend(mod, host) + + + + + +

        + + + + +
        +
        +
        +
        +873
        +874
        +875
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 873
        +
        +def safe_extend(mod, host)
        +  host.extend(mod) unless (class << host; self; end) < mod
        +end
        +
        +
        + +
        +

        + + - (Object) seed=(seed) + + + + + +

        +
        +

        Sets the seed value and sets order='rand'

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +922
        +923
        +924
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 922
        +
        +def seed=(seed)
        +  order_and_seed_from_seed(seed)
        +end
        +
        +
        + +
        +

        + + - (Object) warnings + + + + + +

        + + + + +
        +
        +
        +
        +1017
        +1018
        +1019
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1017
        +
        +def warnings
        +  $VERBOSE
        +end
        +
        +
        + +
        +

        + + - (Object) warnings=(value) + + + + + +

        +
        +

        Set Ruby warnings on or off

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +1013
        +1014
        +1015
        +
        +
        # File 'lib/rspec/core/configuration.rb', line 1013
        +
        +def warnings= value
        +  $VERBOSE = !!value
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Configuration/MustBeConfiguredBeforeExampleGroupsError.html b/source/documentation/2.14/rspec-core/RSpec/Core/Configuration/MustBeConfiguredBeforeExampleGroupsError.html new file mode 100644 index 000000000..5e64aa6be --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Configuration/MustBeConfiguredBeforeExampleGroupsError.html @@ -0,0 +1,123 @@ + + + + + + Exception: RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Exception: RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError + + + +

        + +
        + +
        Inherits:
        +
        + StandardError + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/configuration.rb
        + +
        +
        + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/DRbCommandLine.html b/source/documentation/2.14/rspec-core/RSpec/Core/DRbCommandLine.html new file mode 100644 index 000000000..c776e87ca --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/DRbCommandLine.html @@ -0,0 +1,322 @@ + + + + + + Class: RSpec::Core::DRbCommandLine + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::DRbCommandLine + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/drb_command_line.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (DRbCommandLine) initialize(options) + + + + + +

        +
        +

        Returns a new instance of DRbCommandLine

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/drb_command_line.rb', line 7
        +
        +def initialize(options)
        +  @options = options
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) drb_port + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/core/drb_command_line.rb', line 11
        +
        +def drb_port
        +  @options.options[:drb_port] || ENV['RSPEC_DRB'] || 8989
        +end
        +
        +
        + +
        +

        + + - (Object) run(err, out) + + + + + +

        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/core/drb_command_line.rb', line 15
        +
        +def run(err, out)
        +  begin
        +    DRb.start_service("druby://localhost:0")
        +  rescue SocketError, Errno::EADDRNOTAVAIL
        +    DRb.start_service("druby://:0")
        +  end
        +  spec_server = DRbObject.new_with_uri("druby://127.0.0.1:#{drb_port}")
        +  spec_server.run(@options.drb_argv, err, out)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/DSL.html b/source/documentation/2.14/rspec-core/RSpec/Core/DSL.html new file mode 100644 index 000000000..13238226a --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/DSL.html @@ -0,0 +1,213 @@ + + + + + + Module: RSpec::Core::DSL + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::DSL + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/dsl.rb
        + +
        +
        + +

        Overview

        +
        +

        Adds the describe method to the top-level namespace.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) describe(*args, &example_group_block) + + + + + +

        +
        +

        Generates a subclass of ExampleGroup

        + +

        Examples:

        + +
        describe "something" do
        +  it "does something" do
        +    # example code goes here
        +  end
        +end
        +
        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/dsl.rb', line 17
        +
        +def describe(*args, &example_group_block)
        +  RSpec::Core::ExampleGroup.describe(*args, &example_group_block).register
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Deprecation.html b/source/documentation/2.14/rspec-core/RSpec/Core/Deprecation.html new file mode 100644 index 000000000..a8b194c37 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Deprecation.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Core::Deprecation + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Deprecation + + + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec
        + + + +
        Defined in:
        +
        lib/rspec/core/deprecation.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Example.html b/source/documentation/2.14/rspec-core/RSpec/Core/Example.html new file mode 100644 index 000000000..ede1b681e --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Example.html @@ -0,0 +1,928 @@ + + + + + + Class: RSpec::Core::Example + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Example + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example.rb
        + +
        +
        + +

        Overview

        +
        +

        Wrapper for an instance of a subclass of ExampleGroup. An instance of +Example is returned by the example method +exposed to examples, before and after hooks, +and yielded to around hooks.

        + +

        Useful for configuring logging and/or taking some action based +on the state of an example's metadata.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |config|
        +  config.before do
        +    log example.description
        +  end
        +
        +  config.after do
        +    log example.description
        +  end
        +
        +  config.around do |ex|
        +    log example.description
        +    ex.run
        +  end
        +end
        +
        +shared_examples "auditable" do
        +  it "does something" do
        +    log "#{example.full_description}: #{auditable.inspect}"
        +    auditable.should do_something
        +  end
        +end
        + +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + Modules: Procsy + + + + +

        + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) exception + + + + + + + + + readonly + + + + + + + + + +

          Returns the first exception raised in the context of running this example (nil if no exception is raised).

          +
          + +
        • + + +
        • + + + - (Object) metadata + + + + + + + + + readonly + + + + + + + + + +

          Returns the metadata object associated with this example.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Example) initialize(example_group_class, description, metadata, example_block = nil) + + + + + +

        +
        +

        Creates a new instance of Example.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group_class + + + + + + + — +

          the subclass of ExampleGroup in which this Example is declared

          +
          + +
        • + +
        • + + description + + + + + + + — +

          the String passed to the it method (or alias)

          +
          + +
        • + +
        • + + metadata + + + + + + + — +

          additional args passed to it to be used as metadata

          +
          + +
        • + +
        • + + example_block + + + + + + (defaults to: nil) + + + — +

          the block of code that represents the example

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core/example.rb', line 79
        +
        +def initialize(example_group_class, description, , example_block=nil)
        +  @example_group_class, @options, @example_block = example_group_class, , example_block
        +  @metadata  = @example_group_class..for_example(description, )
        +  @example_group_instance = @exception = nil
        +  @pending_declared_in_example = false
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) exception (readonly) + + + + + +

        +
        +

        Returns the first exception raised in the context of running this +example (nil if no exception is raised)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/example.rb', line 60
        +
        +def exception
        +  @exception
        +end
        +
        +
        + + + +
        +

        + + - (Object) metadata (readonly) + + + + + +

        +
        +

        Returns the metadata object associated with this example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/core/example.rb', line 65
        +
        +def 
        +  @metadata
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) procsy(metadata, &proc) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Wraps the example block in a Proc so it can invoked using run or +call in around hooks.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +146
        +147
        +148
        +
        +
        # File 'lib/rspec/core/example.rb', line 146
        +
        +def self.procsy(, &proc)
        +  proc.extend(Procsy).with()
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        +
        +

        Returns the string submitted to example or its aliases (e.g. +specify, it, etc). If no string is submitted (e.g. it { should +do_something }) it returns the message generated by the matcher if +there is one, otherwise returns a message including the location of the +example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +54
        +
        +
        # File 'lib/rspec/core/example.rb', line 51
        +
        +def description
        +  description = [:description].to_s.empty? ? "example at #{location}" : [:description]
        +  RSpec.configuration.format_docstrings_block.call(description)
        +end
        +
        +
        + +
        +

        + + - (Object) example_group + + + + + +

        +
        +

        Returns the example group class that provides the context for running +this example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +93
        +94
        +95
        +
        +
        # File 'lib/rspec/core/example.rb', line 93
        +
        +def example_group
        +  @example_group_class
        +end
        +
        +
        + +
        +

        + + - (Object) options + + + + + +

        +
        +
        Deprecated.

        access options via metadata instead

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/core/example.rb', line 87
        +
        +def options
        +  @options
        +end
        +
        +
        + +
        +

        + + - (Object) run(example_group_instance, reporter) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        instance_evals the block passed to the constructor in the context of +the instance of RSpec::Core::ExampleGroup.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group_instance + + + + + + + — +

          the instance of an ExampleGroup subclass

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +140
        +
        +
        # File 'lib/rspec/core/example.rb', line 103
        +
        +def run(example_group_instance, reporter)
        +  @example_group_instance = example_group_instance
        +  @example_group_instance.example = self
        +
        +  start(reporter)
        +
        +  begin
        +    unless pending
        +      with_around_each_hooks do
        +        begin
        +          run_before_each
        +          @example_group_instance.instance_eval(&@example_block)
        +        rescue Pending::PendingDeclaredInExample => e
        +          @pending_declared_in_example = e.message
        +        rescue Exception => e
        +          set_exception(e)
        +        ensure
        +          run_after_each
        +        end
        +      end
        +    end
        +  rescue Exception => e
        +    set_exception(e)
        +  ensure
        +    @example_group_instance.instance_variables.each do |ivar|
        +      @example_group_instance.instance_variable_set(ivar, nil)
        +    end
        +    @example_group_instance = nil
        +
        +    begin
        +      assign_generated_description
        +    rescue Exception => e
        +      set_exception(e, "while assigning the example description")
        +    end
        +  end
        +
        +  finish(reporter)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Example/Procsy.html b/source/documentation/2.14/rspec-core/RSpec/Core/Example/Procsy.html new file mode 100644 index 000000000..5d863d91e --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Example/Procsy.html @@ -0,0 +1,408 @@ + + + + + + Module: RSpec::Core::Example::Procsy + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Example::Procsy + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/example.rb
        + +
        +
        + +

        Overview

        +
        + +
        + Note: +

        Procsy, itself, is not a public API, but we're documenting it +here to document how to interact with the object yielded to an +around hook.

        +
        +
        + +

        Used to extend a Proc with behavior that makes it look something like +an RSpec::Core::Example in an around hook.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |c|
        +  c.around do |ex| # ex is a Proc extended with Procsy
        +    if ex.[:key] == :some_value && some_global_condition
        +      raise "some message"
        +    end
        +    ex.run         # run delegates to ex.call
        +  end
        +end
        + +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (Object) extended(proc) + + + + + + + + + + + private + + +

          Adds a run method to the extended Proc, allowing it to be invoked in an around hook using either run or call.

          +
          + +
        • + + +
        + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) metadata (readonly) + + + + + +

        +
        +

        The metadata of the RSpec::Core::Example instance.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +
        +
        # File 'lib/rspec/core/example.rb', line 169
        +
        +def 
        +  @metadata
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) extended(proc) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Adds a run method to the extended Proc, allowing it to be invoked +in an around hook using either +run or call.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + + + + (Proc) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +176
        +177
        +178
        +179
        +180
        +
        +
        # File 'lib/rspec/core/example.rb', line 176
        +
        +def self.extended(proc)
        +  # @api public
        +  # Foo bar
        +  def proc.run; call; end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) with(metadata) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +183
        +184
        +185
        +186
        +
        +
        # File 'lib/rspec/core/example.rb', line 183
        +
        +def with()
        +  @metadata = 
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/ExampleGroup.html b/source/documentation/2.14/rspec-core/RSpec/Core/ExampleGroup.html new file mode 100644 index 000000000..079d20134 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/ExampleGroup.html @@ -0,0 +1,2237 @@ + + + + + + Class: RSpec::Core::ExampleGroup + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::ExampleGroup + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        Hooks, SharedExampleGroup
        + + + + +
        Includes:
        +
        MemoizedHelpers, Pending, SharedExampleGroup
        + + + + + +
        Defined in:
        +
        lib/rspec/core/example_group.rb
        + +
        +
        + +

        Overview

        +
        +

        ExampleGroup and Example are the main structural elements of +rspec-core. Consider this example:

        + +
        describe Thing do
        +  it "does something" do
        +  end
        +end
        +
        + +

        The object returned by describe Thing is a subclass of ExampleGroup. +The object returned by it "does something" is an instance of Example, +which serves as a wrapper for an instance of the ExampleGroup in which it +is declared.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Pending

        +

        Pending::NOT_YET_IMPLEMENTED, Pending::NO_REASON_GIVEN

        + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) example + + + + + + + + + + + + + + + + +

          Returns the Example object that wraps this instance of ExampleGroup.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (Object) alias_example_to(name, extra = {}) + + + + + + + + + + + + + +

          Works like alias_method :name, :example with the added benefit of assigning default metadata to the generated example.

          +
          + +
        • + + +
        • + + + + (Object) alias_it_behaves_like_to(name, *args, &block) + + + + + + + + + + + + + +

          Works like alias_method :name, :it_behaves_like with the added benefit of assigning default metadata to the generated example.

          +
          + +
        • + + +
        • + + + + (Object) describe(*args, &example_group_block) + + + + (also: context) + + + + + + + + + + + +

          Generates a subclass of this example group which inherits everything except the examples themselves.

          +
          + +
        • + + +
        • + + + + (Object) description + + + + (also: display_name) + + + + + + + + + + + +
          + +
        • + + +
        • + + + + (Object) example + + + + + + + + + + + + + +

          Defines an example within a group.

          +
          + +
        • + + +
        • + + + + (Object) fit + + + + + + + + + + + + + +

          Shortcut to define an example with :focus => true.

          +
          + +
        • + + +
        • + + + + (Object) focus + + + + + + + + + + + + + +

          Shortcut to define an example with :focus => true.

          +
          + +
        • + + +
        • + + + + (Object) focused + + + + + + + + + + + + + +

          Shortcut to define an example with :focus => true.

          +
          + +
        • + + +
        • + + + + (Object) include_context(name, *args, &block) + + + + + + + + + + + + + +

          Includes shared content mapped to name directly in the group in which it is declared, as opposed to it_behaves_like, which creates a nested group.

          +
          + +
        • + + +
        • + + + + (Object) include_examples(name, *args, &block) + + + + + + + + + + + + + +

          Includes shared content mapped to name directly in the group in which it is declared, as opposed to it_behaves_like, which creates a nested group.

          +
          + +
        • + + +
        • + + + + (Object) it + + + + + + + + + + + + + +

          Defines an example within a group.

          +
          + +
        • + + +
        • + + + + (Object) it_behaves_like + + + + + + + + + + + + + +

          Generates a nested example group and includes the shared content mapped to name in the nested group.

          +
          + +
        • + + +
        • + + + + (Object) it_should_behave_like + + + + + + + + + + + + + +

          Generates a nested example group and includes the shared content mapped to name in the nested group.

          +
          + +
        • + + +
        • + + + + (Object) metadata + + + + + + + + + + + + + +

          The Metadata object associated with this group.

          +
          + +
        • + + +
        • + + + + (Object) pending + + + + + + + + + + + + + +

          Shortcut to define an example with :pending => true.

          +
          + +
        • + + +
        • + + + + (Object) run(reporter) + + + + + + + + + + + + + +

          Runs all the examples in this group.

          +
          + +
        • + + +
        • + + + + (Object) specify + + + + + + + + + + + + + +

          Defines an example within a group.

          +
          + +
        • + + +
        • + + + + (Object) xexample + + + + + + + + + + + + + +

          Shortcut to define an example with :pending => 'Temporarily disabled with xexample'.

          +
          + +
        • + + +
        • + + + + (Object) xit + + + + + + + + + + + + + +

          Shortcut to define an example with :pending => 'Temporarily disabled with xit'.

          +
          + +
        • + + +
        • + + + + (Object) xspecify + + + + + + + + + + + + + +

          Shortcut to define an example with :pending => 'Temporarily disabled with xspecify'.

          +
          + +
        • + + +
        + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from SharedExampleGroup

        +

        registry, share_as, shared_example_groups, shared_examples

        + + + + + + + + + +

        Methods included from Hooks

        +

        after, append_after, around, before, prepend_before

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

        Methods included from Pending

        +

        #pending

        + + + + + + + + + +

        Methods included from MemoizedHelpers

        +

        #should, #should_not, #subject

        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) example + + + + + +

        +
        +

        Returns the RSpec::Core::Example object that wraps this instance of +ExampleGroup

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +443
        +444
        +445
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 443
        +
        +def example
        +  @example
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) alias_example_to(name, extra = {}) + + + + + +

        +
        + +
        + Note: +

        Use with caution. This extends the language used in your +specs, but does not add any additional documentation. We use this +in rspec to define methods like focus and xit, but we also add +docs for those methods.

        +
        +
        + +

        Works like alias_method :name, :example with the added benefit of +assigning default metadata to the generated example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +109
        +110
        +111
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 109
        +
        +def alias_example_to name, extra={}
        +  (class << self; self; end).define_example_method name, extra
        +end
        +
        +
        + +
        +

        + + + (Object) alias_it_behaves_like_to(name, *args, &block) + + + + + +

        +
        + +
        + Note: +

        Use with caution. This extends the language used in your +specs, but does not add any additional documentation. We use this +in rspec to define it_should_behave_like (for backward +compatibility), but we also add docs for that method.

        +
        +
        + +

        Works like alias_method :name, :it_behaves_like with the added +benefit of assigning default metadata to the generated example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +143
        +144
        +145
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 143
        +
        +def alias_it_behaves_like_to name, *args, &block
        +  (class << self; self; end).define_nested_shared_group_method name, *args, &block
        +end
        +
        +
        + +
        +

        + + + (Object) describe(*args, &example_group_block) + + + + Also known as: + context + + + + +

        +
        +

        Generates a subclass of this example group which inherits +everything except the examples themselves.

        + +

        Examples

        + +
        describe "something" do # << This describe method is defined in
        +                        # << RSpec::Core::DSL, included in the
        +                        # << global namespace
        +  before do
        +    do_something_before
        +  end
        +
        +  let(:thing) { Thing.new }
        +
        +  describe "attribute (of something)" do
        +    # examples in the group get the before hook
        +    # declared above, and can access `thing`
        +  end
        +end
        +
        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +223
        +224
        +225
        +226
        +227
        +228
        +229
        +230
        +231
        +232
        +233
        +234
        +235
        +236
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 223
        +
        +def self.describe(*args, &example_group_block)
        +  @_subclass_count ||= 0
        +  @_subclass_count += 1
        +  args << {} unless args.last.is_a?(Hash)
        +  args.last.update(:example_group_block => example_group_block)
        +
        +  # TODO 2010-05-05: Because we don't know if const_set is thread-safe
        +  child = const_set(
        +    "Nested_#{@_subclass_count}",
        +    subclass(self, args, &example_group_block)
        +  )
        +  children << child
        +  child
        +end
        +
        +
        + +
        +

        + + + (Object) description + + + + Also known as: + display_name + + + + +

        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 46
        +
        +def description
        +  description = [:example_group][:description]
        +  RSpec.configuration.format_docstrings_block.call(description)
        +end
        +
        +
        + +
        +

        + + + (Object) example + + + + + +

        +
        +

        Defines an example within a group.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +74
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 74
        +
        +define_example_method :example
        +
        +
        + +
        +

        + + + (Object) fit + + + + + +

        +
        +

        Shortcut to define an example with :focus => true

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +91
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 91
        +
        +define_example_method :fit,     :focused => true, :focus => true
        +
        +
        + +
        +

        + + + (Object) focus + + + + + +

        +
        +

        Shortcut to define an example with :focus => true

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +86
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 86
        +
        +define_example_method :focus,   :focused => true, :focus => true
        +
        +
        + +
        +

        + + + (Object) focused + + + + + +

        +
        +

        Shortcut to define an example with :focus => true

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +88
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 88
        +
        +define_example_method :focused, :focused => true, :focus => true
        +
        +
        + +
        +

        + + + (Object) include_context(name, *args, &block) + + + + + +

        +
        +

        Includes shared content mapped to name directly in the group in which +it is declared, as opposed to it_behaves_like, which creates a nested +group. If given a block, that block is also eval'd in the current context.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +153
        +154
        +155
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 153
        +
        +def self.include_context(name, *args, &block)
        +  find_and_eval_shared("context", name, *args, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) include_examples(name, *args, &block) + + + + + +

        +
        +

        Includes shared content mapped to name directly in the group in which +it is declared, as opposed to it_behaves_like, which creates a nested +group. If given a block, that block is also eval'd in the current context.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +162
        +163
        +164
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 162
        +
        +def self.include_examples(name, *args, &block)
        +  find_and_eval_shared("examples", name, *args, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) it + + + + + +

        +
        +

        Defines an example within a group.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +78
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 78
        +
        +define_example_method :it
        +
        +
        + +
        +

        + + + (Object) it_behaves_like + + + + + +

        +
        +

        Generates a nested example group and includes the shared content +mapped to name in the nested group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +131
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 131
        +
        +define_nested_shared_group_method :it_behaves_like, "behaves like"
        +
        +
        + +
        +

        + + + (Object) it_should_behave_like + + + + + +

        +
        +

        Generates a nested example group and includes the shared content +mapped to name in the nested group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +134
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 134
        +
        +define_nested_shared_group_method :it_should_behave_like
        +
        +
        + +
        +

        + + + (Object) metadata + + + + + +

        +
        +

        The Metadata object associated with this group.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +192
        +193
        +194
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 192
        +
        +def self.
        +  @metadata if defined?(@metadata)
        +end
        +
        +
        + +
        +

        + + + (Object) pending + + + + + +

        +
        +

        Shortcut to define an example with :pending => true

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +94
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 94
        +
        +define_example_method :pending,  :pending => true
        +
        +
        + +
        +

        + + + (Object) run(reporter) + + + + + +

        +
        +

        Runs all the examples in this group

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +362
        +363
        +364
        +365
        +366
        +367
        +368
        +369
        +370
        +371
        +372
        +373
        +374
        +375
        +376
        +377
        +378
        +379
        +380
        +381
        +382
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 362
        +
        +def self.run(reporter)
        +  if RSpec.wants_to_quit
        +    RSpec.clear_remaining_example_groups if top_level?
        +    return
        +  end
        +  reporter.example_group_started(self)
        +
        +  begin
        +    run_before_all_hooks(new)
        +    result_for_this_group = run_examples(reporter)
        +    results_for_descendants = children.ordered.map {|child| child.run(reporter)}.all?
        +    result_for_this_group && results_for_descendants
        +  rescue Exception => ex
        +    RSpec.wants_to_quit = true if fail_fast?
        +    fail_filtered_examples(ex, reporter)
        +  ensure
        +    run_after_all_hooks(new)
        +    before_all_ivars.clear
        +    reporter.example_group_finished(self)
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) specify + + + + + +

        +
        +

        Defines an example within a group. +This is here primarily for backward compatibility with early versions +of RSpec which used context and specify instead of describe and +it.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +83
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 83
        +
        +define_example_method :specify
        +
        +
        + +
        +

        + + + (Object) xexample + + + + + +

        +
        +

        Shortcut to define an example with :pending => 'Temporarily disabled with xexample'

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +96
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 96
        +
        +define_example_method :xexample, :pending => 'Temporarily disabled with xexample'
        +
        +
        + +
        +

        + + + (Object) xit + + + + + +

        +
        +

        Shortcut to define an example with :pending => 'Temporarily disabled with xit'

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +98
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 98
        +
        +define_example_method :xit,      :pending => 'Temporarily disabled with xit'
        +
        +
        + +
        +

        + + + (Object) xspecify + + + + + +

        +
        +

        Shortcut to define an example with :pending => 'Temporarily disabled with xspecify'

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + +
        • + +
        • + + extra_options + + + (Hash) + + + +
        • + +
        • + + implementation + + + (Block) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +100
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 100
        +
        +define_example_method :xspecify, :pending => 'Temporarily disabled with xspecify'
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) described_class + + + + + +

        +
        +

        Returns the class or module passed to the describe method (or alias). +Returns nil if the subject is not a class or module.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        describe Thing do
        +  it "does something" do
        +    described_class == Thing
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +462
        +463
        +464
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 462
        +
        +def described_class
        +  self.class.described_class
        +end
        +
        +
        + +
        +

        + + - (Object) running_example + + + + + +

        +
        +
        Deprecated.

        use #example

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +446
        +447
        +448
        +449
        +450
        +
        +
        # File 'lib/rspec/core/example_group.rb', line 446
        +
        +def running_example
        +  RSpec.deprecate("running_example",
        +                  :replacement => "example")
        +  example
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager.html b/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager.html new file mode 100644 index 000000000..400e6f083 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager.html @@ -0,0 +1,1128 @@ + + + + + + Class: RSpec::Core::FilterManager + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::FilterManager + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/filter_manager.rb
        + +
        +
        + +

        Overview

        +
        +

        Manages the filtering of examples and groups by matching tags declared on +the command line or options files, or filters declared via +RSpec.configure, with hash key/values submitted within example group +and/or example declarations. For example, given this declaration:

        + +
        describe Thing, :awesome => true do
        +  it "does something" do
        +    # ...
        +  end
        +end
        +
        + +

        That group (or any other with :awesome => true) would be filtered in +with any of the following commands:

        + +
        rspec --tag awesome:true
        +rspec --tag awesome
        +rspec -t awesome:true
        +rspec -t awesome
        +
        + +

        Prefixing the tag names with ~ negates the tags, thus excluding this group with +any of:

        + +
        rspec --tag ~awesome:true
        +rspec --tag ~awesome
        +rspec -t ~awesome:true
        +rspec -t ~awesome
        +
        + +

        Options files and command line overrides

        + +

        Tag declarations can be stored in .rspec, ~/.rspec, or a custom +options file. This is useful for storing defaults. For example, let's +say you've got some slow specs that you want to suppress most of the +time. You can tag them like this:

        + +
        describe Something, :slow => true do
        +
        + +

        And then store this in .rspec:

        + +
        --tag ~slow:true
        +
        + +

        Now when you run rspec, that group will be excluded.

        + +

        Overriding

        + +

        Of course, you probably want to run them sometimes, so you can override +this tag on the command line like this:

        + +
        rspec --tag slow:true
        +
        + +

        RSpec.configure

        + +

        You can also store default tags with RSpec.configure. We use tag on +the command line (and in options files like .rspec), but for historical +reasons we use the term filter in `RSpec.configure:

        + +
        RSpec.configure do |c|
        +  c.filter_run_including :foo => :bar
        +  c.filter_run_excluding :foo => :bar
        +end
        +
        + +

        These declarations can also be overridden from the command line.

        + + +
        +
        +

        Defined Under Namespace

        +

        + + + Modules: BackwardCompatibility, Describable + + + + +

        + +

        Constant Summary

        + +
        + +
        DEFAULT_EXCLUSIONS = + +
        +
        {
        +  :if     => lambda { |value| !value },
        +  :unless => lambda { |value| value }
        +}
        + +
        STANDALONE_FILTERS = + +
        +
        [:locations, :line_numbers, :full_description]
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) exclusions + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute exclusions.

          +
          + +
        • + + +
        • + + + - (Object) inclusions + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute inclusions.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (FilterManager) initialize + + + + + +

        +
        +

        Returns a new instance of FilterManager

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +117
        +118
        +119
        +120
        +121
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 117
        +
        +def initialize
        +  @exclusions = DEFAULT_EXCLUSIONS.dup.extend(Describable)
        +  @inclusions = {}.extend(Describable)
        +  extend(BackwardCompatibility)
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) exclusions (readonly) + + + + + +

        +
        +

        Returns the value of attribute exclusions

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +115
        +116
        +117
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 115
        +
        +def exclusions
        +  @exclusions
        +end
        +
        +
        + + + +
        +

        + + - (Object) inclusions (readonly) + + + + + +

        +
        +

        Returns the value of attribute inclusions

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +115
        +116
        +117
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 115
        +
        +def inclusions
        +  @inclusions
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_location(file_path, line_numbers) + + + + + +

        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 123
        +
        +def add_location(file_path, line_numbers)
        +  # locations is a hash of expanded paths to arrays of line
        +  # numbers to match against. e.g.
        +  #   { "path/to/file.rb" => [37, 42] }
        +  locations = @inclusions.delete(:locations) || Hash.new {|h,k| h[k] = []}
        +  locations[File.expand_path(file_path)].push(*line_numbers)
        +  @inclusions.replace(:locations => locations)
        +  @exclusions.clear
        +end
        +
        +
        + +
        +

        + + - (Boolean) empty? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +133
        +134
        +135
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 133
        +
        +def empty?
        +  inclusions.empty? && exclusions.empty_without_conditional_filters?
        +end
        +
        +
        + +
        +

        + + - (Object) exclude(*args) + + + + + +

        + + + + +
        +
        +
        +
        +141
        +142
        +143
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 141
        +
        +def exclude(*args)
        +  merge(@exclusions, @inclusions, *args)
        +end
        +
        +
        + +
        +

        + + - (Object) exclude!(*args) + + + + + +

        + + + + +
        +
        +
        +
        +145
        +146
        +147
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 145
        +
        +def exclude!(*args)
        +  replace(@exclusions, @inclusions, *args)
        +end
        +
        +
        + +
        +

        + + - (Boolean) exclude?(example) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +153
        +154
        +155
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 153
        +
        +def exclude?(example)
        +  @exclusions.empty? ? false : example.any_apply?(@exclusions)
        +end
        +
        +
        + +
        +

        + + - (Object) exclude_with_low_priority(*args) + + + + + +

        + + + + +
        +
        +
        +
        +149
        +150
        +151
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 149
        +
        +def exclude_with_low_priority(*args)
        +  reverse_merge(@exclusions, @inclusions, *args)
        +end
        +
        +
        + +
        +

        + + - (Object) include(*args) + + + + + +

        + + + + +
        +
        +
        +
        +157
        +158
        +159
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 157
        +
        +def include(*args)
        +  unless_standalone(*args) { merge(@inclusions, @exclusions, *args) }
        +end
        +
        +
        + +
        +

        + + - (Object) include!(*args) + + + + + +

        + + + + +
        +
        +
        +
        +161
        +162
        +163
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 161
        +
        +def include!(*args)
        +  unless_standalone(*args) { replace(@inclusions, @exclusions, *args) }
        +end
        +
        +
        + +
        +

        + + - (Boolean) include?(example) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 169
        +
        +def include?(example)
        +  @inclusions.empty? ? true : example.any_apply?(@inclusions)
        +end
        +
        +
        + +
        +

        + + - (Object) include_with_low_priority(*args) + + + + + +

        + + + + +
        +
        +
        +
        +165
        +166
        +167
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 165
        +
        +def include_with_low_priority(*args)
        +  unless_standalone(*args) { reverse_merge(@inclusions, @exclusions, *args) }
        +end
        +
        +
        + +
        +

        + + - (Object) prune(examples) + + + + + +

        + + + + +
        +
        +
        +
        +137
        +138
        +139
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 137
        +
        +def prune(examples)
        +  examples.select {|e| !exclude?(e) && include?(e)}
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager/BackwardCompatibility.html b/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager/BackwardCompatibility.html new file mode 100644 index 000000000..4d5e319ed --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager/BackwardCompatibility.html @@ -0,0 +1,362 @@ + + + + + + Module: RSpec::Core::FilterManager::BackwardCompatibility + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::FilterManager::BackwardCompatibility + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/filter_manager.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) _warn_deprecated_key(key, updates) + + + + + +

        +
        +

        Emits a deprecation warning for keys that will not be supported in +the future.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +109
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 109
        +
        +def _warn_deprecated_key(key, updates)
        +  RSpec.deprecate("FilterManager#exclude(#{key.inspect} => #{updates[key].inspect})")
        +  @exclusions[key] = updates.delete(key)
        +end
        +
        +
        + +
        +

        + + - (Object) _warn_deprecated_keys(updates) + + + + + +

        +
        +

        Supports a use case that probably doesn't exist: overriding the +if/unless procs.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +102
        +103
        +104
        +105
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 102
        +
        +def _warn_deprecated_keys(updates)
        +  _warn_deprecated_key(:unless, updates) if updates.has_key?(:unless)
        +  _warn_deprecated_key(:if, updates)     if updates.has_key?(:if)
        +end
        +
        +
        + +
        +

        + + - (Object) merge(orig, opposite, *updates) + + + + + +

        + + + + +
        +
        +
        +
        +90
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 90
        +
        +def merge(orig, opposite, *updates)
        +  _warn_deprecated_keys(updates.last)
        +  super
        +end
        +
        +
        + +
        +

        + + - (Object) reverse_merge(orig, opposite, *updates) + + + + + +

        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +98
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 95
        +
        +def reverse_merge(orig, opposite, *updates)
        +  _warn_deprecated_keys(updates.last)
        +  super
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager/Describable.html b/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager/Describable.html new file mode 100644 index 000000000..a669f43fd --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/FilterManager/Describable.html @@ -0,0 +1,265 @@ + + + + + + Module: RSpec::Core::FilterManager::Describable + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::FilterManager::Describable + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/filter_manager.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        PROC_HEX_NUMBER = + +
        +
        /0x[0-9a-f]+@/
        + +
        PROJECT_DIR = + +
        +
        File.expand_path('.')
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 80
        +
        +def description
        +  reject { |k, v| RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS[k] == v }.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)','')
        +end
        +
        +
        + +
        +

        + + - (Boolean) empty_without_conditional_filters? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/core/filter_manager.rb', line 84
        +
        +def empty_without_conditional_filters?
        +  reject { |k, v| RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS[k] == v }.empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters.html new file mode 100644 index 000000000..0df93e173 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters.html @@ -0,0 +1,197 @@ + + + + + + Module: RSpec::Core::Formatters + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Formatters + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters.rb,
        + lib/rspec/core/formatters/helpers.rb,
        lib/rspec/core/formatters/html_printer.rb,
        lib/rspec/core/formatters/html_formatter.rb,
        lib/rspec/core/formatters/base_formatter.rb,
        lib/rspec/core/formatters/json_formatter.rb,
        lib/rspec/core/formatters/snippet_extractor.rb,
        lib/rspec/core/formatters/progress_formatter.rb,
        lib/rspec/core/formatters/base_text_formatter.rb,
        lib/rspec/core/formatters/text_mate_formatter.rb,
        lib/rspec/core/formatters/deprecation_formatter.rb,
        lib/rspec/core/formatters/documentation_formatter.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        Built-in Formatters

        + +
          +
        • progress (default) - prints dots for passing examples, F for failures, * for pending
        • +
        • documentation - prints the docstrings passed to describe and it methods (and their aliases)
        • +
        • html
        • +
        • textmate - html plus links to editor
        • +
        • json - useful for archiving data for subsequent analysis
        • +
        + +

        The progress formatter is the default, but you can choose any one or more of +the other formatters by passing with the --format (or -f for short) +command-line option, e.g.

        + +
        rspec --format documentation
        +
        + +

        You can also send the output of multiple formatters to different streams, e.g.

        + +
        rspec --format documentation --format html --out results.html
        +
        + +

        This example sends the output of the documentation formatter to $stdout, and +the output of the html formatter to results.html.

        + +

        Custom Formatters

        + +

        You can tell RSpec to use a custom formatter by passing its path and name to +the rspec commmand. For example, if you define MyCustomFormatter in +path/to/my_custom_formatter.rb, you would type this command:

        + +
        rspec --require path/to/my_custom_formatter.rb --format MyCustomFormatter
        +
        + +

        The reporter calls every formatter with this protocol:

        + +
          +
        • start(expected_example_count)
        • +
        • zero or more of the following + +
            +
          • example_group_started(group)
          • +
          • example_started(example)
          • +
          • example_passed(example)
          • +
          • example_failed(example)
          • +
          • example_pending(example)
          • +
          • message(string)
          • +
        • +
        • stop
        • +
        • start_dump
        • +
        • dump_pending
        • +
        • dump_failures
        • +
        • dump_summary(duration, example_count, failure_count, pending_count)
        • +
        • seed(value)
        • +
        • close
        • +
        + +

        You can either implement all of those methods or subclass +RSpec::Core::Formatters::BaseTextFormatter and override the methods you want +to enhance.

        + + +
        +
        +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + Modules: Helpers + + + + Classes: BaseFormatter, BaseTextFormatter, DeprecationFormatter, DocumentationFormatter, HtmlFormatter, HtmlPrinter, JsonFormatter, ProgressFormatter, SnippetExtractor, TextMateFormatter + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseFormatter.html new file mode 100644 index 000000000..3efce07ac --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseFormatter.html @@ -0,0 +1,2171 @@ + + + + + + Class: RSpec::Core::Formatters::BaseFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::BaseFormatter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Helpers
        + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/base_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        RSpec's built-in formatters are all subclasses of RSpec::Core::Formatters::BaseTextFormatter, +but the BaseTextFormatter documents all of the methods needed to be implemented by a formatter, +as they are called from the reporter.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        +

        Direct Known Subclasses

        +

        BaseTextFormatter, JsonFormatter

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) duration + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute duration.

          +
          + +
        • + + +
        • + + + - (Object) example_count + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute example_count.

          +
          + +
        • + + +
        • + + + - (Object) example_group + + + + + + + + + + + + + + + + +

          Returns the value of attribute example_group.

          +
          + +
        • + + +
        • + + + - (Object) examples + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute examples.

          +
          + +
        • + + +
        • + + + - (Object) failed_examples + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute failed_examples.

          +
          + +
        • + + +
        • + + + - (Object) failure_count + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute failure_count.

          +
          + +
        • + + +
        • + + + - (Object) output + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute output.

          +
          + +
        • + + +
        • + + + - (Object) pending_count + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute pending_count.

          +
          + +
        • + + +
        • + + + - (Object) pending_examples + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute pending_examples.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (BaseFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of BaseFormatter

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + output + + + + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 23
        +
        +def initialize(output)
        +  @output = output || StringIO.new
        +  @example_count = @pending_count = @failure_count = 0
        +  @examples = []
        +  @failed_examples = []
        +  @pending_examples = []
        +  @example_group = nil
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) duration (readonly) + + + + + +

        +
        +

        Returns the value of attribute duration

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 16
        +
        +def duration
        +  @duration
        +end
        +
        +
        + + + +
        +

        + + - (Object) example_count (readonly) + + + + + +

        +
        +

        Returns the value of attribute example_count

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 17
        +
        +def example_count
        +  @example_count
        +end
        +
        +
        + + + +
        +

        + + - (Object) example_group + + + + + +

        +
        +

        Returns the value of attribute example_group

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 15
        +
        +def example_group
        +  @example_group
        +end
        +
        +
        + + + +
        +

        + + - (Object) examples (readonly) + + + + + +

        +
        +

        Returns the value of attribute examples

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 16
        +
        +def examples
        +  @examples
        +end
        +
        +
        + + + +
        +

        + + - (Object) failed_examples (readonly) + + + + + +

        +
        +

        Returns the value of attribute failed_examples

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 18
        +
        +def failed_examples
        +  @failed_examples
        +end
        +
        +
        + + + +
        +

        + + - (Object) failure_count (readonly) + + + + + +

        +
        +

        Returns the value of attribute failure_count

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 17
        +
        +def failure_count
        +  @failure_count
        +end
        +
        +
        + + + +
        +

        + + - (Object) output (readonly) + + + + + +

        +
        +

        Returns the value of attribute output

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 16
        +
        +def output
        +  @output
        +end
        +
        +
        + + + +
        +

        + + - (Object) pending_count (readonly) + + + + + +

        +
        +

        Returns the value of attribute pending_count

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 17
        +
        +def pending_count
        +  @pending_count
        +end
        +
        +
        + + + +
        +

        + + - (Object) pending_examples (readonly) + + + + + +

        +
        +

        Returns the value of attribute pending_examples

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 18
        +
        +def pending_examples
        +  @pending_examples
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) close + + + + + +

        +
        +

        Invoked at the very end, close allows the formatter to clean +up resources, e.g. open streams, etc.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 172
        +
        +def close
        +  restore_sync_output
        +end
        +
        +
        + +
        +

        + + - (nil) dump_failures + + + + + +

        +
        +

        Dumps detailed information about each example failure.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +136
        +137
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 136
        +
        +def dump_failures
        +end
        +
        +
        + +
        +

        + + - (nil) dump_pending + + + + + +

        +
        +

        Outputs a report of pending examples. This gets invoked +after the summary if option is set to do so.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +161
        +162
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 161
        +
        +def dump_pending
        +end
        +
        +
        + +
        +

        + + - (Object) dump_summary(duration, example_count, failure_count, pending_count) + + + + + +

        +
        +

        This method is invoked after the dumping of examples and failures. Each parameter +is assigned to a corresponding attribute.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + duration + + + + + + +
        • + +
        • + + example_count + + + + + + +
        • + +
        • + + failure_count + + + + + + +
        • + +
        • + + pending_count + + + + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +148
        +149
        +150
        +151
        +152
        +153
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 148
        +
        +def dump_summary(duration, example_count, failure_count, pending_count)
        +  @duration = duration
        +  @example_count = example_count
        +  @failure_count = failure_count
        +  @pending_count = pending_count
        +end
        +
        +
        + +
        +

        + + - (Array) example_failed(example) + + + + + +

        +
        +

        Invoked when an example fails.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example + + + + + + + — +

          instance of subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 101
        +
        +def example_failed(example)
        +  @failed_examples << example
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_finished(example_group) + + + + + +

        +
        +

        Invoked at the end of the execution of each example group.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group + + + + + + + — +

          subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +66
        +67
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 66
        +
        +def example_group_finished(example_group)
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_started(example_group) + + + + + +

        +
        +

        This method is invoked at the beginning of the execution of each example group.

        + +

        The next method to be invoked after this is #example_passed, +#example_pending, or #example_group_finished.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_group + + + + + + + — +

          subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        • + + example_group + + + + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 57
        +
        +def example_group_started(example_group)
        +  @example_group = example_group
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        +
        +

        Invoked when an example passes.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example + + + + + + + — +

          instance of subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +84
        +85
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 84
        +
        +def example_passed(example)
        +end
        +
        +
        + +
        +

        + + - (Array) example_pending(example) + + + + + +

        +
        +

        Invoked when an example is pending.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example + + + + + + + — +

          instance of subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 91
        +
        +def example_pending(example)
        +  @pending_examples << example
        +end
        +
        +
        + +
        +

        + + - (Array) example_started(example) + + + + + +

        +
        +

        Invoked at the beginning of the execution of each example.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example + + + + + + + — +

          instance of subclass of RSpec::Core::ExampleGroup

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Array) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +75
        +76
        +77
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 75
        +
        +def example_started(example)
        +  examples << example
        +end
        +
        +
        + +
        +

        + + - (Object) format_backtrace(backtrace, example) + + + + + +

        +
        +

        Formats the given backtrace based on configuration and +the metadata of the given example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +180
        +181
        +182
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 180
        +
        +def format_backtrace(backtrace, example)
        +  super(backtrace, example.)
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        +
        +

        Used by the reporter to send messages to the output stream.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +110
        +111
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 110
        +
        +def message(message)
        +end
        +
        +
        + +
        +

        + + - (Object) start(example_count) + + + + + +

        +
        +

        This method is invoked before any examples are run, right after +they have all been collected. This can be useful for special +formatters that need to provide progress on feedback (graphical ones).

        + +

        This will only be invoked once, and the next one to be invoked +is #example_group_started.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + example_count + + + + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 42
        +
        +def start(example_count)
        +  start_sync_output
        +  @example_count = example_count
        +end
        +
        +
        + +
        +

        + + - (nil) start_dump + + + + + +

        +
        +

        This method is invoked after all of the examples have executed. The next method +to be invoked after this one is #dump_failures +(BaseTextFormatter then calls #dump_failure once for each failed example.)

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +128
        +129
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 128
        +
        +def start_dump
        +end
        +
        +
        + +
        +

        + + - (nil) stop + + + + + +

        +
        +

        Invoked after all examples have executed, before dumping post-run reports.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +118
        +119
        +
        +
        # File 'lib/rspec/core/formatters/base_formatter.rb', line 118
        +
        +def stop
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html new file mode 100644 index 000000000..3e88a245f --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseTextFormatter.html @@ -0,0 +1,1211 @@ + + + + + + Class: RSpec::Core::Formatters::BaseTextFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::BaseTextFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseFormatter + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/base_text_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        Base for all of RSpec's built-in formatters. See RSpec::Core::Formatters::BaseFormatter +to learn more about all of the methods called by the reporter.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        +

        Direct Known Subclasses

        +

        DocumentationFormatter, HtmlFormatter, ProgressFormatter

        +
        + +

        Constant Summary

        + +
        + +
        VT100_COLORS = + +
        +
        {
        +  :black => 30,
        +  :red => 31,
        +  :green => 32,
        +  :yellow => 33,
        +  :blue => 34,
        +  :magenta => 35,
        +  :cyan => 36,
        +  :white => 37
        +}
        + +
        VT100_COLOR_CODES = + +
        +
        VT100_COLORS.values.to_set
        + +
        + + + + + + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #example_failed, #example_group_finished, #example_group_started, #example_passed, #example_pending, #example_started, #format_backtrace, #initialize, #start, #start_dump, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Formatters::BaseFormatter

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) close + + + + + +

        + + + + +
        +
        +
        +
        +162
        +163
        +164
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 162
        +
        +def close
        +  output.close if IO === output && output != $stdout
        +end
        +
        +
        + +
        +

        + + - (Object) color_code_for(code_or_symbol) + + + + + +

        + + + + +
        +
        +
        +
        +179
        +180
        +181
        +182
        +183
        +184
        +185
        +186
        +187
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 179
        +
        +def color_code_for(code_or_symbol)
        +  if VT100_COLOR_CODES.include?(code_or_symbol)
        +    code_or_symbol
        +  else
        +    VT100_COLORS.fetch(code_or_symbol) do
        +      color_code_for(:white)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) colorise_summary(summary) + + + + + +

        +
        +

        Colorizes the output red for failure, yellow for +pending, and green otherwise.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + string + + + (String) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 35
        +
        +def colorise_summary(summary)
        +  if failure_count > 0
        +    color(summary, RSpec.configuration.failure_color)
        +  elsif pending_count > 0
        +    color(summary, RSpec.configuration.pending_color)
        +  else
        +    color(summary, RSpec.configuration.success_color)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) colorize(text, code_or_symbol) + + + + + +

        + + + + +
        +
        +
        +
        +189
        +190
        +191
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 189
        +
        +def colorize(text, code_or_symbol)
        +  "\e[#{color_code_for(code_or_symbol)}m#{text}\e[0m"
        +end
        +
        +
        + +
        +

        + + - (Object) dump_commands_to_rerun_failed_examples + + + + + +

        +
        +

        Outputs commands which can be used to re-run failed examples.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 57
        +
        +def dump_commands_to_rerun_failed_examples
        +  return if failed_examples.empty?
        +  output.puts
        +  output.puts("Failed examples:")
        +  output.puts
        +
        +  failed_examples.each do |example|
        +    output.puts(failure_color("rspec #{RSpec::Core::Metadata::relative_path(example.location)}") + " " + detail_color("# #{example.full_description}"))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_failures + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 18
        +
        +def dump_failures
        +  return if failed_examples.empty?
        +  output.puts
        +  output.puts "Failures:"
        +  failed_examples.each_with_index do |example, index|
        +    output.puts
        +    pending_fixed?(example) ? dump_pending_fixed(example, index) : dump_failure(example, index)
        +    dump_backtrace(example)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_pending + + + + + +

        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +154
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 139
        +
        +def dump_pending
        +  unless pending_examples.empty?
        +    output.puts
        +    output.puts "Pending:"
        +    pending_examples.each do |pending_example|
        +      output.puts pending_color("  #{pending_example.full_description}")
        +      output.puts detail_color("    # #{pending_example.execution_result[:pending_message]}")
        +      output.puts detail_color("    # #{format_caller(pending_example.location)}")
        +      if pending_example.execution_result[:exception] \
        +        && RSpec.configuration.show_failures_in_pending_blocks?
        +        dump_failure_info(pending_example)
        +        dump_backtrace(pending_example)
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_profile + + + + + +

        +
        +

        Outputs the slowest examples and example groups in a report when using --profile COUNT (default 10).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 72
        +
        +def dump_profile
        +  dump_profile_slowest_examples
        +  dump_profile_slowest_example_groups
        +end
        +
        +
        + +
        +

        + + - (Object) dump_profile_slowest_example_groups + + + + + +

        + + + + +
        +
        +
        +
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 96
        +
        +def dump_profile_slowest_example_groups
        +  number_of_examples = RSpec.configuration.profile_examples
        +  example_groups = {} 
        +
        +  examples.each do |example|
        +    location = example.example_group.parent_groups.last.[:example_group][:location]
        +
        +    example_groups[location] ||= Hash.new(0)
        +    example_groups[location][:total_time]  += example.execution_result[:run_time]
        +    example_groups[location][:count]       += 1
        +    example_groups[location][:description] = example.example_group.top_level_description unless example_groups[location].has_key?(:description)
        +  end
        +
        +  # stop if we've only one example group
        +  return if example_groups.keys.length <= 1
        +  
        +  example_groups.each do |loc, hash|
        +    hash[:average] = hash[:total_time].to_f / hash[:count]
        +  end
        +  
        +  sorted_groups = example_groups.sort_by {|_, hash| -hash[:average]}.first(number_of_examples)
        +
        +  output.puts "\nTop #{sorted_groups.size} slowest example groups:"
        +  sorted_groups.each do |loc, hash| 
        +    average = "#{failure_color(format_seconds(hash[:average]))} #{failure_color("seconds")} average"
        +    total   = "#{format_seconds(hash[:total_time])} seconds"
        +    count   = pluralize(hash[:count], "example")
        +    output.puts "  #{hash[:description]}"
        +    output.puts detail_color("    #{average} (#{total} / #{count}) #{loc}")
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_profile_slowest_examples + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 77
        +
        +def dump_profile_slowest_examples
        +  number_of_examples = RSpec.configuration.profile_examples
        +  sorted_examples = examples.sort_by {|example|
        +    example.execution_result[:run_time] }.reverse.first(number_of_examples)
        +
        +  total, slows = [examples, sorted_examples].map {|exs|
        +    exs.inject(0.0) {|i, e| i + e.execution_result[:run_time] }}
        +
        +  time_taken = slows / total
        +  percentage = '%.1f' % ((time_taken.nan? ? 0.0 : time_taken) * 100)
        +
        +  output.puts "\nTop #{sorted_examples.size} slowest examples (#{format_seconds(slows)} seconds, #{percentage}% of total time):\n"
        +
        +  sorted_examples.each do |example|
        +    output.puts "  #{example.full_description}"
        +    output.puts detail_color("    #{failure_color(format_seconds(example.execution_result[:run_time]))} #{failure_color("seconds")} #{format_caller(example.location)}")
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) dump_summary(duration, example_count, failure_count, pending_count) + + + + + +

        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 45
        +
        +def dump_summary(duration, example_count, failure_count, pending_count)
        +  super(duration, example_count, failure_count, pending_count)
        +  dump_profile unless mute_profile_output?(failure_count)
        +  output.puts "\nFinished in #{format_duration(duration)}\n"
        +  output.puts colorise_summary(summary_line(example_count, failure_count, pending_count))
        +  dump_commands_to_rerun_failed_examples
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 14
        +
        +def message(message)
        +  output.puts message
        +end
        +
        +
        + +
        +

        + + - (Object) seed(number) + + + + + +

        + + + + +
        +
        +
        +
        +156
        +157
        +158
        +159
        +160
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 156
        +
        +def seed(number)
        +  output.puts
        +  output.puts "Randomized with seed #{number}"
        +  output.puts
        +end
        +
        +
        + +
        +

        + + - (Object) summary_line(example_count, failure_count, pending_count) + + + + + +

        +
        +

        Outputs summary with number of examples, failures and pending.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +132
        +133
        +134
        +135
        +136
        +137
        +
        +
        # File 'lib/rspec/core/formatters/base_text_formatter.rb', line 132
        +
        +def summary_line(example_count, failure_count, pending_count)
        +  summary = pluralize(example_count, "example")
        +  summary << ", " << pluralize(failure_count, "failure")
        +  summary << ", #{pending_count} pending" if pending_count > 0
        +  summary
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/DeprecationFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/DeprecationFormatter.html new file mode 100644 index 000000000..3a33abb8a --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/DeprecationFormatter.html @@ -0,0 +1,394 @@ + + + + + + Class: RSpec::Core::Formatters::DeprecationFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DeprecationFormatter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/deprecation_formatter.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (DeprecationFormatter) initialize(deprecation_stream = $stderr, summary_stream = $stdout) + + + + + +

        +
        +

        Returns a new instance of DeprecationFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 5
        +
        +def initialize(deprecation_stream=$stderr, summary_stream=$stdout)
        +  @deprecation_stream = deprecation_stream
        +  @summary_stream = summary_stream
        +  @count = 0
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) deprecation(data) + + + + + +

        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 15
        +
        +def deprecation(data)
        +  @count += 1
        +  if data[:message]
        +    @deprecation_stream.print data[:message]
        +  else
        +    @deprecation_stream.print "DEPRECATION: " unless File === @deprecation_stream
        +    @deprecation_stream.print "#{data[:deprecated]} is deprecated."
        +    @deprecation_stream.print " Use #{data[:replacement]} instead." if data[:replacement]
        +    @deprecation_stream.print " Called from #{data[:call_site]}." if data[:call_site]
        +    @deprecation_stream.puts
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) deprecation_summary + + + + + +

        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 28
        +
        +def deprecation_summary
        +  if @count > 0 && File === @deprecation_stream
        +    @summary_stream.print "\n#{@count} deprecation"
        +    @summary_stream.print "s" if @count > 1
        +    @summary_stream.print " logged to "
        +    @summary_stream.puts @deprecation_stream.path
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) start(example_count = nil) + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 11
        +
        +def start(example_count=nil)
        +  #no-op to fix #966
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/DocumentationFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/DocumentationFormatter.html new file mode 100644 index 000000000..951947fa3 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/DocumentationFormatter.html @@ -0,0 +1,866 @@ + + + + + + Class: RSpec::Core::Formatters::DocumentationFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::DocumentationFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseTextFormatter + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/documentation_formatter.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseTextFormatter

        +

        BaseTextFormatter::VT100_COLORS, BaseTextFormatter::VT100_COLOR_CODES

        + + + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseTextFormatter

        +

        #close, #color_code_for, #colorise_summary, #colorize, #dump_commands_to_rerun_failed_examples, #dump_failures, #dump_pending, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #dump_summary, #message, #seed, #summary_line

        + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #close, #dump_failures, #dump_pending, #dump_summary, #example_started, #format_backtrace, #message, #start, #start_dump, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (DocumentationFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of DocumentationFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 7
        +
        +def initialize(output)
        +  super(output)
        +  @group_level = 0
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) current_indentation + + + + + +

        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 57
        +
        +def current_indentation
        +  '  ' * @group_level
        +end
        +
        +
        + +
        +

        + + - (Object) example_failed(example) + + + + + +

        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 35
        +
        +def example_failed(example)
        +  super(example)
        +  output.puts failure_output(example, example.execution_result[:exception])
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_chain + + + + + +

        + + + + +
        +
        +
        +
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 61
        +
        +def example_group_chain
        +  example_group.parent_groups.reverse
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_finished(example_group) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 21
        +
        +def example_group_finished(example_group)
        +  @group_level -= 1
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_started(example_group) + + + + + +

        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 12
        +
        +def example_group_started(example_group)
        +  super(example_group)
        +
        +  output.puts if @group_level == 0
        +  output.puts "#{current_indentation}#{example_group.description.strip}"
        +
        +  @group_level += 1
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 25
        +
        +def example_passed(example)
        +  super(example)
        +  output.puts passed_output(example)
        +end
        +
        +
        + +
        +

        + + - (Object) example_pending(example) + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 30
        +
        +def example_pending(example)
        +  super(example)
        +  output.puts pending_output(example, example.execution_result[:pending_message])
        +end
        +
        +
        + +
        +

        + + - (Object) failure_output(example, exception) + + + + + +

        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 40
        +
        +def failure_output(example, exception)
        +  failure_color("#{current_indentation}#{example.description.strip} (FAILED - #{next_failure_index})")
        +end
        +
        +
        + +
        +

        + + - (Object) next_failure_index + + + + + +

        + + + + +
        +
        +
        +
        +44
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 44
        +
        +def next_failure_index
        +  @next_failure_index ||= 0
        +  @next_failure_index += 1
        +end
        +
        +
        + +
        +

        + + - (Object) passed_output(example) + + + + + +

        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 49
        +
        +def passed_output(example)
        +  success_color("#{current_indentation}#{example.description.strip}")
        +end
        +
        +
        + +
        +

        + + - (Object) pending_output(example, message) + + + + + +

        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core/formatters/documentation_formatter.rb', line 53
        +
        +def pending_output(example, message)
        +  pending_color("#{current_indentation}#{example.description.strip} (PENDING: #{message})")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/Helpers.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/Helpers.html new file mode 100644 index 000000000..c125a353a --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/Helpers.html @@ -0,0 +1,644 @@ + + + + + + Module: RSpec::Core::Formatters::Helpers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Formatters::Helpers + + + +

        + +
        + + + + + +
        Includes:
        +
        BacktraceFormatter
        + + + + +
        Included in:
        +
        BaseFormatter
        + + + +
        Defined in:
        +
        lib/rspec/core/formatters/helpers.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        SUB_SECOND_PRECISION = + +
        +
        5
        + +
        DEFAULT_PRECISION = + +
        +
        2
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) format_duration(duration) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Formats seconds into a human-readable string.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        format_duration(1) #=>  "1 minute 1 second"
        +format_duration(135.14) #=> "2 minutes 15.14 seconds"
        + +
        +

        Parameters:

        +
          + +
        • + + duration + + + (Float, Fixnum) + + + + — +

          in seconds

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          human-readable time

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 45
        +
        +def format_duration(duration)
        +  precision = case
        +              when duration < 1;    SUB_SECOND_PRECISION
        +              when duration < 120;  DEFAULT_PRECISION
        +              when duration < 300;  1
        +              else                  0
        +              end
        +
        +  if duration > 60
        +    minutes = (duration.to_i / 60).to_i
        +    seconds = duration - minutes * 60
        +
        +    "#{pluralize(minutes, 'minute')} #{pluralize(format_seconds(seconds, precision), 'second')}"
        +  else
        +    pluralize(format_seconds(duration, precision), 'second')
        +  end
        +end
        +
        +
        + +
        +

        + + - (String) format_seconds(float, precision = nil) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Formats seconds to have 5 digits of precision with trailing zeros removed if the number +is less than 1 or with 2 digits of precision if the number is greater than zero.

        + +

        The precision used is set in SUB_SECOND_PRECISION and DEFAULT_PRECISION.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        format_seconds(0.000006) #=> "0.00001"
        +format_seconds(0.020000) #=> "0.02"
        +format_seconds(1.00000000001) #=> "1"
        + +
        +

        Parameters:

        +
          + +
        • + + float + + + (Float) + + + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          formatted float

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 79
        +
        +def format_seconds(float, precision = nil)
        +  precision ||= (float < 1) ? SUB_SECOND_PRECISION : DEFAULT_PRECISION
        +  formatted = sprintf("%.#{precision}f", float)
        +  strip_trailing_zeroes(formatted)
        +end
        +
        +
        + +
        +

        + + - (String) pluralize(count, string) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Pluralize a word based on a count.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + count + + + (Fixnum) + + + + — +

          number of objects

          +
          + +
        • + +
        • + + string + + + (String) + + + + — +

          word to be pluralized

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          pluralized word

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 103
        +
        +def pluralize(count, string)
        +  "#{count} #{string}#{'s' unless count.to_f == 1}"
        +end
        +
        +
        + +
        +

        + + - (String) strip_trailing_zeroes(string) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Remove trailing zeros from a string.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + string + + + (String) + + + + — +

          string with trailing zeros

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          string with trailing zeros removed

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/core/formatters/helpers.rb', line 91
        +
        +def strip_trailing_zeroes(string)
        +  stripped = string.sub(/[^1-9]+$/, '')
        +  stripped.empty? ? "0" : stripped
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/HtmlFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/HtmlFormatter.html new file mode 100644 index 000000000..578881ed6 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/HtmlFormatter.html @@ -0,0 +1,1268 @@ + + + + + + Class: RSpec::Core::Formatters::HtmlFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::HtmlFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseTextFormatter + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/html_formatter.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        TextMateFormatter

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseTextFormatter

        +

        BaseTextFormatter::VT100_COLORS, BaseTextFormatter::VT100_COLOR_CODES

        + + + +

        Constants included + from Helpers

        +

        RSpec::Core::Formatters::Helpers::DEFAULT_PRECISION, RSpec::Core::Formatters::Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseTextFormatter

        +

        #close, #color_code_for, #colorise_summary, #colorize, #dump_commands_to_rerun_failed_examples, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #seed, #summary_line

        + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #close, #example_group_finished, #format_backtrace, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (HtmlFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of HtmlFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 9
        +
        +def initialize(output)
        +  super(output)
        +  @example_group_number = 0
        +  @example_number = 0
        +  @header_red = nil
        +  @printer = HtmlPrinter.new(output)
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(m, *a, &b) (private) + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 18
        +
        +def method_missing(m, *a, &b)
        +  # no-op
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) dump_failures + + + + + +

        + + + + +
        +
        +
        +
        +136
        +137
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 136
        +
        +def dump_failures
        +end
        +
        +
        + +
        +

        + + - (Object) dump_pending + + + + + +

        + + + + +
        +
        +
        +
        +139
        +140
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 139
        +
        +def dump_pending
        +end
        +
        +
        + +
        +

        + + - (Object) dump_summary(duration, example_count, failure_count, pending_count) + + + + + +

        + + + + +
        +
        +
        +
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 142
        +
        +def dump_summary(duration, example_count, failure_count, pending_count)
        +  @printer.print_summary(
        +    dry_run?,
        +    duration,
        +    example_count,
        +    failure_count,
        +    pending_count
        +  )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_failed(example) + + + + + +

        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 70
        +
        +def example_failed(example)
        +  super(example)
        +
        +  unless @header_red
        +    @header_red = true
        +    @printer.make_header_red
        +  end
        +
        +  unless @example_group_red
        +    @example_group_red = true
        +    @printer.make_example_group_header_red(example_group_number)
        +  end
        +
        +  @printer.move_progress(percent_done)
        +
        +  exception = example.[:execution_result][:exception]
        +  exception_details = if exception
        +    {
        +      :message => exception.message,
        +      :backtrace => format_backtrace(exception.backtrace, example).join("\n")
        +    }
        +  else
        +    false
        +  end
        +  extra = extra_failure_content(exception)
        +
        +  @printer.print_example_failed(
        +    example.execution_result[:pending_fixed],
        +    example.description,
        +    example.execution_result[:run_time],
        +    @failed_examples.size,
        +    exception_details,
        +    (extra == "") ? false : extra,
        +    true
        +  )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_number + + + + + +

        +
        +

        The number of the currently running example_group

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 27
        +
        +def example_group_number
        +  @example_group_number
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_started(example_group) + + + + + +

        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 42
        +
        +def example_group_started(example_group)
        +  super(example_group)
        +  @example_group_red = false
        +  @example_group_number += 1
        +
        +  unless example_group_number == 1
        +    @printer.print_example_group_end
        +  end
        +  @printer.print_example_group_start( example_group_number, example_group.description, example_group.parent_groups.size )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_number + + + + + +

        +
        +

        The number of the currently running example (a global counter)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 32
        +
        +def example_number
        +  @example_number
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 64
        +
        +def example_passed(example)
        +  @printer.move_progress(percent_done)
        +  @printer.print_example_passed( example.description, example.execution_result[:run_time] )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_pending(example) + + + + + +

        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 108
        +
        +def example_pending(example)
        +
        +  @printer.make_header_yellow unless @header_red
        +  @printer.make_example_group_header_yellow(example_group_number) unless @example_group_red
        +  @printer.move_progress(percent_done)
        +  @printer.print_example_pending( example.description, example.[:execution_result][:pending_message] )
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) example_started(example) + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 59
        +
        +def example_started(example)
        +  super(example)
        +  @example_number += 1
        +end
        +
        +
        + +
        +

        + + - (Object) extra_failure_content(exception) + + + + + +

        +
        +

        Override this method if you wish to output extra HTML for a failed spec. For example, you +could output links to images or other files produced during the specs.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 120
        +
        +def extra_failure_content(exception)
        +  require 'rspec/core/formatters/snippet_extractor'
        +  backtrace = exception.backtrace.map {|line| backtrace_line(line)}
        +  backtrace.compact!
        +  @snippet_extractor ||= SnippetExtractor.new
        +  "    <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 23
        +
        +def message(message)
        +end
        +
        +
        + +
        +

        + + - (Object) percent_done + + + + + +

        + + + + +
        +
        +
        +
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 128
        +
        +def percent_done
        +  result = 100.0
        +  if @example_count > 0
        +    result = (((example_number).to_f / @example_count.to_f * 1000).to_i / 10.0).to_f
        +  end
        +  result
        +end
        +
        +
        + +
        +

        + + - (Object) start(example_count) + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 36
        +
        +def start(example_count)
        +  super(example_count)
        +  @printer.print_html_start
        +  @printer.flush
        +end
        +
        +
        + +
        +

        + + - (Object) start_dump + + + + + +

        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/core/formatters/html_formatter.rb', line 54
        +
        +def start_dump
        +  @printer.print_example_group_end
        +  @printer.flush
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/HtmlPrinter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/HtmlPrinter.html new file mode 100644 index 000000000..dc086455f --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/HtmlPrinter.html @@ -0,0 +1,974 @@ + + + + + + Class: RSpec::Core::Formatters::HtmlPrinter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::HtmlPrinter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        ERB::Util
        + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/html_printer.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        TextMateFormatter::NonEscapingHtmlPrinter

        +
        + +

        Constant Summary

        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (HtmlPrinter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of HtmlPrinter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 8
        +
        +def initialize(output)
        +  @output = output
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) flush + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 77
        +
        +def flush
        +  @output.flush
        +end
        +
        +
        + +
        +

        + + - (Object) make_example_group_header_red(group_id) + + + + + +

        + + + + +
        +
        +
        +
        +94
        +95
        +96
        +97
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 94
        +
        +def make_example_group_header_red(group_id)
        +  @output.puts "    <script type=\"text/javascript\">makeRed('div_group_#{group_id}');</script>"
        +  @output.puts "    <script type=\"text/javascript\">makeRed('example_group_#{group_id}');</script>"
        +end
        +
        +
        + +
        +

        + + - (Object) make_example_group_header_yellow(group_id) + + + + + +

        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 99
        +
        +def make_example_group_header_yellow(group_id)
        +  @output.puts "    <script type=\"text/javascript\">makeYellow('div_group_#{group_id}');</script>"
        +  @output.puts "    <script type=\"text/javascript\">makeYellow('example_group_#{group_id}');</script>"
        +end
        +
        +
        + +
        +

        + + - (Object) make_header_red + + + + + +

        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 86
        +
        +def make_header_red
        +  @output.puts "    <script type=\"text/javascript\">makeRed('rspec-header');</script>"
        +end
        +
        +
        + +
        +

        + + - (Object) make_header_yellow + + + + + +

        + + + + +
        +
        +
        +
        +90
        +91
        +92
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 90
        +
        +def make_header_yellow
        +  @output.puts "    <script type=\"text/javascript\">makeYellow('rspec-header');</script>"
        +end
        +
        +
        + +
        +

        + + - (Object) move_progress(percent_done) + + + + + +

        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 81
        +
        +def move_progress( percent_done )
        +  @output.puts "    <script type=\"text/javascript\">moveProgressBar('#{percent_done}');</script>"
        +  @output.flush
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 33
        +
        +def print_example_failed( pending_fixed, description, run_time, failure_id, exception, extra_content, escape_backtrace = false )
        +  formatted_run_time = sprintf("%.5f", run_time)
        +
        +  @output.puts "    <dd class=\"example #{pending_fixed ? 'pending_fixed' : 'failed'}\">"
        +  @output.puts "      <span class=\"failed_spec_name\">#{h(description)}</span>"
        +  @output.puts "      <span class=\"duration\">#{formatted_run_time}s</span>"
        +  @output.puts "      <div class=\"failure\" id=\"failure_#{failure_id}\">"
        +  if exception
        +    @output.puts "        <div class=\"message\"><pre>#{h(exception[:message])}</pre></div>"
        +    if escape_backtrace
        +      @output.puts "        <div class=\"backtrace\"><pre>#{h exception[:backtrace]}</pre></div>"
        +    else
        +      @output.puts "        <div class=\"backtrace\"><pre>#{exception[:backtrace]}</pre></div>"
        +    end
        +  end
        +  @output.puts extra_content if extra_content
        +  @output.puts "      </div>"
        +  @output.puts "    </dd>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 17
        +
        +def print_example_group_end
        +  @output.puts "  </dl>"
        +  @output.puts "</div>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 22
        +
        +def print_example_group_start( group_id, description, number_of_parents  )
        +  @output.puts "<div id=\"div_group_#{group_id}\" class=\"example_group passed\">"
        +  @output.puts "  <dl #{indentation_style(number_of_parents)}>"
        +  @output.puts "  <dt id=\"example_group_#{group_id}\" class=\"passed\">#{h(description)}</dt>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +28
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 28
        +
        +def print_example_passed( description, run_time )
        +  formatted_run_time = sprintf("%.5f", run_time)
        +  @output.puts "    <dd class=\"example passed\"><span class=\"passed_spec_name\">#{h(description)}</span><span class='duration'>#{formatted_run_time}s</span></dd>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 53
        +
        +def print_example_pending( description, pending_message )
        +  @output.puts "    <dd class=\"example not_implemented\"><span class=\"not_implemented_spec_name\">#{h(description)} (PENDING: #{h(pending_message)})</span></dd>"
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 12
        +
        +def print_html_start
        +  @output.puts HTML_HEADER
        +  @output.puts REPORT_HEADER
        +end
        +
        +
        + +
        + + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/formatters/html_printer.rb', line 57
        +
        +def print_summary( was_dry_run, duration, example_count, failure_count, pending_count )
        +  # TODO - kill dry_run?
        +  if was_dry_run
        +    totals = "This was a dry-run"
        +  else
        +    totals =  "#{example_count} example#{'s' unless example_count == 1}, "
        +    totals << "#{failure_count} failure#{'s' unless failure_count == 1}"
        +    totals << ", #{pending_count} pending" if pending_count > 0
        +  end
        +
        +  formatted_duration = sprintf("%.5f", duration)
        +
        +  @output.puts "<script type=\"text/javascript\">document.getElementById('duration').innerHTML = \"Finished in <strong>#{formatted_duration} seconds</strong>\";</script>"
        +  @output.puts "<script type=\"text/javascript\">document.getElementById('totals').innerHTML = \"#{totals}\";</script>"
        +  @output.puts "</div>"
        +  @output.puts "</div>"
        +  @output.puts "</body>"
        +  @output.puts "</html>"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/JsonFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/JsonFormatter.html new file mode 100644 index 000000000..197af07ca --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/JsonFormatter.html @@ -0,0 +1,657 @@ + + + + + + Class: RSpec::Core::Formatters::JsonFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::JsonFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseFormatter + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/json_formatter.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) output_hash + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute output_hash.

          +
          + +
        • + + +
        + + + + + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #dump_failures, #dump_pending, #example_failed, #example_group_finished, #example_group_started, #example_passed, #example_pending, #example_started, #format_backtrace, #start, #start_dump

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (JsonFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of JsonFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 12
        +
        +def initialize(output)
        +  super
        +  @output_hash = {}
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) output_hash (readonly) + + + + + +

        +
        +

        Returns the value of attribute output_hash

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 10
        +
        +def output_hash
        +  @output_hash
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) close + + + + + +

        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 62
        +
        +def close
        +  output.write @output_hash.to_json
        +  output.close if IO === output && output != $stdout
        +end
        +
        +
        + +
        +

        + + - (Object) dump_summary(duration, example_count, failure_count, pending_count) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 21
        +
        +def dump_summary(duration, example_count, failure_count, pending_count)
        +  super(duration, example_count, failure_count, pending_count)
        +  @output_hash[:summary] = {
        +    :duration => duration,
        +    :example_count => example_count,
        +    :failure_count => failure_count,
        +    :pending_count => pending_count
        +  }
        +  @output_hash[:summary_line] = summary_line(example_count, failure_count, pending_count)
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 17
        +
        +def message(message)
        +  (@output_hash[:messages] ||= []) << message
        +end
        +
        +
        + +
        +

        + + - (Object) stop + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 39
        +
        +def stop
        +  super
        +  @output_hash[:examples] = examples.map do |example|
        +    {
        +      :description => example.description,
        +      :full_description => example.full_description,
        +      :status => example.execution_result[:status],
        +      # :example_group,
        +      # :execution_result,
        +      :file_path => example.[:file_path],
        +      :line_number  => example.[:line_number],
        +    }.tap do |hash|
        +      if e=example.exception
        +        hash[:exception] =  {
        +          :class => e.class.name,
        +          :message => e.message,
        +          :backtrace => e.backtrace,
        +        }
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) summary_line(example_count, failure_count, pending_count) + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/core/formatters/json_formatter.rb', line 32
        +
        +def summary_line(example_count, failure_count, pending_count)
        +  summary = pluralize(example_count, "example")
        +  summary << ", " << pluralize(failure_count, "failure")
        +  summary << ", #{pending_count} pending" if pending_count > 0
        +  summary
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/ProgressFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/ProgressFormatter.html new file mode 100644 index 000000000..6573cf7a3 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/ProgressFormatter.html @@ -0,0 +1,427 @@ + + + + + + Class: RSpec::Core::Formatters::ProgressFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::ProgressFormatter + + + +

        + +
        + +
        Inherits:
        +
        + BaseTextFormatter + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/progress_formatter.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseTextFormatter

        +

        BaseTextFormatter::VT100_COLORS, BaseTextFormatter::VT100_COLOR_CODES

        + + + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseTextFormatter

        +

        #close, #color_code_for, #colorise_summary, #colorize, #dump_commands_to_rerun_failed_examples, #dump_failures, #dump_pending, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #dump_summary, #message, #seed, #summary_line

        + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #close, #dump_failures, #dump_pending, #dump_summary, #example_group_finished, #example_group_started, #example_started, #format_backtrace, #initialize, #message, #start, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Formatters::BaseFormatter

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) example_failed(example) + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/core/formatters/progress_formatter.rb', line 18
        +
        +def example_failed(example)
        +  super(example)
        +  output.print failure_color('F')
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/core/formatters/progress_formatter.rb', line 8
        +
        +def example_passed(example)
        +  super(example)
        +  output.print success_color('.')
        +end
        +
        +
        + +
        +

        + + - (Object) example_pending(example) + + + + + +

        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/formatters/progress_formatter.rb', line 13
        +
        +def example_pending(example)
        +  super(example)
        +  output.print pending_color('*')
        +end
        +
        +
        + +
        +

        + + - (Object) start_dump + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/formatters/progress_formatter.rb', line 23
        +
        +def start_dump
        +  super()
        +  output.puts
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html new file mode 100644 index 000000000..0d53dd4d9 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/SnippetExtractor.html @@ -0,0 +1,669 @@ + + + + + + Class: RSpec::Core::Formatters::SnippetExtractor + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::SnippetExtractor + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/snippet_extractor.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Extracts code snippets by looking at the backtrace of the passed error and applies synax highlighting and line numbers using html.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: NullConverter + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) lines_around(file, line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Extract lines of code centered around a particular line within a source file.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + file + + + (String) + + + + — +

          filename

          +
          + +
        • + +
        • + + line + + + (Fixnum) + + + + — +

          line number

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          lines around the target line within the file (2 above and 1 below).

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 57
        +
        +def lines_around(file, line)
        +  if File.file?(file)
        +    lines = File.read(file).split("\n")
        +    min = [0, line-3].max
        +    max = [line+1, lines.length-1].min
        +    selected_lines = []
        +    selected_lines.join("\n")
        +    lines[min..max].join("\n")
        +  else
        +    "# Couldn't get snippet for #{file}"
        +  end
        +rescue SecurityError
        +  "# Couldn't get snippet for #{file}"
        +end
        +
        +
        + +
        +

        + + - (String) post_process(highlighted, offending_line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Adds line numbers to all lines and highlights the line where the failure occurred using html span tags.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + highlighted + + + (String) + + + + — +

          syntax-highlighted snippet surrounding the offending line of code

          +
          + +
        • + +
        • + + offending_line + + + (Fixnum) + + + + — +

          line where failure occured

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          completed snippet

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 79
        +
        +def post_process(highlighted, offending_line)
        +  new_lines = []
        +  highlighted.split("\n").each_with_index do |line, i|
        +    new_line = "<span class=\"linenum\">#{offending_line+i-2}</span>#{line}"
        +    new_line = "<span class=\"offending\">#{new_line}</span>" if i == 2
        +    new_lines << new_line
        +  end
        +  new_lines.join("\n")
        +end
        +
        +
        + +
        +

        + + - (String) snippet(backtrace) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Extract lines of code corresponding to a backtrace.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + backtrace + + + (String) + + + + — +

          the backtrace from a test failure

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          highlighted code snippet indicating where the test failure occured

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 25
        +
        +def snippet(backtrace)
        +  raw_code, line = snippet_for(backtrace[0])
        +  highlighted = @@converter.convert(raw_code, false)
        +  highlighted << "\n<span class=\"comment\"># gem install syntax to get syntax highlighting</span>" if @@converter.is_a?(NullConverter)
        +  post_process(highlighted, line)
        +end
        +
        +
        + +
        +

        + + - (String) snippet_for(error_line) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Create a snippet from a line of code.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + error_line + + + (String) + + + + — +

          file name with line number (i.e. 'foo_spec.rb:12')

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          lines around the target line within the file

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 40
        +
        +def snippet_for(error_line)
        +  if error_line =~ /(.*):(\d+)/
        +    file = $1
        +    line = $2.to_i
        +    [lines_around(file, line), line]
        +  else
        +    ["# Couldn't get snippet for #{error_line}", 1]
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/SnippetExtractor/NullConverter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/SnippetExtractor/NullConverter.html new file mode 100644 index 000000000..479bf0a96 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/SnippetExtractor/NullConverter.html @@ -0,0 +1,211 @@ + + + + + + Class: RSpec::Core::Formatters::SnippetExtractor::NullConverter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::SnippetExtractor::NullConverter + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/snippet_extractor.rb
        + +
        +
        + +
        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) convert(code, pre) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +
        +
        # File 'lib/rspec/core/formatters/snippet_extractor.rb', line 8
        +
        +def convert(code, pre); code; end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/TextMateFormatter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/TextMateFormatter.html new file mode 100644 index 000000000..35334873a --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/TextMateFormatter.html @@ -0,0 +1,497 @@ + + + + + + Class: RSpec::Core::Formatters::TextMateFormatter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::TextMateFormatter + + + +

        + +
        + +
        Inherits:
        +
        + HtmlFormatter + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/text_mate_formatter.rb
        + +
        +
        + +

        Overview

        +
        +

        Formats backtraces so they're clickable by TextMate

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: NonEscapingHtmlPrinter + + +

        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseTextFormatter

        +

        BaseTextFormatter::VT100_COLORS, BaseTextFormatter::VT100_COLOR_CODES

        + + + +

        Constants included + from Helpers

        +

        Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseFormatter

        +

        #duration, #example_count, #example_group, #examples, #failed_examples, #failure_count, #output, #pending_count, #pending_examples

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from HtmlFormatter

        +

        #dump_failures, #dump_pending, #dump_summary, #example_failed, #example_group_number, #example_group_started, #example_number, #example_passed, #example_pending, #example_started, #message, #percent_done, #start, #start_dump

        + + + + + + + + + +

        Methods inherited from BaseTextFormatter

        +

        #close, #color_code_for, #colorise_summary, #colorize, #dump_commands_to_rerun_failed_examples, #dump_failures, #dump_pending, #dump_profile, #dump_profile_slowest_example_groups, #dump_profile_slowest_examples, #dump_summary, #message, #seed, #summary_line

        + + + + + + + + + +

        Methods inherited from BaseFormatter

        +

        #close, #dump_failures, #dump_pending, #dump_summary, #example_failed, #example_group_finished, #example_group_started, #example_passed, #example_pending, #example_started, #format_backtrace, #message, #start, #start_dump, #stop

        + + + + + + + + + +

        Methods included from Helpers

        +

        #format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes

        + + + + + + + + + +

        Methods included from BacktraceFormatter

        +

        #format_backtrace

        +
        +

        Constructor Details

        + +
        +

        + + - (TextMateFormatter) initialize(output) + + + + + +

        +
        +

        Returns a new instance of TextMateFormatter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/formatters/text_mate_formatter.rb', line 16
        +
        +def initialize(output)
        +  super
        +  @printer = NonEscapingHtmlPrinter.new(output)
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + + in the class RSpec::Core::Formatters::HtmlFormatter + +

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) backtrace_line(line, skip_textmate_conversion = false) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/core/formatters/text_mate_formatter.rb', line 21
        +
        +def backtrace_line(line, skip_textmate_conversion=false)
        +  if skip_textmate_conversion
        +    super(line)
        +  else
        +    format_backtrace_line_for_textmate(super(line))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) extra_failure_content(exception) + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/core/formatters/text_mate_formatter.rb', line 36
        +
        +def extra_failure_content(exception)
        +  require 'rspec/core/formatters/snippet_extractor'
        +  backtrace = exception.backtrace.map {|line| backtrace_line(line, :skip_textmate_conversion)}
        +  backtrace.compact!
        +  @snippet_extractor ||= SnippetExtractor.new
        +  "    <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
        +end
        +
        +
        + +
        +

        + + - (Object) format_backtrace_line_for_textmate(line) + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/formatters/text_mate_formatter.rb', line 29
        +
        +def format_backtrace_line_for_textmate(line)
        +  return nil unless line
        +  CGI.escapeHTML(line).sub(/([^:]*\.e?rb):(\d*)/) do
        +    "<a href=\"txmt://open?url=file://#{File.expand_path($1)}&amp;line=#{$2}\">#{$1}:#{$2}</a> "
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/TextMateFormatter/NonEscapingHtmlPrinter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/TextMateFormatter/NonEscapingHtmlPrinter.html new file mode 100644 index 000000000..de8cdc47d --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Formatters/TextMateFormatter/NonEscapingHtmlPrinter.html @@ -0,0 +1,214 @@ + + + + + + Class: RSpec::Core::Formatters::TextMateFormatter::NonEscapingHtmlPrinter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Formatters::TextMateFormatter::NonEscapingHtmlPrinter + + + +

        + +
        + +
        Inherits:
        +
        + HtmlPrinter + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/formatters/text_mate_formatter.rb
        + +
        +
        + + +

        Constant Summary

        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from HtmlPrinter

        +

        #flush, #initialize, #make_example_group_header_red, #make_example_group_header_yellow, #make_header_red, #make_header_yellow, #move_progress, #print_example_group_end, #print_example_group_start, #print_example_passed, #print_example_pending, #print_html_start, #print_summary

        + +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Formatters::HtmlPrinter

        + +
        + + +
        +

        Instance Method Details

        + + +
        + + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/core/formatters/text_mate_formatter.rb', line 10
        +
        +def print_example_failed(pending_fixed, description, run_time, failure_id, exception, extra_content, escape_backtrace = false)
        +  # Call implementation from superclass, but ignore `escape_backtrace` and always pass `false` instead.
        +  super(pending_fixed, description, run_time, failure_id, exception, extra_content, false)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks.html new file mode 100644 index 000000000..fc63128bc --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks.html @@ -0,0 +1,897 @@ + + + + + + Module: RSpec::Core::Hooks + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Hooks + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Configuration, ExampleGroup, World
        + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: HookCollectionAliases, RegistersGlobals + + + + Classes: AfterAllHook, AfterHook, AroundHook, AroundHookCollection, BeforeHook, GroupHookCollection, Hook, HookCollection + + +

        + +

        Constant Summary

        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) after(*args, &block) + + + + (also: #prepend_after) + + + + + + + + + + + +

          Declare a block of code to be run after each example (using :each) or once after all examples (using :all).

          +
          + +
        • + + +
        • + + + - (Object) append_after(*args, &block) + + + + + + + + + + + + + +

          Adds block to the back of the list of after blocks in the same scope (:each, :all, or :suite).

          +
          + +
        • + + +
        • + + + - (Object) around(*args) {|Example| ... } + + + + + + + + + + + + + +

          Declare a block of code, parts of which will be run before and parts after the example.

          +
          + +
        • + + +
        • + + + - (Object) before(*args, &block) + + + + (also: #append_before) + + + + + + + + + + + +

          Declare a block of code to be run before each example (using :each) or once before any example (using :all).

          +
          + +
        • + + +
        • + + + - (Object) prepend_before(*args, &block) + + + + + + + + + + + + + +

          Adds block to the front of the list of before blocks in the same scope (:each, :all, or :suite).

          +
          + +
        • + + +
        + + + + + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + + - (Object) after(&block) + + - (Object) after(scope, &block) + + - (Object) after(scope, conditions, &block) + + - (Object) after(conditions, &block) + + + + + Also known as: + prepend_after + + + + +

        +
        +

        Declare a block of code to be run after each example (using :each) or +once after all examples (using :all). See +#before for more information about +ordering.

        + +

        Exceptions

        + +

        after hooks are guaranteed to run even when there are exceptions in +before hooks or examples. When an exception is raised in an after +block, the exception is captured for later reporting, and subsequent +after blocks are run.

        + +

        Order

        + +

        after hooks are stored in three scopes, which are run in order: +:each, :all, and :suite. They can also be declared in several +different places: RSpec.configure, a parent group, the current group. +They are run in the following order:

        + +
        after(:each) # declared in the current group
        +after(:each) # declared in a parent group
        +after(:each) # declared in RSpec.configure
        +after(:all)  # declared in the current group
        +after(:all)  # declared in a parent group
        +after(:all)  # declared in RSpec.configure
        +
        + +

        This is the reverse of the order in which before hooks are run. +Similarly, if more than one after is declared within any one scope, +they are run in reverse order of that in which they are declared.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + scope + + + (Symbol) + + + + — +

          :each, :all, or :suite (defaults to :each)

          +
          + +
        • + +
        • + + conditions + + + (Hash) + + + + — +

          constrains this hook to examples matching these conditions e.g. +after(:each, :ui => true) { ... } will only run with examples or +groups declared with :ui => true.

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +379
        +380
        +381
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 379
        +
        +def after(*args, &block)
        +  register_hook :prepend, :after, *args, &block
        +end
        +
        +
        + +
        +

        + + - (Object) append_after(*args, &block) + + + + + +

        +
        +

        Adds block to the back of the list of after blocks in the same +scope (:each, :all, or :suite).

        + +

        See #after for scoping semantics.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +389
        +390
        +391
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 389
        +
        +def append_after(*args, &block)
        +  register_hook :append, :after, *args, &block
        +end
        +
        +
        + +
        +

        + + + - (Object) around(&block) + + - (Object) around(scope, &block) + + - (Object) around(scope, conditions, &block) + + - (Object) around(conditions, &block) + + + + + + +

        +
        + +
        + Note: +

        the syntax of around is similar to that of before and after +but the semantics are quite different. before and after hooks are +run in the context of of the examples with which they are associated, +whereas around hooks are actually responsible for running the +examples. Consequently, around hooks do not have direct access to +resources that are made available within the examples and their +associated before and after hooks.

        +
        +
        + +
        + Note: +

        :each is the only supported scope.

        +
        +
        + +

        Declare a block of code, parts of which will be run before and parts +after the example. It is your responsibility to run the example:

        + +
        around(:each) do |ex|
        +  # do some stuff before
        +  ex.run
        +  # do some stuff after
        +end
        +
        + +

        The yielded example aliases run with call, which lets you treat it +like a Proc. This is especially handy when working with libaries +that manage their own setup and teardown using a block or proc syntax, +e.g.

        + +
        around(:each) {|ex| Database.transaction(&ex)}
        +around(:each) {|ex| FakeFS(&ex)}
        +
        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + scope + + + (Symbol) + + + + — +

          :each (defaults to :each) +present for syntax parity with before and after, but :each is +the only supported value.

          +
          + +
        • + +
        • + + conditions + + + (Hash) + + + + — +

          constrains this hook to examples matching these conditions e.g. +around(:each, :ui => true) { ... } will only run with examples or +groups declared with :ui => true.

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (Example) + + + + — +

          the example to run

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +437
        +438
        +439
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 437
        +
        +def around(*args, &block)
        +  register_hook :prepend, :around, *args, &block
        +end
        +
        +
        + +
        +

        + + + - (Object) before(&block) + + - (Object) before(scope, &block) + + - (Object) before(scope, conditions, &block) + + - (Object) before(conditions, &block) + + + + + Also known as: + append_before + + + + +

        +
        +

        Declare a block of code to be run before each example (using :each) +or once before any example (using :all). These are usually declared +directly in the ExampleGroup to which they apply, but they can also +be shared across multiple groups.

        + +

        You can also use before(:suite) to run a block of code before any +example groups are run. This should be declared in RSpec.configure

        + +

        Instance variables declared in before(:each) or before(:all) are +accessible within each example.

        + +

        Order

        + +

        before hooks are stored in three scopes, which are run in order: +:suite, :all, and :each. They can also be declared in several +different places: RSpec.configure, a parent group, the current group. +They are run in the following order:

        + +
        before(:suite) # declared in RSpec.configure
        +before(:all)   # declared in RSpec.configure
        +before(:all)   # declared in a parent group
        +before(:all)   # declared in the current group
        +before(:each)  # declared in RSpec.configure
        +before(:each)  # declared in a parent group
        +before(:each)  # declared in the current group
        +
        + +

        If more than one before is declared within any one scope, they are run +in the order in which they are declared.

        + +

        Conditions

        + +

        When you add a conditions hash to before(:each) or before(:all), +RSpec will only apply that hook to groups or examples that match the +conditions. e.g.

        + +
        RSpec.configure do |config|
        +  config.before(:each, :authorized => true) do
        +     :authorized_user
        +  end
        +end
        +
        +describe Something, :authorized => true do
        +  # the before hook will run in before each example in this group
        +end
        +
        +describe SomethingElse do
        +  it "does something", :authorized => true do
        +    # the before hook will run before this example
        +  end
        +
        +  it "does something else" do
        +    # the hook will not run before this example
        +  end
        +end
        +
        + +

        Warning: before(:suite, :with => :conditions)

        + +

        The conditions hash is used to match against specific examples. Since +before(:suite) is not run in relation to any specific example or +group, conditions passed along with :suite are effectively ignored.

        + +

        Exceptions

        + +

        When an exception is raised in a before block, RSpec skips any +subsequent before blocks and the example, but runs all of the +after(:each) and after(:all) hooks.

        + +

        Warning: implicit before blocks

        + +

        before hooks can also be declared in shared contexts which get +included implicitly either by you or by extension libraries. Since +RSpec runs these in the order in which they are declared within each +scope, load order matters, and can lead to confusing results when one +before block depends on state that is prepared in another before block +that gets run later.

        + +

        Warning: before(:all)

        + +

        It is very tempting to use before(:all) to speed things up, but we +recommend that you avoid this as there are a number of gotchas, as well +as things that simply don't work.

        + +

        context

        + +

        before(:all) is run in an example that is generated to provide group +context for the block.

        + +

        instance variables

        + +

        Instance variables declared in before(:all) are shared across all the +examples in the group. This means that each example can change the +state of a shared object, resulting in an ordering dependency that can +make it difficult to reason about failures.

        + +

        unsupported rspec constructs

        + +

        RSpec has several constructs that reset state between each example +automatically. These are not intended for use from within before(:all):

        + +
          +
        • let declarations
        • +
        • subject declarations
        • +
        • Any mocking, stubbing or test double declaration
        • +
        + +

        other frameworks

        + +

        Mock object frameworks and database transaction managers (like +ActiveRecord) are typically designed around the idea of setting up +before an example, running that one example, and then tearing down. +This means that mocks and stubs can (sometimes) be declared in +before(:all), but get torn down before the first real example is ever +run.

        + +

        You can create database-backed model objects in a before(:all) in +rspec-rails, but it will not be wrapped in a transaction for you, so +you are on your own to clean up in an after(:all) block.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        before(:each) declared in an ExampleGroup

        +

        + +
        
        +describe Thing do
        +  before(:each) do
        +    @thing = Thing.new
        +  end
        +
        +  it "does something" do
        +    # here you can access @thing
        +  end
        +end
        + + +

        before(:all) declared in an ExampleGroup

        +

        + +
        
        +describe Parser do
        +  before(:all) do
        +    File.open(file_to_parse, 'w') do |f|
        +      f.write <<-CONTENT
        +        stuff in the file
        +      CONTENT
        +    end
        +  end
        +
        +  it "parses the file" do
        +    Parser.parse(file_to_parse)
        +  end
        +
        +  after(:all) do
        +    File.delete(file_to_parse)
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + scope + + + (Symbol) + + + + — +

          :each, :all, or :suite (defaults to :each)

          +
          + +
        • + +
        • + + conditions + + + (Hash) + + + + — +

          constrains this hook to examples matching these conditions e.g. +before(:each, :ui => true) { ... } will only run with examples or +groups declared with :ui => true.

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +317
        +318
        +319
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 317
        +
        +def before(*args, &block)
        +  register_hook :append, :before, *args, &block
        +end
        +
        +
        + +
        +

        + + - (Object) prepend_before(*args, &block) + + + + + +

        +
        +

        Adds block to the front of the list of before blocks in the same +scope (:each, :all, or :suite).

        + +

        See #before for scoping semantics.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +327
        +328
        +329
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 327
        +
        +def prepend_before(*args, &block)
        +  register_hook :prepend, :before, *args, &block
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AfterAllHook.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AfterAllHook.html new file mode 100644 index 000000000..8082d086a --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AfterAllHook.html @@ -0,0 +1,283 @@ + + + + + + Class: RSpec::Core::Hooks::AfterAllHook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::AfterAllHook + + + +

        + +
        + +
        Inherits:
        +
        + Hook + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from Hook

        +

        #block, #options

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Hook

        +

        #initialize, #options_apply?

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Hooks::Hook

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) display_name + + + + + +

        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 53
        +
        +def display_name
        +  "after(:all) hook"
        +end
        +
        +
        + +
        +

        + + - (Object) run(example) + + + + + +

        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 40
        +
        +def run(example)
        +  example.instance_exec(example, &block)
        +rescue Exception => e
        +  # TODO: come up with a better solution for this.
        +  RSpec.configuration.reporter.message <<-EOS
        +
        +An error occurred in an after(:all) hook.
        +  #{e.class}: #{e.message}
        +  occurred at #{e.backtrace.first}
        +
        +EOS
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AfterHook.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AfterHook.html new file mode 100644 index 000000000..4ceb92364 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AfterHook.html @@ -0,0 +1,265 @@ + + + + + + Class: RSpec::Core::Hooks::AfterHook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::AfterHook + + + +

        + +
        + +
        Inherits:
        +
        + Hook + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from Hook

        +

        #block, #options

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Hook

        +

        #initialize, #options_apply?

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Hooks::Hook

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) display_name + + + + + +

        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 34
        +
        +def display_name
        +  "after hook"
        +end
        +
        +
        + +
        +

        + + - (Object) run(example) + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 30
        +
        +def run(example)
        +  example.instance_eval_with_rescue("in an after hook", &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AroundHook.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AroundHook.html new file mode 100644 index 000000000..c9ae5108f --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AroundHook.html @@ -0,0 +1,213 @@ + + + + + + Class: RSpec::Core::Hooks::AroundHook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::AroundHook + + + +

        + +
        + +
        Inherits:
        +
        + Hook + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from Hook

        +

        #block, #options

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Hook

        +

        #initialize, #options_apply?

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Hooks::Hook

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) display_name + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 59
        +
        +def display_name
        +  "around hook"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AroundHookCollection.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AroundHookCollection.html new file mode 100644 index 000000000..c3905969f --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/AroundHookCollection.html @@ -0,0 +1,320 @@ + + + + + + Class: RSpec::Core::Hooks::AroundHookCollection + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::AroundHookCollection + + + +

        + +
        + +
        Inherits:
        +
        + Array + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        HookCollectionAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) for(example, initial_procsy = nil) + + + + + +

        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +95
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 92
        +
        +def for(example, initial_procsy=nil)
        +  self.class.new(select {|hook| hook.options_apply?(example)}).
        +    with(example, initial_procsy)
        +end
        +
        +
        + +
        +

        + + - (Object) run + + + + + +

        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 103
        +
        +def run
        +  inject(@initial_procsy) do |procsy, around_hook|
        +    Example.procsy(procsy.) do
        +      @example.instance_eval_with_args(procsy, &around_hook.block)
        +    end
        +  end.call
        +end
        +
        +
        + +
        +

        + + - (Object) with(example, initial_procsy) + + + + + +

        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 97
        +
        +def with(example, initial_procsy)
        +  @example = example
        +  @initial_procsy = initial_procsy
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/BeforeHook.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/BeforeHook.html new file mode 100644 index 000000000..3725985aa --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/BeforeHook.html @@ -0,0 +1,265 @@ + + + + + + Class: RSpec::Core::Hooks::BeforeHook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::BeforeHook + + + +

        + +
        + +
        Inherits:
        +
        + Hook + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from Hook

        +

        #block, #options

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Hook

        +

        #initialize, #options_apply?

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Core::Hooks::Hook

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) display_name + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 24
        +
        +def display_name
        +  "before hook"
        +end
        +
        +
        + +
        +

        + + - (Object) run(example) + + + + + +

        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 20
        +
        +def run(example)
        +  example.instance_eval(&block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/GroupHookCollection.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/GroupHookCollection.html new file mode 100644 index 000000000..d38f50480 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/GroupHookCollection.html @@ -0,0 +1,246 @@ + + + + + + Class: RSpec::Core::Hooks::GroupHookCollection + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::GroupHookCollection + + + +

        + +
        + +
        Inherits:
        +
        + Array + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) for(group) + + + + + +

        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 113
        +
        +def for(group)
        +  @group = group
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) run + + + + + +

        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 118
        +
        +def run
        +  shift.run(@group) until empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/Hook.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/Hook.html new file mode 100644 index 000000000..6f78de7f4 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/Hook.html @@ -0,0 +1,436 @@ + + + + + + Class: RSpec::Core::Hooks::Hook + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::Hook + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        AfterAllHook, AfterHook, AroundHook, BeforeHook

        +
        + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) block + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute block.

          +
          + +
        • + + +
        • + + + - (Object) options + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute options.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Hook) initialize(block, options) + + + + + +

        +
        +

        Returns a new instance of Hook

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 9
        +
        +def initialize(block, options)
        +  @block = block
        +  @options = options
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) block (readonly) + + + + + +

        +
        +

        Returns the value of attribute block

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 7
        +
        +def block
        +  @block
        +end
        +
        +
        + + + +
        +

        + + - (Object) options (readonly) + + + + + +

        +
        +

        Returns the value of attribute options

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 7
        +
        +def options
        +  @options
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) options_apply?(example_or_group) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 14
        +
        +def options_apply?(example_or_group)
        +  example_or_group.all_apply?(options)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/HookCollection.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/HookCollection.html new file mode 100644 index 000000000..42e3271a3 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/HookCollection.html @@ -0,0 +1,310 @@ + + + + + + Class: RSpec::Core::Hooks::HookCollection + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Hooks::HookCollection + + + +

        + +
        + +
        Inherits:
        +
        + Array + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        HookCollectionAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) for(example_or_group) + + + + + +

        + + + + +
        +
        +
        +
        +74
        +75
        +76
        +77
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 74
        +
        +def for(example_or_group)
        +  self.class.new(select {|hook| hook.options_apply?(example_or_group)}).
        +    with(example_or_group)
        +end
        +
        +
        + +
        +

        + + - (Object) run + + + + + +

        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 84
        +
        +def run
        +  each {|h| h.run(@example) } unless empty?
        +end
        +
        +
        + +
        +

        + + - (Object) with(example) + + + + + +

        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 79
        +
        +def with(example)
        +  @example = example
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/HookCollectionAliases.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/HookCollectionAliases.html new file mode 100644 index 000000000..e156b2c13 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/HookCollectionAliases.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Core::Hooks::HookCollectionAliases + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Hooks::HookCollectionAliases + + + +

        + +
        + + + + + + + +
        Included in:
        +
        AroundHookCollection, HookCollection
        + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/RegistersGlobals.html b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/RegistersGlobals.html new file mode 100644 index 000000000..65c9b6c07 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Hooks/RegistersGlobals.html @@ -0,0 +1,182 @@ + + + + + + Module: RSpec::Core::Hooks::RegistersGlobals + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Hooks::RegistersGlobals + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/hooks.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) register_globals(host, globals) + + + + + +

        + + + + +
        +
        +
        +
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +
        +
        # File 'lib/rspec/core/hooks.rb', line 124
        +
        +def register_globals host, globals
        +  [:before, :after, :around].each do |position|
        +    process host, globals, position, :each
        +    next if position == :around # no around(:all) hooks
        +    process host, globals, position, :all
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/MemoizedHelpers.html b/source/documentation/2.14/rspec-core/RSpec/Core/MemoizedHelpers.html new file mode 100644 index 000000000..bcf9dd412 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/MemoizedHelpers.html @@ -0,0 +1,436 @@ + + + + + + Module: RSpec::Core::MemoizedHelpers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MemoizedHelpers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/memoized_helpers.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: ClassMethods + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) should(matcher = nil, message = nil) + + + + + +

        +
        +

        When should is called with no explicit receiver, the call is +delegated to the object returned by subject. Combined with an +implicit subject this supports very concise expressions.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Person do
        +  it { should be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 67
        +
        +def should(matcher=nil, message=nil)
        +  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(subject, matcher, message)
        +end
        +
        +
        + +
        +

        + + - (Object) should_not(matcher = nil, message = nil) + + + + + +

        +
        +

        Just like should, should_not delegates to the subject (implicit or +explicit) of the example group.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Person do
        +  it { should_not be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 81
        +
        +def should_not(matcher=nil, message=nil)
        +  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(subject, matcher, message)
        +end
        +
        +
        + +
        +

        + + - (Object) subject + + + + + +

        +
        + +
        + Note: +

        subject was contributed by Joe Ferris to support the one-liner +syntax embraced by shoulda matchers:

        + +
        describe Widget do
        +  it { should validate_presence_of(:name) }
        +end
        +
        + +

        While the examples below demonstrate how to use subject +explicitly in examples, we recommend that you define a method with +an intention revealing name instead.

        +
        +
        + +
        + Note: +

        Because subject is designed to create state that is reset between +each example, and before(:all) is designed to setup state that is +shared across all examples in an example group, subject is not +intended to be used in a before(:all) hook. RSpec 2.13.1 prints +a warning when you reference a subject from before(:all) and we plan +to have it raise an error in RSpec 3.

        +
        +
        + + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +# explicit declaration of subject
        +describe Person do
        +  subject { Person.new(:birthdate => 19.years.ago) }
        +  it "should be eligible to vote" do
        +    subject.should be_eligible_to_vote
        +    # ^ ^ explicit reference to subject not recommended
        +  end
        +end
        +
        +# implicit subject => { Person.new }
        +describe Person do
        +  it "should be eligible to vote" do
        +    subject.should be_eligible_to_vote
        +    # ^ ^ explicit reference to subject not recommended
        +  end
        +end
        +
        +# one-liner syntax - should is invoked on subject
        +describe Person do
        +  it { should be_eligible_to_vote }
        +end
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 47
        +
        +def subject
        +  __memoized.fetch(:subject) do
        +    __memoized[:subject] = begin
        +      described = described_class || self.class.description
        +      Class === described ? described.new : described
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html b/source/documentation/2.14/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html new file mode 100644 index 000000000..29f8b09ab --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/MemoizedHelpers/ClassMethods.html @@ -0,0 +1,822 @@ + + + + + + Module: RSpec::Core::MemoizedHelpers::ClassMethods + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MemoizedHelpers::ClassMethods + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/memoized_helpers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) its(attribute, &block) + + + + + + + + + + + + + +

          Creates a nested example group named by the submitted attribute, and then generates an example using the submitted block.

          +
          + +
        • + + +
        • + + + - (Object) let(name, &block) + + + + + + + + + + + + + +

          Generates a method whose return value is memoized after the first call.

          +
          + +
        • + + +
        • + + + - (Object) let!(name, &block) + + + + + + + + + + + + + +

          Just like let, except the block is invoked by an implicit before hook.

          +
          + +
        • + + +
        • + + + - (Object) subject(name = nil, &block) + + + + + + + + + + + + + +

          Declares a subject for an example group which can then be the implicit receiver (through delegation) of calls to should.

          +
          + +
        • + + +
        • + + + - (Object) subject!(name = nil, &block) + + + + + + + + + + + + + +

          Just like subject, except the block is invoked by an implicit before hook.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) its(attribute, &block) + + + + + +

        +
        +

        Creates a nested example group named by the submitted attribute, +and then generates an example using the submitted block.

        + +

        The attribute can be a Symbol or a String. Given a String +with dots, the result is as though you concatenated that String +onto the subject in an expression.

        + +

        When the subject is a Hash, you can refer to the Hash keys by +specifying a Symbol or String in an array.

        + +

        Note that this method does not modify subject in any way, so if you +refer to subject in let or before blocks, you're still +referring to the outer subject.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +# This ...
        +describe Array do
        +  its(:size) { should eq(0) }
        +end
        +
        +# ... generates the same runtime structure as this:
        +describe Array do
        +  describe "size" do
        +    it "should eq(0)" do
        +      subject.size.should eq(0)
        +    end
        +  end
        +end
        + + +
        
        +describe Person do
        +  subject do
        +    Person.new.tap do |person|
        +      person.phone_numbers << "555-1212"
        +    end
        +  end
        +
        +  its("phone_numbers.first") { should eq("555-1212") }
        +end
        + + +
        
        +describe "a configuration Hash" do
        +  subject do
        +    { :max_users => 3,
        +      'admin' => :all_permissions }
        +  end
        +
        +  its([:max_users]) { should eq(3) }
        +  its(['admin']) { should eq(:all_permissions) }
        +
        +  # You can still access to its regular methods this way:
        +  its(:keys) { should include(:max_users) }
        +  its(:count) { should eq(2) }
        +end
        + + +
        
        +describe Person do
        +  subject { Person.new }
        +  before { subject.age = 25 }
        +  its(:age) { should eq(25) }
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +426
        +427
        +428
        +429
        +430
        +431
        +432
        +433
        +434
        +435
        +436
        +437
        +438
        +439
        +440
        +441
        +442
        +443
        +444
        +445
        +446
        +447
        +448
        +449
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 426
        +
        +def its(attribute, &block)
        +  describe(attribute) do
        +    if Array === attribute
        +      let(:__its_subject) { subject[*attribute] }
        +    else
        +      let(:__its_subject) do
        +        attribute_chain = attribute.to_s.split('.')
        +        attribute_chain.inject(subject) do |inner_subject, attr|
        +          inner_subject.send(attr)
        +        end
        +      end
        +    end
        +
        +    def should(matcher=nil, message=nil)
        +      RSpec::Expectations::PositiveExpectationHandler.handle_matcher(__its_subject, matcher, message)
        +    end
        +
        +    def should_not(matcher=nil, message=nil)
        +      RSpec::Expectations::NegativeExpectationHandler.handle_matcher(__its_subject, matcher, message)
        +    end
        +
        +    example(&block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) let(name, &block) + + + + + +

        +
        + +
        + Note: +

        let can enhance readability when used sparingly (1,2, or +maybe 3 declarations) in any given example group, but that can +quickly degrade with overuse. YMMV.

        +
        +
        + +
        + Note: +

        let uses an ||= conditional that has the potential to +behave in surprising ways in examples that spawn separate threads, +though we have yet to see this in practice. You've been warned.

        +
        +
        + +
        + Note: +

        Because let is designed to create state that is reset between +each example, and before(:all) is designed to setup state that is +shared across all examples in an example group, let is not +intended to be used in a before(:all) hook. RSpec 2.13.1 prints +a warning when you reference a let from before(:all) and we plan +to have it raise an error in RSpec 3.

        +
        +
        + +

        Generates a method whose return value is memoized after the first +call. Useful for reducing duplication between examples that assign +values to the same local variable.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe Thing do
        +  let(:thing) { Thing.new }
        +
        +  it "does something" do
        +    # first invocation, executes block, memoizes and returns result
        +    thing.do_something
        +
        +    # second invocation, returns the memoized value
        +    thing.should be_something
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +190
        +191
        +192
        +193
        +194
        +195
        +196
        +197
        +198
        +199
        +200
        +201
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 190
        +
        +def let(name, &block)
        +  # We have to pass the block directly to `define_method` to
        +  # allow it to use method constructs like `super` and `return`.
        +  raise "#let or #subject called without a block" if block.nil?
        +  MemoizedHelpers.module_for(self).send(:define_method, name, &block)
        +
        +  # Apply the memoization. The method has been defined in an ancestor
        +  # module so we can use `super` here to get the value.
        +  define_method(name) do
        +    __memoized.fetch(name) { |k| __memoized[k] = super(&nil) }
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) let!(name, &block) + + + + + +

        +
        +

        Just like let, except the block is invoked by an implicit before +hook. This serves a dual purpose of setting up state and providing a +memoized reference to that state.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +class Thing
        +  def self.count
        +    @count ||= 0
        +  end
        +
        +  def self.count=(val)
        +    @count += val
        +  end
        +
        +  def self.reset_count
        +    @count = 0
        +  end
        +
        +  def initialize
        +    self.class.count += 1
        +  end
        +end
        +
        +describe Thing do
        +  after(:each) { Thing.reset_count }
        +
        +  context "using let" do
        +    let(:thing) { Thing.new }
        +
        +    it "is not invoked implicitly" do
        +      Thing.count.should eq(0)
        +    end
        +
        +    it "can be invoked explicitly" do
        +      thing
        +      Thing.count.should eq(1)
        +    end
        +  end
        +
        +  context "using let!" do
        +    let!(:thing) { Thing.new }
        +
        +    it "is invoked implicitly" do
        +      Thing.count.should eq(1)
        +    end
        +
        +    it "returns memoized version on first invocation" do
        +      thing
        +      Thing.count.should eq(1)
        +    end
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +256
        +257
        +258
        +259
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 256
        +
        +def let!(name, &block)
        +  let(name, &block)
        +  before { __send__(name) }
        +end
        +
        +
        + +
        +

        + + - (Object) subject(name = nil, &block) + + + + + +

        +
        +

        Declares a subject for an example group which can then be the +implicit receiver (through delegation) of calls to should.

        + +

        Given a name, defines a method with that name which returns the +subject. This lets you declare the subject once and access it +implicitly in one-liners and explicitly using an intention revealing +name.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe CheckingAccount, "with $50" do
        +  subject { CheckingAccount.new(Money.new(50, :USD)) }
        +  it { should have_a_balance_of(Money.new(50, :USD)) }
        +  it { should_not be_overdrawn }
        +end
        +
        +describe CheckingAccount, "with a non-zero starting balance" do
        +  subject(:account) { CheckingAccount.new(Money.new(50, :USD)) }
        +  it { should_not be_overdrawn }
        +  it "has a balance equal to the starting balance" do
        +    .balance.should eq(Money.new(50, :USD))
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (String, Symbol) + + + (defaults to: nil) + + + — +

          used to define an accessor with an +intention revealing name

          +
          + +
        • + +
        • + + block + + + + + + + — +

          defines the value to be returned by subject in examples

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +290
        +291
        +292
        +293
        +294
        +295
        +296
        +297
        +298
        +299
        +300
        +301
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 290
        +
        +def subject(name=nil, &block)
        +  if name
        +    let(name, &block)
        +    alias_method :subject, name
        +
        +    self::NamedSubjectPreventSuper.send(:define_method, name) do
        +      raise NotImplementedError, "`super` in named subjects is not supported"
        +    end
        +  else
        +    let(:subject, &block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) subject!(name = nil, &block) + + + + + +

        +
        +

        Just like subject, except the block is invoked by an implicit before +hook. This serves a dual purpose of setting up state and providing a +memoized reference to that state.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +class Thing
        +  def self.count
        +    @count ||= 0
        +  end
        +
        +  def self.count=(val)
        +    @count += val
        +  end
        +
        +  def self.reset_count
        +    @count = 0
        +  end
        +
        +  def initialize
        +    self.class.count += 1
        +  end
        +end
        +
        +describe Thing do
        +  after(:each) { Thing.reset_count }
        +
        +  context "using subject" do
        +    subject { Thing.new }
        +
        +    it "is not invoked implicitly" do
        +      Thing.count.should eq(0)
        +    end
        +
        +    it "can be invoked explicitly" do
        +      subject
        +      Thing.count.should eq(1)
        +    end
        +  end
        +
        +  context "using subject!" do
        +    subject!(:thing) { Thing.new }
        +
        +    it "is invoked implicitly" do
        +      Thing.count.should eq(1)
        +    end
        +
        +    it "returns memoized version on first invocation" do
        +      subject
        +      Thing.count.should eq(1)
        +    end
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +356
        +357
        +358
        +359
        +
        +
        # File 'lib/rspec/core/memoized_helpers.rb', line 356
        +
        +def subject!(name=nil, &block)
        +  subject(name, &block)
        +  before { subject }
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Metadata.html b/source/documentation/2.14/rspec-core/RSpec/Core/Metadata.html new file mode 100644 index 000000000..7a42e61d8 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Metadata.html @@ -0,0 +1,382 @@ + + + + + + Class: RSpec::Core::Metadata + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Metadata + + + +

        + +
        + +
        Inherits:
        +
        + Hash + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/metadata.rb
        + +
        +
        + +

        Overview

        +
        +

        Each ExampleGroup class and Example instance owns an instance of +Metadata, which is Hash extended to support lazy evaluation of values +associated with keys that may or may not be used by any example or group.

        + +

        In addition to metadata that is used internally, this also stores +user-supplied metadata, e.g.

        + +
        describe Something, :type => :ui do
        +  it "does something", :slow => true do
        +    # ...
        +  end
        +end
        +
        + +

        :type => :ui is stored in the Metadata owned by the example group, and +:slow => true is stored in the Metadata owned by the example. These can +then be used to select which examples are run using the --tag option on +the command line, or several methods on Configuration used to filter a +run (e.g. filter_run_including, filter_run_excluding, etc).

        + + +
        +
        +

        Defined Under Namespace

        +

        + + + Modules: ExampleMetadataHash, GroupMetadataHash + + + + +

        + +

        Constant Summary

        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Metadata) initialize(parent_group_metadata = nil) {|_self| ... } + + + + + +

        +
        +

        Returns a new instance of Metadata

        + + +
        +
        +
        + +

        Yields:

        +
          + +
        • + + + (_self) + + + +
        • + +
        +

        Yield Parameters:

        +
          + +
        • + + _self + + + (RSpec::Core::Metadata) + + + + — +

          the object that the method was called on

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +163
        +164
        +165
        +166
        +167
        +168
        +169
        +170
        +171
        +172
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 163
        +
        +def initialize(=nil)
        +  if 
        +    update()
        +    store(:example_group, {:example_group => [:example_group].extend(GroupMetadataHash)}.extend(GroupMetadataHash))
        +  else
        +    store(:example_group, {}.extend(GroupMetadataHash))
        +  end
        +
        +  yield self if block_given?
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) relative_path(line) + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 29
        +
        +def self.relative_path(line)
        +  line = line.sub(File.expand_path("."), ".")
        +  line = line.sub(/\A([^:]+:\d+)$/, '\\1')
        +  return nil if line == '-e:1'
        +  line
        +rescue SecurityError
        +  nil
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Metadata/ExampleMetadataHash.html b/source/documentation/2.14/rspec-core/RSpec/Core/Metadata/ExampleMetadataHash.html new file mode 100644 index 000000000..a67f6d7e8 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Metadata/ExampleMetadataHash.html @@ -0,0 +1,243 @@ + + + + + + Module: RSpec::Core::Metadata::ExampleMetadataHash + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Metadata::ExampleMetadataHash + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/metadata.rb
        + +
        +
        + +

        Overview

        +
        +

        Mixed in to Metadata for an Example (extends MetadataHash) to support +lazy evaluation of some values.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) described_class + + + + + +

        + + + + +
        +
        +
        +
        +115
        +116
        +117
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 115
        +
        +def described_class
        +  self[:example_group].described_class
        +end
        +
        +
        + +
        +

        + + - (Object) full_description + + + + + +

        + + + + +
        +
        +
        +
        +119
        +120
        +121
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 119
        +
        +def full_description
        +  build_description_from(self[:example_group][:full_description], *self[:description_args])
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Metadata/GroupMetadataHash.html b/source/documentation/2.14/rspec-core/RSpec/Core/Metadata/GroupMetadataHash.html new file mode 100644 index 000000000..a195e6b04 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Metadata/GroupMetadataHash.html @@ -0,0 +1,337 @@ + + + + + + Module: RSpec::Core::Metadata::GroupMetadataHash + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Metadata::GroupMetadataHash + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/metadata.rb
        + +
        +
        + +

        Overview

        +
        +

        Mixed in to Metadata for an ExampleGroup (extends MetadataHash) to +support lazy evaluation of some values.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) container_stack + + + + + +

        + + + + +
        +
        +
        +
        +151
        +152
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 151
        +
        +def container_stack
        +  @container_stack ||= begin
        +                         groups = [group = self]
        +                         while group.has_key?(:example_group)
        +                           groups << group[:example_group]
        +                           group = group[:example_group]
        +                         end
        +                         groups
        +                       end
        +end
        +
        +
        + +
        +

        + + - (Object) described_class + + + + + +

        + + + + +
        +
        +
        +
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 129
        +
        +def described_class
        +  container_stack.each do |g|
        +    [:described_class, :describes].each do |key|
        +      if g.has_key?(key)
        +        value = g[key]
        +        return value unless value.nil?
        +      end
        +    end
        +  end
        +
        +  container_stack.reverse.each do |g|
        +    candidate = g[:description_args].first
        +    return candidate unless String === candidate || Symbol === candidate
        +  end
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + - (Object) full_description + + + + + +

        + + + + +
        +
        +
        +
        +147
        +148
        +149
        +
        +
        # File 'lib/rspec/core/metadata.rb', line 147
        +
        +def full_description
        +  build_description_from(*container_stack.reverse.map {|a| a[:description_args]}.flatten)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/MockFrameworkAdapter.html b/source/documentation/2.14/rspec-core/RSpec/Core/MockFrameworkAdapter.html new file mode 100644 index 000000000..bbbeecd31 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/MockFrameworkAdapter.html @@ -0,0 +1,401 @@ + + + + + + Module: RSpec::Core::MockFrameworkAdapter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::MockFrameworkAdapter + + + +

        + +
        + + + + + +
        Includes:
        +
        FlexMock::MockContainer, RR::Extensions::InstanceMethods
        + + + + + +
        Defined in:
        +
        lib/rspec/core/mocking/with_rr.rb,
        + lib/rspec/core/mocking/with_rspec.rb,
        lib/rspec/core/mocking/with_mocha.rb,
        lib/rspec/core/mocking/with_flexmock.rb,
        lib/rspec/core/mocking/with_absolutely_nothing.rb
        +
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) configuration + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/core/mocking/with_rspec.rb', line 9
        +
        +def self.configuration
        +  RSpec::Mocks.configuration
        +end
        +
        +
        + +
        +

        + + + (Object) framework_name + + + + + +

        + + + + +
        +
        +
        +
        +9
        +
        +
        # File 'lib/rspec/core/mocking/with_rr.rb', line 9
        +
        +def self.framework_name; :rr end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) setup_mocks_for_rspec + + + + + +

        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/core/mocking/with_rr.rb', line 13
        +
        +def setup_mocks_for_rspec
        +  RR::Space.instance.reset
        +end
        +
        +
        + +
        +

        + + - (Object) teardown_mocks_for_rspec + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/core/mocking/with_rr.rb', line 21
        +
        +def teardown_mocks_for_rspec
        +  RR::Space.instance.reset
        +end
        +
        +
        + +
        +

        + + - (Object) verify_mocks_for_rspec + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/core/mocking/with_rr.rb', line 17
        +
        +def verify_mocks_for_rspec
        +  RR::Space.instance.verify_doubles
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Parser.html b/source/documentation/2.14/rspec-core/RSpec/Core/Parser.html new file mode 100644 index 000000000..36b4f1f44 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Parser.html @@ -0,0 +1,800 @@ + + + + + + Class: RSpec::Core::Parser + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Parser + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/option_parser.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) parse + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 11
        +
        +def self.parse!(args)
        +  new.parse!(args)
        +end
        +
        +
        + +
        +

        + + + (Object) parse!(args) + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 6
        +
        +def self.parse!(args)
        +  new.parse!(args)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) convert_deprecated_args(args) + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 29
        +
        +def convert_deprecated_args(args)
        +  args.map! { |arg|
        +    case arg
        +    when "--formatter"
        +      RSpec.deprecate("the --formatter option", :replacement => "-f or --format")
        +      "--format"
        +    when "--default_path"
        +      "--default-path"
        +    when "--line_number"
        +      "--line-number"
        +    else
        +      arg
        +    end
        +  }
        +end
        +
        +
        + +
        +

        + + - (Object) parse!(args) + + + + Also known as: + parse + + + + +

        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 14
        +
        +def parse!(args)
        +  return {} if args.empty?
        +
        +  convert_deprecated_args(args)
        +
        +  options = args.delete('--tty') ? {:tty => true} : {}
        +  begin
        +    parser(options).parse!(args)
        +  rescue OptionParser::InvalidOption => e
        +    abort "#{e.message}\n\nPlease use --help for a listing of valid options"
        +  end
        +
        +  options
        +end
        +
        +
        + +
        +

        + + - (Object) parser(options) + + + + + +

        + + + + +
        +
        +
        +
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +165
        +166
        +167
        +168
        +169
        +170
        +171
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +182
        +183
        +184
        +185
        +186
        +187
        +188
        +189
        +190
        +191
        +192
        +193
        +194
        +195
        +196
        +197
        +198
        +199
        +200
        +201
        +202
        +203
        +204
        +205
        +206
        +207
        +208
        +209
        +210
        +211
        +212
        +213
        +214
        +215
        +216
        +217
        +
        +
        # File 'lib/rspec/core/option_parser.rb', line 47
        +
        +def parser(options)
        +  OptionParser.new do |parser|
        +    parser.banner = "Usage: rspec [options] [files or directories]\n\n"
        +
        +    parser.on('-I PATH', 'Specify PATH to add to $LOAD_PATH (may be used more than once).') do |dir|
        +      options[:libs] ||= []
        +      options[:libs] << dir
        +    end
        +
        +    parser.on('-r', '--require PATH', 'Require a file.') do |path|
        +      options[:requires] ||= []
        +      options[:requires] << path
        +    end
        +
        +    parser.on('-O', '--options PATH', 'Specify the path to a custom options file.') do |path|
        +      options[:custom_options_file] = path
        +    end
        +
        +    parser.on('--order TYPE[:SEED]', 'Run examples by the specified order type.',
        +              '  [default] files are ordered based on the underlying file',
        +              '            system\'s order',
        +              '  [rand]    randomize the order of files, groups and examples',
        +              '  [random]  alias for rand',
        +              '  [random:SEED] e.g. --order random:123') do |o|
        +      options[:order] = o
        +    end
        +
        +    parser.on('--seed SEED', Integer, 'Equivalent of --order rand:SEED.') do |seed|
        +      options[:order] = "rand:#{seed}"
        +    end
        +
        +    parser.on('-d', '--debugger', 'Enable debugging.') do |o|
        +      options[:debug] = true
        +    end
        +
        +    parser.on('--fail-fast', 'Abort the run on first failure.') do |o|
        +      options[:fail_fast] = true
        +    end
        +
        +    parser.on('--failure-exit-code CODE', Integer, 'Override the exit code used when there are failing specs.') do |code|
        +      options[:failure_exit_code] = code
        +    end
        +
        +    parser.on('-X', '--[no-]drb', 'Run examples via DRb.') do |o|
        +      options[:drb] = o
        +    end
        +
        +    parser.on('--drb-port PORT', 'Port to connect to the DRb server.') do |o|
        +      options[:drb_port] = o.to_i
        +    end
        +
        +    parser.on('--init', 'Initialize your project with RSpec.') do |cmd|
        +      ProjectInitializer.new(cmd).run
        +      exit
        +    end
        +
        +    parser.on('--configure', 'Deprecated. Use --init instead.') do |cmd|
        +      warn "--configure is deprecated with no effect. Use --init instead."
        +      exit
        +    end
        +
        +    parser.separator("\n  **** Output ****\n\n")
        +
        +    parser.on('-f', '--format FORMATTER', 'Choose a formatter.',
        +            '  [p]rogress (default - dots)',
        +            '  [d]ocumentation (group and example names)',
        +            '  [h]tml',
        +            '  [t]extmate',
        +            '  [j]son',
        +            '  custom formatter class name') do |o|
        +      options[:formatters] ||= []
        +      options[:formatters] << [o]
        +    end
        +
        +    parser.on('-o', '--out FILE',
        +              'Write output to a file instead of $stdout. This option applies',
        +              '  to the previously specified --format, or the default format',
        +              '  if no format is specified.'
        +             ) do |o|
        +      options[:formatters] ||= [['progress']]
        +      options[:formatters].last << o
        +    end
        +
        +    parser.on('-b', '--backtrace', 'Enable full backtrace.') do |o|
        +      options[:full_backtrace] = true
        +    end
        +
        +    parser.on('-c', '--[no-]color', '--[no-]colour', 'Enable color in the output.') do |o|
        +      options[:color] = o
        +    end
        +
        +    parser.on('-p', '--[no-]profile [COUNT]', 'Enable profiling of examples and list the slowest examples (default: 10).') do |argument|
        +      options[:profile_examples] = if argument.nil?
        +                                     true
        +                                   elsif argument == false
        +                                     false
        +                                   else
        +                                     begin
        +                                       Integer(argument)
        +                                     rescue ArgumentError
        +                                       Kernel.warn "Non integer specified as profile count, seperate " +
        +                                                   "your path from options with -- e.g. " +
        +                                                   "`rspec --profile -- #{argument}`"
        +                                       true
        +                                     end
        +                                   end
        +    end
        +
        +    parser.on('-w', '--warnings', 'Enable ruby warnings') do
        +      options[:warnings] = true
        +    end
        +
        +    parser.separator <<-FILTERING
        +
        +  **** Filtering/tags ****
        +
        +In addition to the following options for selecting specific files, groups,
        +or examples, you can select a single example by appending the line number to
        +the filename:
        +
        +  rspec path/to/a_spec.rb:37
        +
        +FILTERING
        +
        +    parser.on('-P', '--pattern PATTERN', 'Load files matching pattern (default: "spec/**/*_spec.rb").') do |o|
        +      options[:pattern] = o
        +    end
        +
        +    parser.on('-e', '--example STRING', "Run examples whose full nested names include STRING (may be",
        +                                        "  used more than once)") do |o|
        +      (options[:full_description] ||= []) << Regexp.compile(Regexp.escape(o))
        +    end
        +
        +    parser.on('-l', '--line-number LINE', 'Specify line number of an example or group (may be',
        +                                          '  used more than once).') do |o|
        +      (options[:line_numbers] ||= []) << o
        +    end
        +
        +    parser.on('-t', '--tag TAG[:VALUE]',
        +              'Run examples with the specified tag, or exclude examples',
        +              'by adding ~ before the tag.',
        +              '  - e.g. ~slow',
        +              '  - TAG is always converted to a symbol') do |tag|
        +      filter_type = tag =~ /^~/ ? :exclusion_filter : :inclusion_filter
        +
        +      name,value = tag.gsub(/^(~@|~|@)/, '').split(':')
        +      name = name.to_sym
        +
        +      options[filter_type] ||= {}
        +      options[filter_type][name] = value.nil? ? true : eval(value) rescue value
        +    end
        +
        +    parser.on('--default-path PATH', 'Set the default path where RSpec looks for examples (can',
        +                                     '  be a path to a file or a directory).') do |path|
        +      options[:default_path] = path
        +    end
        +
        +    parser.separator("\n  **** Utility ****\n\n")
        +
        +    parser.on('-v', '--version', 'Display the version.') do
        +      puts RSpec::Core::Version::STRING
        +      exit
        +    end
        +
        +    parser.on_tail('-h', '--help', "You're looking at it.") do
        +      puts parser
        +      exit
        +    end
        +
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Pending.html b/source/documentation/2.14/rspec-core/RSpec/Core/Pending.html new file mode 100644 index 000000000..255038274 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Pending.html @@ -0,0 +1,390 @@ + + + + + + Module: RSpec::Core::Pending + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Pending + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/pending.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: PendingDeclaredInExample + + +

        + +

        Constant Summary

        + +
        + +
        NO_REASON_GIVEN = + +
        +
        'No reason given'
        + +
        NOT_YET_IMPLEMENTED = + +
        +
        'Not yet implemented'
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) pending(*args) + + + + + + + + + + + + + +

          Stops execution of an example, and reports it as pending.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + + - (Object) pending + + - (Object) pending(message) + + - (Object) pending(message, &block) + + + + + + +

        +
        + +
        + Note: +

        before(:each) hooks are eval'd when you use the pending +method within an example. If you want to declare an example pending +and bypass the before hooks as well, you can pass :pending => true +to the it method:

        + +
        it "does something", :pending => true do
        +  # ...
        +end
        +
        + +

        or pass :pending => "something else getting finished" to add a +message to the summary report:

        + +
        it "does something", :pending => "something else getting finished" do
        +  # ...
        +end
        +
        +
        +
        + +

        Stops execution of an example, and reports it as pending. Takes an +optional message and block.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +describe "an example" do
        +  # reported as "Pending: no reason given"
        +  it "is pending with no message" do
        +    pending
        +    this_does_not_get_executed
        +  end
        +
        +  # reported as "Pending: something else getting finished"
        +  it "is pending with a custom message" do
        +    pending("something else getting finished")
        +    this_does_not_get_executed
        +  end
        +
        +  # reported as "Pending: something else getting finished"
        +  it "is pending with a failing block" do
        +    pending("something else getting finished") do
        +      raise "this is the failure"
        +    end
        +  end
        +
        +  # reported as failure, saying we expected the block to fail but
        +  # it passed.
        +  it "is pending with a passing block" do
        +    pending("something else getting finished") do
        +      true.should be(true)
        +    end
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + + — +

          optional message to add to the summary report.

          +
          + +
        • + +
        • + + block + + + (Block) + + + + — +

          optional block. If it fails, the example is +reported as pending. If it executes cleanly the example fails.

          +
          + +
        • + +
        + +

        Raises:

        + + +
        + + + + +
        +
        +
        +
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/core/pending.rb', line 74
        +
        +def pending(*args)
        +  return self.class.before(:each) { pending(*args) } unless example
        +
        +  options = args.last.is_a?(Hash) ? args.pop : {}
        +  message = args.first || NO_REASON_GIVEN
        +
        +  if options[:unless] || (options.has_key?(:if) && !options[:if])
        +    return block_given? ? yield : nil
        +  end
        +
        +  example.[:pending] = true
        +  example.[:execution_result][:pending_message] = message
        +  example.execution_result[:pending_fixed] = false
        +  if block_given?
        +    begin
        +      result = begin
        +                 yield
        +                 example.example_group_instance.instance_eval { verify_mocks_for_rspec }
        +                 true
        +               end
        +      example.[:pending] = false
        +    rescue Exception => e
        +      example.execution_result[:exception] = e
        +    ensure
        +      teardown_mocks_for_rspec
        +    end
        +    if result
        +      example.execution_result[:pending_fixed] = true
        +      raise PendingExampleFixedError.new
        +    end
        +  end
        +  raise PendingDeclaredInExample.new(message)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Pending/PendingDeclaredInExample.html b/source/documentation/2.14/rspec-core/RSpec/Core/Pending/PendingDeclaredInExample.html new file mode 100644 index 000000000..d34e29381 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Pending/PendingDeclaredInExample.html @@ -0,0 +1,123 @@ + + + + + + Exception: RSpec::Core::Pending::PendingDeclaredInExample + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Exception: RSpec::Core::Pending::PendingDeclaredInExample + + + +

        + +
        + +
        Inherits:
        +
        + StandardError + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/pending.rb
        + +
        +
        + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/ProjectInitializer.html b/source/documentation/2.14/rspec-core/RSpec/Core/ProjectInitializer.html new file mode 100644 index 000000000..9c92bf9ce --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/ProjectInitializer.html @@ -0,0 +1,622 @@ + + + + + + Class: RSpec::Core::ProjectInitializer + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::ProjectInitializer + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/project_initializer.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ProjectInitializer) initialize(arg = nil) + + + + + +

        +
        +

        Returns a new instance of ProjectInitializer

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 4
        +
        +def initialize(arg=nil)
        +  @arg = arg
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) create_dot_rspec_file + + + + + +

        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 22
        +
        +def create_dot_rspec_file
        +  if File.exist?('.rspec')
        +    report_exists('.rspec')
        +  else
        +    report_creating('.rspec')
        +    File.open('.rspec','w') do |f|
        +      f.write <<-CONTENT
        +--color
        +--format progress
        +CONTENT
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) create_spec_helper_file + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 36
        +
        +def create_spec_helper_file
        +  if File.exist?('spec/spec_helper.rb')
        +    report_exists("spec/spec_helper.rb")
        +  else
        +    report_creating("spec/spec_helper.rb")
        +    FileUtils.mkdir_p('spec')
        +    File.open('spec/spec_helper.rb','w') do |f|
        +      f.write <<-CONTENT
        +# This file was generated by the `rspec --init` command. Conventionally, all
        +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
        +# Require this file using `require "spec_helper"` to ensure that it is only
        +# loaded once.
        +#
        +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
        +RSpec.configure do |config|
        +  config.treat_symbols_as_metadata_keys_with_true_values = true
        +  config.run_all_when_everything_filtered = true
        +  config.filter_run :focus
        +
        +  # Run specs in random order to surface order dependencies. If you find an
        +  # order dependency and want to debug it, you can fix the order by providing
        +  # the seed, which is printed after each run.
        +  #     --seed 1234
        +  config.order = 'random'
        +end
        +CONTENT
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) delete_if_confirmed(path, message) + + + + + +

        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 66
        +
        +def delete_if_confirmed(path, message)
        +  if File.exist?(path)
        +    puts
        +    puts message
        +    puts
        +    puts "  delete   #{path}? [y/n]"
        +    FileUtils.rm_rf(path) if gets =~ /y/i
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) report_creating(file) + + + + + +

        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 80
        +
        +def report_creating(file)
        +  puts "  create   #{file}"
        +end
        +
        +
        + +
        +

        + + - (Object) report_exists(file) + + + + + +

        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 76
        +
        +def report_exists(file)
        +  puts "   exist   #{file}"
        +end
        +
        +
        + +
        +

        + + - (Object) run + + + + + +

        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/project_initializer.rb', line 8
        +
        +def run
        +  create_spec_helper_file
        +  create_dot_rspec_file
        +  delete_if_confirmed("autotest/discover.rb", <<-MESSAGE)
        +  RSpec registers its own discover.rb with Autotest, so autotest/discover.rb is
        +  no longer needed.
        +  MESSAGE
        +
        +  delete_if_confirmed("lib/tasks/rspec.rake", <<-MESSAGE)
        +  If the file in lib/tasks/rspec.rake is the one generated by rspec-rails-1x,
        +  you can get rid of it, as it is no longer needed with rspec-2.
        +  MESSAGE
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/RakeTask.html b/source/documentation/2.14/rspec-core/RSpec/Core/RakeTask.html new file mode 100644 index 000000000..f98a06087 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/RakeTask.html @@ -0,0 +1,1425 @@ + + + + + + Class: RSpec::Core::RakeTask + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::RakeTask + + + +

        + +
        + +
        Inherits:
        +
        + Rake::TaskLib + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Rake::DSL
        + + + + + +
        Defined in:
        +
        lib/rspec/core/rake_task.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) fail_on_error + + + + + + + + + + + + + + + + +

          Whether or not to fail Rake when an error occurs (typically when examples fail).

          +
          + +
        • + + +
        • + + + - (Object) failure_message + + + + + + + + + + + + + + + + +

          A message to print to stderr when there are failures.

          +
          + +
        • + + +
        • + + + - (Object) name + + + + + + + + + + + + + + + + +

          Name of task.

          +
          + +
        • + + +
        • + + + - (Object) pattern + + + + + + + + + + + + + + + + +

          Glob pattern to match files.

          +
          + +
        • + + +
        • + + + - (Object) rcov + + + + + + + + + + + + + + + + +

          Use rcov for code coverage?.

          +
          + +
        • + + +
        • + + + - (Object) rcov_opts + + + + + + + + + + + + + + + + +

          Command line options to pass to rcov.

          +
          + +
        • + + +
        • + + + - (Object) rcov_path + + + + + + + + + + + + + + + + +

          Path to rcov.

          +
          + +
        • + + +
        • + + + - (Object) rspec_opts + + + + + + + + + + + + + + + + +

          Command line options to pass to rspec.

          +
          + +
        • + + +
        • + + + - (Object) rspec_path + + + + + + + + + + + + + + + + +

          Path to rspec.

          +
          + +
        • + + +
        • + + + - (Object) ruby_opts + + + + + + + + + + + + + + + + +

          Command line options to pass to ruby.

          +
          + +
        • + + +
        • + + + - (Object) verbose + + + + + + + + + + + + + + + + +

          Use verbose output.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (RakeTask) initialize(*args, &task_block) + + + + + +

        +
        +

        Returns a new instance of RakeTask

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 115
        +
        +def initialize(*args, &task_block)
        +  setup_ivars(args)
        +
        +  desc "Run RSpec code examples" unless ::Rake.application.last_comment
        +
        +  task name, *args do |_, task_args|
        +    RakeFileUtils.send(:verbose, verbose) do
        +      task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
        +      run_task verbose
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) fail_on_error + + + + + +

        +
        +

        Whether or not to fail Rake when an error occurs (typically when examples fail).

        + +

        default: + true

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +52
        +53
        +54
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 52
        +
        +def fail_on_error
        +  @fail_on_error
        +end
        +
        +
        + + + +
        +

        + + - (Object) failure_message + + + + + +

        +
        +

        A message to print to stderr when there are failures.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 55
        +
        +def failure_message
        +  @failure_message
        +end
        +
        +
        + + + +
        +

        + + - (Object) name + + + + + +

        +
        +

        Name of task.

        + +

        default: + :spec

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 15
        +
        +def name
        +  @name
        +end
        +
        +
        + + + +
        +

        + + - (Object) pattern + + + + + +

        +
        +

        Glob pattern to match files.

        + +

        default: + 'spec/*/_spec.rb'

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 21
        +
        +def pattern
        +  @pattern
        +end
        +
        +
        + + + +
        +

        + + - (Object) rcov + + + + + +

        +
        +

        Use rcov for code coverage?

        + +

        Due to the many ways rcov can run, if this option is enabled, it is +required that require 'rspec/autorun' appears in spec_helper.rb

        + +

        default: + false

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +71
        +72
        +73
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 71
        +
        +def rcov
        +  @rcov
        +end
        +
        +
        + + + +
        +

        + + - (Object) rcov_opts + + + + + +

        +
        +

        Command line options to pass to rcov.

        + +

        default: + nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 83
        +
        +def rcov_opts
        +  @rcov_opts
        +end
        +
        +
        + + + +
        +

        + + - (Object) rcov_path + + + + + +

        +
        +

        Path to rcov.

        + +

        default: + 'rcov'

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 77
        +
        +def rcov_path
        +  @rcov_path
        +end
        +
        +
        + + + +
        +

        + + - (Object) rspec_opts + + + + + +

        +
        +

        Command line options to pass to rspec.

        + +

        default: + nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 101
        +
        +def rspec_opts
        +  @rspec_opts
        +end
        +
        +
        + + + +
        +

        + + - (Object) rspec_path + + + + + +

        +
        +

        Path to rspec

        + +

        default: + 'rspec'

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 95
        +
        +def rspec_path
        +  @rspec_path
        +end
        +
        +
        + + + +
        +

        + + - (Object) ruby_opts + + + + + +

        +
        +

        Command line options to pass to ruby.

        + +

        default: + nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 89
        +
        +def ruby_opts
        +  @ruby_opts
        +end
        +
        +
        + + + +
        +

        + + - (Object) verbose + + + + + +

        +
        +

        Use verbose output. If this is set to true, the task will print the +executed spec command to stdout.

        + +

        default: + true

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 62
        +
        +def verbose
        +  @verbose
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) gemfile= + + + + + +

        +
        +
        Deprecated.
        +

        Has no effect. The rake task now checks ENV['BUNDLE_GEMFILE'] instead.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 31
        +
        +def gemfile=(*)
        +  deprecate("RSpec::Core::RakeTask#gemfile=", :replacement => 'ENV["BUNDLE_GEMFILE"]')
        +end
        +
        +
        + +
        +

        + + - (Object) run_task(verbose) + + + + + +

        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 139
        +
        +def run_task(verbose)
        +  command = spec_command
        +
        +  begin
        +    puts command if verbose
        +    success = system(command)
        +  rescue
        +    puts failure_message if failure_message
        +  end
        +  abort("#{command} failed") if fail_on_error unless success
        +end
        +
        +
        + +
        +

        + + - (Object) setup_ivars(args) + + + + + +

        + + + + +
        +
        +
        +
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 128
        +
        +def setup_ivars(args)
        +  @name = args.shift || :spec
        +  @rcov_opts, @ruby_opts, @rspec_opts = nil, nil, nil
        +  @warning, @rcov = false, false
        +  @verbose, @fail_on_error = true, true
        +
        +  @rcov_path  = 'rcov'
        +  @rspec_path = 'rspec'
        +  @pattern    = './spec{,/*/**}/*_spec.rb'
        +end
        +
        +
        + +
        +

        + + - (Object) skip_bundler= + + + + + +

        +
        +
        Deprecated.
        +

        Has no effect. The rake task now checks ENV['BUNDLE_GEMFILE'] instead.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 25
        +
        +def skip_bundler=(*)
        +  deprecate("RSpec::Core::RakeTask#skip_bundler=")
        +end
        +
        +
        + +
        +

        + + - (Object) spec_opts=(opts) + + + + + +

        +
        +
        Deprecated.
        +

        Use rspec_opts instead.

        + +

        Command line options to pass to rspec.

        + +

        default: + nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +110
        +111
        +112
        +113
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 110
        +
        +def spec_opts=(opts)
        +  deprecate('RSpec::Core::RakeTask#spec_opts=', :replacement => 'rspec_opts=')
        +  @rspec_opts = opts
        +end
        +
        +
        + +
        +

        + + - (Object) warning=(true_or_false) + + + + + +

        +
        +
        Deprecated.
        +

        Use ruby_opts="-w" instead.

        + +

        When true, requests that the specs be run with the warning flag set. +e.g. "ruby -w"

        + +

        default: + false

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +46
        +
        +
        # File 'lib/rspec/core/rake_task.rb', line 43
        +
        +def warning=(true_or_false)
        +  deprecate("RSpec::Core::RakeTask#warning=", :replacement => 'ruby_opts="-w"')
        +  @warning = true_or_false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Reporter.html b/source/documentation/2.14/rspec-core/RSpec/Core/Reporter.html new file mode 100644 index 000000000..614784905 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Reporter.html @@ -0,0 +1,1196 @@ + + + + + + Class: RSpec::Core::Reporter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Reporter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/reporter.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        NOTIFICATIONS = + +
        +
        start message example_group_started example_group_finished example_started
        +example_passed example_failed example_pending start_dump dump_pending
        +dump_failures dump_summary seed close stop deprecation deprecation_summary].map { |n| n.to_sym }
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Reporter) initialize(*formatters) + + + + + +

        +
        +

        Returns a new instance of Reporter

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 7
        +
        +def initialize(*formatters)
        +  @listeners = Hash.new { |h,k| h[k] = [] }
        +  formatters.each do |formatter|
        +    register_listener(formatter, *NOTIFICATIONS)
        +  end
        +  @example_count = @failure_count = @pending_count = 0
        +  @duration = @start = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) deprecation(message) + + + + + +

        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 100
        +
        +def deprecation(message)
        +  notify :deprecation, message
        +end
        +
        +
        + +
        +

        + + - (Object) example_failed(example) + + + + + +

        + + + + +
        +
        +
        +
        +90
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 90
        +
        +def example_failed(example)
        +  @failure_count += 1
        +  notify :example_failed, example
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_finished(group) + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 77
        +
        +def example_group_finished(group)
        +  notify :example_group_finished, group unless group.descendant_filtered_examples.empty?
        +end
        +
        +
        + +
        +

        + + - (Object) example_group_started(group) + + + + + +

        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 73
        +
        +def example_group_started(group)
        +  notify :example_group_started, group unless group.descendant_filtered_examples.empty?
        +end
        +
        +
        + +
        +

        + + - (Object) example_passed(example) + + + + + +

        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 86
        +
        +def example_passed(example)
        +  notify :example_passed, example
        +end
        +
        +
        + +
        +

        + + - (Object) example_pending(example) + + + + + +

        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +98
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 95
        +
        +def example_pending(example)
        +  @pending_count += 1
        +  notify :example_pending, example
        +end
        +
        +
        + +
        +

        + + - (Object) example_started(example) + + + + + +

        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 81
        +
        +def example_started(example)
        +  @example_count += 1
        +  notify :example_started, example
        +end
        +
        +
        + +
        +

        + + - (Object) finish(seed) + + + + Also known as: + abort + + + + +

        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 104
        +
        +def finish(seed)
        +  begin
        +    stop
        +    notify :start_dump
        +    notify :dump_pending
        +    notify :dump_failures
        +    notify :dump_summary, @duration, @example_count, @failure_count, @pending_count
        +    notify :deprecation_summary
        +    notify :seed, seed if seed
        +  ensure
        +    notify :close
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) message(message) + + + + + +

        + + + + +
        +
        +
        +
        +69
        +70
        +71
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 69
        +
        +def message(message)
        +  notify :message, message
        +end
        +
        +
        + +
        +

        + + - (Object) notify(event, *args, &block) + + + + + +

        + + + + +
        +
        +
        +
        +125
        +126
        +127
        +128
        +129
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 125
        +
        +def notify(event, *args, &block)
        +  registered_listeners(event).each do |formatter|
        +    formatter.send(event, *args, &block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) register_listener(listener, *notifications) + + + + + +

        +
        +

        Registers a listener to a list of notifications. The reporter will send notification of +events to all registered listeners

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + An + + + (Object) + + + + — +

          obect that wishes to be notified of reporter events

          +
          + +
        • + +
        • + + Array + + + (Array) + + + + — +

          of symbols represents the events a listener wishes to subscribe too

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 22
        +
        +def register_listener(listener, *notifications)
        +  notifications.each do |notification|
        +    @listeners[notification.to_sym] << listener if listener.respond_to?(notification)
        +  end
        +  true
        +end
        +
        +
        + +
        +

        + + - (Object) registered_listeners(notification) + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 29
        +
        +def registered_listeners(notification)
        +  @listeners[notification]
        +end
        +
        +
        + +
        +

        + + + - (Object) report(count, &block) + + - (Object) report(count, seed, &block) + + + + + + +

        +
        +

        Initializes the report run and yields itself for further reporting. The +block is required, so that the reporter can manage cleaning up after the +run.

        + +

        Warning:

        + +

        The seed argument is an internal API and is not guaranteed to be +supported in the future.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +reporter.report(group.examples.size) do |r|
        +  example_groups.map {|g| g.run(r) }
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + count + + + (Integer) + + + + — +

          the number of examples being run

          +
          + +
        • + +
        • + + seed + + + (Integer) + + + (defaults to: nil) + + + — +

          the seed used to randomize the spec run

          +
          + +
        • + +
        • + + block + + + (Block) + + + + — +

          yields itself for further reporting.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 55
        +
        +def report(expected_example_count, seed=nil)
        +  start(expected_example_count)
        +  begin
        +    yield self
        +  ensure
        +    finish(seed)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) start(expected_example_count) + + + + + +

        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 64
        +
        +def start(expected_example_count)
        +  @start = RSpec::Core::Time.now
        +  notify :start, expected_example_count
        +end
        +
        +
        + +
        +

        + + - (Object) stop + + + + + +

        + + + + +
        +
        +
        +
        +120
        +121
        +122
        +123
        +
        +
        # File 'lib/rspec/core/reporter.rb', line 120
        +
        +def stop
        +  @duration = (RSpec::Core::Time.now - @start).to_f if @start
        +  notify :stop
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/RubyProject.html b/source/documentation/2.14/rspec-core/RSpec/Core/RubyProject.html new file mode 100644 index 000000000..7908dba8e --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/RubyProject.html @@ -0,0 +1,438 @@ + + + + + + Module: RSpec::Core::RubyProject + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::RubyProject + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/ruby_project.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) add_dir_to_load_path(dir) + + + + + +

        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 14
        +
        +def add_dir_to_load_path(dir)
        +  $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)
        +end
        +
        +
        + +
        +

        + + + (Object) add_to_load_path(*dirs) + + + + + +

        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 10
        +
        +def add_to_load_path(*dirs)
        +  dirs.map {|dir| add_dir_to_load_path(File.join(root, dir))}
        +end
        +
        +
        + +
        +

        + + + (Object) ascend_until + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 30
        +
        +def ascend_until
        +  Pathname(File.expand_path('.')).ascend do |path|
        +    return path if yield(path)
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) determine_root + + + + + +

        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 22
        +
        +def determine_root
        +  find_first_parent_containing('spec') || '.'
        +end
        +
        +
        + +
        +

        + + + (Object) find_first_parent_containing(dir) + + + + + +

        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 26
        +
        +def find_first_parent_containing(dir)
        +  ascend_until {|path| File.exists?(File.join(path, dir))}
        +end
        +
        +
        + +
        +

        + + + (Object) root + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/core/ruby_project.rb', line 18
        +
        +def root
        +  @project_root ||= determine_root
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Runner.html b/source/documentation/2.14/rspec-core/RSpec/Core/Runner.html new file mode 100644 index 000000000..fb119d7a1 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Runner.html @@ -0,0 +1,692 @@ + + + + + + Class: RSpec::Core::Runner + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::Runner + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/runner.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        AT_EXIT_HOOK_BACKTRACE_LINE = + +
        +
        "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) autorun + + + + + +

        +
        +

        Register an at_exit hook that runs the suite.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/core/runner.rb', line 6
        +
        +def self.autorun
        +  return if autorun_disabled? || installed_at_exit? || running_in_drb?
        +  at_exit do
        +    # Don't bother running any specs and just let the program terminate
        +    # if we got here due to an unrescued exception (anything other than
        +    # SystemExit, which is raised when somebody calls Kernel#exit).
        +    next unless $!.nil? || $!.kind_of?(SystemExit)
        +
        +    # We got here because either the end of the program was reached or
        +    # somebody called Kernel#exit.  Run the specs and then override any
        +    # existing exit status with RSpec's exit status if any specs failed.
        +    status = run(ARGV, $stderr, $stdout).to_i
        +    exit status if status != 0
        +  end
        +  @installed_at_exit = true
        +end
        +
        +
        + +
        +

        + + + (Boolean) autorun_disabled? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/runner.rb', line 28
        +
        +def self.autorun_disabled?
        +  @autorun_disabled ||= false
        +end
        +
        +
        + +
        +

        + + + (Object) disable_autorun! + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/runner.rb', line 24
        +
        +def self.disable_autorun!
        +  @autorun_disabled = true
        +end
        +
        +
        + +
        +

        + + + (Boolean) installed_at_exit? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/runner.rb', line 32
        +
        +def self.installed_at_exit?
        +  @installed_at_exit ||= false
        +end
        +
        +
        + +
        +

        + + + (Object) run(args, err = $stderr, out = $stdout) + + + + + +

        +
        +

        Run a suite of RSpec examples.

        + +

        This is used internally by RSpec to run a suite, but is available +for use by any other automation tool.

        + +

        If you want to run this multiple times in the same process, and you +want files like spec_helper.rb to be reloaded, be sure to load load +instead of require.

        + +

        Parameters

        + +
          +
        • +args+ - an array of command-line-supported arguments
        • +
        • +err+ - error stream (Default: $stderr)
        • +
        • +out+ - output stream (Default: $stdout)
        • +
        + +

        Returns

        + +
          +
        • +Fixnum+ - exit status code (0/1)
        • +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/core/runner.rb', line 66
        +
        +def self.run(args, err=$stderr, out=$stdout)
        +  trap_interrupt
        +  options = ConfigurationOptions.new(args)
        +  options.parse_options
        +
        +  if options.options[:drb]
        +    require 'rspec/core/drb_command_line'
        +    begin
        +      DRbCommandLine.new(options).run(err, out)
        +    rescue DRb::DRbConnError
        +      err.puts "No DRb server is running. Running in local process instead ..."
        +      CommandLine.new(options).run(err, out)
        +    end
        +  else
        +    CommandLine.new(options).run(err, out)
        +  end
        +ensure
        +  RSpec.reset
        +end
        +
        +
        + +
        +

        + + + (Boolean) running_in_drb? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/core/runner.rb', line 36
        +
        +def self.running_in_drb?
        +  defined?(DRb) &&
        +  (DRb.current_server rescue false) &&
        +   DRb.current_server.uri =~ /druby\:\/\/127.0.0.1\:/
        +end
        +
        +
        + +
        +

        + + + (Object) trap_interrupt + + + + + +

        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/runner.rb', line 42
        +
        +def self.trap_interrupt
        +  trap('INT') do
        +    exit!(1) if RSpec.wants_to_quit
        +    RSpec.wants_to_quit = true
        +    STDERR.puts "\nExiting... Interrupt again to exit immediately."
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/SharedContext.html b/source/documentation/2.14/rspec-core/RSpec/Core/SharedContext.html new file mode 100644 index 000000000..b5ce60899 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/SharedContext.html @@ -0,0 +1,388 @@ + + + + + + Module: RSpec::Core::SharedContext + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedContext + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_context.rb
        + +
        +
        + +

        Overview

        +
        +

        Exposes ExampleGroup-level methods to a module, so you can include that +module in an ExampleGroup.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module LoggedInAsAdmin
        +  extend RSpec::Core::SharedContext
        +  before(:each) do
        +     :admin
        +  end
        +end
        +
        +describe "admin section" do
        +  include LoggedInAsAdmin
        +  # ...
        +end
        + +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: Recording + + +

        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) record(methods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 39
        +
        +def self.record(methods)
        +  methods.each do |meth|
        +    class_eval <<-EOS, __FILE__, __LINE__ + 1
        +      def #{meth}(*args, &block)
        +        __shared_context_recordings << Recording.new(:#{meth}, args, block)
        +      end
        +    EOS
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) __shared_context_recordings + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 28
        +
        +def __shared_context_recordings
        +  @__shared_context_recordings ||= []
        +end
        +
        +
        + +
        +

        + + - (Object) included(group) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 21
        +
        +def included(group)
        +  __shared_context_recordings.each do |recording|
        +    recording.playback_onto(group)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/SharedContext/Recording.html b/source/documentation/2.14/rspec-core/RSpec/Core/SharedContext/Recording.html new file mode 100644 index 000000000..aae5be59f --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/SharedContext/Recording.html @@ -0,0 +1,388 @@ + + + + + + Class: RSpec::Core::SharedContext::Recording + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::SharedContext::Recording + + + +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_context.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) args + + + + + + + + + + + + + + + + +

          Returns the value of attribute args.

          +
          + +
        • + + +
        • + + + - (Object) block + + + + + + + + + + + + + + + + +

          Returns the value of attribute block.

          +
          + +
        • + + +
        • + + + - (Object) method_name + + + + + + + + + + + + + + + + +

          Returns the value of attribute method_name.

          +
          + +
        • + + +
        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) args + + + + + +

        +
        +

        Returns the value of attribute args

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of args

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 32
        +
        +def args
        +  @args
        +end
        +
        +
        + + + +
        +

        + + - (Object) block + + + + + +

        +
        +

        Returns the value of attribute block

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of block

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 32
        +
        +def block
        +  @block
        +end
        +
        +
        + + + +
        +

        + + - (Object) method_name + + + + + +

        +
        +

        Returns the value of attribute method_name

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of method_name

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/core/shared_context.rb', line 32
        +
        +def method_name
        +  @method_name
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup.html b/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup.html new file mode 100644 index 000000000..86b2b4e49 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup.html @@ -0,0 +1,464 @@ + + + + + + Module: RSpec::Core::SharedExampleGroup + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedExampleGroup + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleGroup, ExampleGroup
        + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group.rb,
        + lib/rspec/core/shared_example_group/collection.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: TopLevelDSL + + + + Classes: Collection + + +

        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) registry + + + + + +

        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 70
        +
        +def self.registry
        +  @registry ||= Registry.new
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) share_as(name, &block) + + + + + +

        +
        +
        Deprecated.
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 40
        +
        +def share_as(name, &block)
        +  RSpec.deprecate("Rspec::Core::SharedExampleGroup#share_as",
        +                  :replacement => "RSpec::SharedContext or shared_examples")
        +  SharedExampleGroup.registry.add_const(self, name, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) shared_example_groups + + + + + +

        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 46
        +
        +def shared_example_groups
        +  SharedExampleGroup.registry.shared_example_groups_for('main', *ancestors[0..-1])
        +end
        +
        +
        + +
        +

        + + + - (Object) shared_examples(name, &block) + + - (Object) shared_examples(name, tags, &block) + + + + + Also known as: + shared_context, share_examples_for, shared_examples_for + + + + +

        +
        +

        Wraps the block in a module which can then be included in example +groups using include_examples, include_context, or +it_behaves_like.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +shared_examples "auditable" do
        +  it "stores an audit record on save!" do
        +    lambda { auditable.save! }.should change(Audit, :count).by(1)
        +  end
        +end
        +
        +class Account do
        +  it_behaves_like "auditable" do
        +    def auditable; Account.new; end
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + + — +

          to match when looking up this shared group

          +
          + +
        • + +
        • + + block + + + + + + + — +

          to be eval'd in a nested example group generated by it_behaves_like

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 31
        +
        +def shared_examples(*args, &block)
        +  SharedExampleGroup.registry.add_group(self, *args, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup/Collection.html b/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup/Collection.html new file mode 100644 index 000000000..73b7531d8 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup/Collection.html @@ -0,0 +1,258 @@ + + + + + + Class: RSpec::Core::SharedExampleGroup::Collection + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::SharedExampleGroup::Collection + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group/collection.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Collection) initialize(sources, examples) + + + + + +

        +
        +

        Returns a new instance of Collection

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/core/shared_example_group/collection.rb', line 6
        +
        +def initialize(sources, examples)
        +  @sources, @examples = sources, examples
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) [](key) + + + + + +

        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/core/shared_example_group/collection.rb', line 10
        +
        +def [](key)
        +  fetch_examples(key) || warn_deprecation_and_fetch_anyway(key)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html b/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html new file mode 100644 index 000000000..1f7d36544 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/SharedExampleGroup/TopLevelDSL.html @@ -0,0 +1,288 @@ + + + + + + Module: RSpec::Core::SharedExampleGroup::TopLevelDSL + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::SharedExampleGroup::TopLevelDSL + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/shared_example_group.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) share_as(name, &block) + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 59
        +
        +def share_as(name, &block)
        +  RSpec.deprecate("Rspec::Core::SharedExampleGroup#share_as",
        +                  :replacement => "RSpec::SharedContext or shared_examples")
        +  SharedExampleGroup.registry.add_const('main', name, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) shared_example_groups + + + + + +

        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 65
        +
        +def shared_example_groups
        +  SharedExampleGroup.registry.shared_example_groups_for('main')
        +end
        +
        +
        + +
        +

        + + - (Object) shared_examples(*args, &block) + + + + Also known as: + shared_context, share_examples_for, shared_examples_for + + + + +

        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/core/shared_example_group.rb', line 51
        +
        +def shared_examples(*args, &block)
        +  SharedExampleGroup.registry.add_group('main', *args, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/Version.html b/source/documentation/2.14/rspec-core/RSpec/Core/Version.html new file mode 100644 index 000000000..ca3d44761 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/Version.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Core::Version + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Core::Version + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/version.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        STRING = + +
        +
        '2.14.8'
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Core/World.html b/source/documentation/2.14/rspec-core/RSpec/Core/World.html new file mode 100644 index 000000000..e3913a509 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Core/World.html @@ -0,0 +1,1232 @@ + + + + + + Class: RSpec::Core::World + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Core::World + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Hooks
        + + + + + +
        Defined in:
        +
        lib/rspec/core/world.rb
        + +
        +
        + + +

        Constant Summary

        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) example_groups + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute example_groups.

          +
          + +
        • + + +
        • + + + - (Object) filtered_examples + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute filtered_examples.

          +
          + +
        • + + +
        • + + + - (Object) wants_to_quit + + + + + + + + + + + + + + + + +

          Returns the value of attribute wants_to_quit.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Hooks

        +

        #after, #append_after, #around, #before, #prepend_before

        + + + + + + + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (World) initialize(configuration = RSpec.configuration) + + + + + +

        +
        +

        Returns a new instance of World

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/core/world.rb', line 10
        +
        +def initialize(configuration=RSpec.configuration)
        +  @configuration = configuration
        +  @example_groups = [].extend(Extensions::Ordered::ExampleGroups)
        +  @filtered_examples = Hash.new { |hash,group|
        +    hash[group] = begin
        +      examples = group.examples.dup
        +      examples = filter_manager.prune(examples)
        +      examples.uniq
        +      examples.extend(Extensions::Ordered::Examples)
        +    end
        +  }
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) example_groups (readonly) + + + + + +

        +
        +

        Returns the value of attribute example_groups

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/world.rb', line 7
        +
        +def example_groups
        +  @example_groups
        +end
        +
        +
        + + + +
        +

        + + - (Object) filtered_examples (readonly) + + + + + +

        +
        +

        Returns the value of attribute filtered_examples

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/core/world.rb', line 7
        +
        +def filtered_examples
        +  @filtered_examples
        +end
        +
        +
        + + + +
        +

        + + - (Object) wants_to_quit + + + + + +

        +
        +

        Returns the value of attribute wants_to_quit

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/core/world.rb', line 8
        +
        +def wants_to_quit
        +  @wants_to_quit
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) announce_exclusion_filter(announcements) + + + + + +

        + + + + +
        +
        +
        +
        +111
        +112
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/core/world.rb', line 111
        +
        +def announce_exclusion_filter(announcements)
        +  unless exclusion_filter.empty_without_conditional_filters?
        +    announcements << "exclude #{exclusion_filter.description}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) announce_filters + + + + + +

        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/core/world.rb', line 65
        +
        +def announce_filters
        +  filter_announcements = []
        +
        +  announce_inclusion_filter filter_announcements
        +  announce_exclusion_filter filter_announcements
        +
        +  unless filter_manager.empty?
        +    if filter_announcements.length == 1
        +      reporter.message("Run options: #{filter_announcements[0]}")
        +    else
        +      reporter.message("Run options:\n  #{filter_announcements.join("\n  ")}")
        +    end
        +  end
        +
        +  if @configuration.run_all_when_everything_filtered? && example_count.zero?
        +    reporter.message("#{everything_filtered_message}; ignoring #{inclusion_filter.description}")
        +    filtered_examples.clear
        +    inclusion_filter.clear
        +  end
        +
        +  if example_count.zero?
        +    example_groups.clear
        +    if filter_manager.empty?
        +      reporter.message("No examples found.")
        +    elsif exclusion_filter.empty_without_conditional_filters?
        +      message = everything_filtered_message
        +      if @configuration.run_all_when_everything_filtered?
        +        message << "; ignoring #{inclusion_filter.description}"
        +      end
        +      reporter.message(message)
        +    elsif inclusion_filter.empty?
        +      reporter.message(everything_filtered_message)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) announce_inclusion_filter(announcements) + + + + + +

        + + + + +
        +
        +
        +
        +105
        +106
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/core/world.rb', line 105
        +
        +def announce_inclusion_filter(announcements)
        +  unless inclusion_filter.empty?
        +    announcements << "include #{inclusion_filter.description}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) configure_group(group) + + + + + +

        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/core/world.rb', line 45
        +
        +def configure_group(group)
        +  @configuration.configure_group(group)
        +end
        +
        +
        + +
        +

        + + - (Object) everything_filtered_message + + + + + +

        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/core/world.rb', line 101
        +
        +def everything_filtered_message
        +  "\nAll examples were filtered out"
        +end
        +
        +
        + +
        +

        + + - (Object) example_count + + + + + +

        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/core/world.rb', line 49
        +
        +def example_count
        +  example_groups.collect {|g| g.descendants}.flatten.inject(0) do |sum, g|
        +    sum += g.filtered_examples.size
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) exclusion_filter + + + + + +

        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/core/world.rb', line 41
        +
        +def exclusion_filter
        +  @configuration.exclusion_filter
        +end
        +
        +
        + +
        +

        + + - (Object) filter_manager + + + + + +

        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/core/world.rb', line 28
        +
        +def filter_manager
        +  @configuration.filter_manager
        +end
        +
        +
        + +
        +

        + + - (Object) inclusion_filter + + + + + +

        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/core/world.rb', line 37
        +
        +def inclusion_filter
        +  @configuration.inclusion_filter
        +end
        +
        +
        + +
        +

        + + - (Object) preceding_declaration_line(filter_line) + + + + + +

        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/core/world.rb', line 55
        +
        +def preceding_declaration_line(filter_line)
        +  declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
        +    line <= filter_line ? line : highest_prior_declaration_line
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) register(example_group) + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/core/world.rb', line 32
        +
        +def register(example_group)
        +  example_groups << example_group
        +  example_group
        +end
        +
        +
        + +
        +

        + + - (Object) reporter + + + + + +

        + + + + +
        +
        +
        +
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/core/world.rb', line 61
        +
        +def reporter
        +  @configuration.reporter
        +end
        +
        +
        + +
        +

        + + - (Object) reset + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/core/world.rb', line 23
        +
        +def reset
        +  example_groups.clear
        +  SharedExampleGroup.registry.clear
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/RSpec/Runner.html b/source/documentation/2.14/rspec-core/RSpec/Runner.html new file mode 100644 index 000000000..915035c59 --- /dev/null +++ b/source/documentation/2.14/rspec-core/RSpec/Runner.html @@ -0,0 +1,188 @@ + + + + + + Module: RSpec::Runner + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Runner + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/core/backward_compatibility.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) configure(&block) + + + + + +

        +
        +
        Deprecated.

        use RSpec.configure instead.

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/core/backward_compatibility.rb', line 26
        +
        +def self.configure(&block)
        +  RSpec.deprecate("Spec::Runner.configure", :replacement => "RSpec.configure")
        +  RSpec.configure(&block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/_index.html b/source/documentation/2.14/rspec-core/_index.html new file mode 100644 index 000000000..c5cab5c2d --- /dev/null +++ b/source/documentation/2.14/rspec-core/_index.html @@ -0,0 +1,704 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.6

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          +
        • J
        • + +
        + + +
          +
        • K
        • + +
        + + + + + + + + + + + + + + + + + +
        + + + + + +
          +
        • V
        • +
            + +
          • + Version + + (RSpec::Core) + +
          • + +
          +
        + + +
          +
        • W
        • +
            + +
          • + World + + (RSpec::Core) + +
          • + +
          +
        + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/class_list.html b/source/documentation/2.14/rspec-core/class_list.html new file mode 100644 index 000000000..cb0647aa3 --- /dev/null +++ b/source/documentation/2.14/rspec-core/class_list.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-core/file.Changelog.html b/source/documentation/2.14/rspec-core/file.Changelog.html new file mode 100644 index 000000000..766652c36 --- /dev/null +++ b/source/documentation/2.14/rspec-core/file.Changelog.html @@ -0,0 +1,1228 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        2.14.9 Development

        + +

        Full Changelog

        + +

        Bug fixes:

        + +
          +
        • Use RSpec::Configuration#backtrace_exclusion_patterns rather than the +deprecated RSpec::Configuration#backtrace_clean_patterns when mocking +with rr. (David Dollar)
        • +
        + +

        2.14.8 / 2014-02-27

        + +

        Full Changelog

        + +

        Bug fixes:

        + +
          +
        • Fix regression with the TextMateFormatter that prevented backtrace links +from being clickable. (Stefan Daschek)
        • +
        + +

        2.14.7 / 2013-10-29

        + +

        full changelog

        + +

        Bug fixes:

        + +
          +
        • Fix regression in 2.14.6 that broke the Fivemat formatter. +It depended upon either +example.execution_result[:exception].pending_fixed? (which +was removed in 2.14.6 to fix an issue with frozen error objects) +or RSpec::Core::PendingExampleFixedError (which was renamed +to RSpec::Core::Pending::PendingExampleFixedError in 2.8. +This fix makes a constant alias for the old error name. +(Myron Marston)
        • +
        + +

        2.14.6 / 2013-10-15

        + +

        full changelog

        + +

        Bug fixes:

        + +
          +
        • Format stringified numbers correctly when mathn library is loaded. +(Jay Hayes)
        • +
        • Fix an issue that prevented the use of frozen error objects. (Lars Gierth)
        • +
        + +

        2.14.5 / 2013-08-13

        + +

        full changelog

        + +

        Bug fixes:

        + +
          +
        • Fix a NoMethodError that was being raised when there were no shared +examples or contexts declared and RSpec.world.reset is invoked. +(thepoho, Jon Rowe, Myron Marston)
        • +
        • Fix a deprecation warning that was being incorrectly displayed when +shared_examples are declared at top level in a module scope. +(Jon Rowe)
        • +
        • Fix after(:all) hooks so consecutive (same context) scopes will run even if +one raises an error. (Jon Rowe, Trejkaz)
        • +
        • JsonFormatter no longer dies if dump_profile isn't defined (Alex / @MasterLambaster, Jon Rowe)
        • +
        + +

        2.14.4 / 2013-07-21

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix regression in 2.14: ensure configured requires (via -r option) +are loaded before spec files are loaded. This allows the spec files +to programatically change the file pattern (Jon Rowe).
        • +
        • Autoload RSpec::Mocks and RSpec::Expectations when referenced if +they are not already loaded (RSpec::Matches has been autoloaded +for a while). In the rspec gem, we changed it recently to stop +loading rspec/mocks and rspec/expectations by default, as some +users reported problems where they were intending to use mocha, +not rspec-mocks, but rspec-mocks was loaded and causing a conflict. +rspec-core loads mocks and expectations at the appropriate time, so +it seemed like a safe change -- but caused a problem for some authors +of libraries that integrate with RSpec. This fixes that problem. +(Myron Marston)
        • +
        • Gracefully handle a command like rspec --profile path/to/spec.rb: +the path/to/spec.rb arg was being wrongly treated as the profile +integer arg, which got cast 0 using to_i, causing no profiled +examples to be printed. (Jon Rowe)
        • +
        + +

        2.14.3 / 2013-07-13

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix deprecation notices issued from RSpec::Core::RakeTask so +that they work properly when all of rspec-core is not loaded. +(This was a regression in 2.14) (Jon Rowe)
        • +
        + +

        2.14.2 / 2013-07-09

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix regression caused by 2.14.1 release: formatters that +report that they respond_to? a notification, but had +no corresponding method would raise an error when registered. +The new fix is to just implement start on the deprecation +formatter to fix the original JRuby/ruby-debug issue. +(Jon Rowe)
        • +
        + +

        2.14.1 / 2013-07-08

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Address deprecation formatter failure when using ruby-debug on +JRuby: fix RSpec::Core::Reporter to not send a notification +when the formatter's implementation of the notification method +comes from Kernel (Alex Portnov, Jon Rowe).
        • +
        + +

        2.14.0 / 2013-07-06

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Apply focus to examples defined with fit (equivalent of +it "description", focus: true) (Michael de Silva)
        • +
        + +

        Bug fixes

        + +
          +
        • Ensure methods defined by let take precedence over others +when there is a name collision (e.g. from an included module). +(Jon Rowe, Andy Lindeman and Myron Marston)
        • +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Improved Windows detection inside Git Bash, for better --color handling.
        • +
        • Add profiling of the slowest example groups to --profile option. +The output is sorted by the slowest average example groups.
        • +
        • Don't show slow examples if there's a failure and both --fail-fast +and --profile options are used (Paweł Gościcki).
        • +
        • Rather than always adding spec to the load path, add the configured +--default-path to the load path (which defaults to spec). This +better supports folks who choose to put their specs in a different +directory (John Feminella).
        • +
        • Add some logic to test time duration precision. Make it a +function of time, dropping precision as the time increases. (Aaron Kromer)
        • +
        • Add new backtrace_inclusion_patterns config option. Backtrace lines +that match one of these patterns will always be included in the +backtrace, even if they match an exclusion pattern, too (Sam Phippen).
        • +
        • Support ERB trim mode using the - when parsing .rspec as ERB +(Gabor Garami).
        • +
        • Give a better error message when let and subject are called without a block. +(Sam Phippen).
        • +
        • List the precedence of .rspec-local in the configuration documentation +(Sam Phippen)
        • +
        • Support {a,b} shell expansion syntax in --pattern option +(Konstantin Haase).
        • +
        • Add cucumber documentation for --require command line option +(Bradley Schaefer)
        • +
        • Expose configruation options via config: + +
            +
          • config.libs returns the libs configured to be added onto the load path
          • +
          • full_backtrace? returns the state of the backtrace cleaner
          • +
          • debug? returns true when the debugger is loaded
          • +
          • line_numbers returns the line numbers we are filtering by (if any)
          • +
          • full_description returns the RegExp used to filter descriptions +(Jon Rowe)
          • +
        • +
        • Add setters for RSpec.world and RSpec.configuration (Alex Soulim)
        • +
        • Configure ruby's warning behaviour with --warnings (Jon Rowe)
        • +
        • Fix an obscure issue on old versions of 1.8.7 where Time.dup wouldn't +allow access to Time.now (Jon Rowe)
        • +
        • Make shared_examples_for context aware, so that keys may be safely reused +in multiple contexts without colliding. (Jon Rowe)
        • +
        • Add a configurable deprecation_stream (Jon Rowe)
        • +
        • Publish deprecations through a formatter (David Chelimsky)
        • +
        + +

        Bug fixes

        + +
          +
        • Make JSON formatter behave the same when it comes to --profile as +the text formatter (Paweł Gościcki).
        • +
        • Fix named subjects so that if an inner group defines a method that +overrides the named method, subject still retains the originally +declared value (Myron Marston).
        • +
        • Fix random ordering so that it does not cause rand in examples in +nested sibling contexts to return the same value (Max Shytikov).
        • +
        • Use the new backtrace_inclusion_patterns config option to ensure +that folks who develop code in a directory matching one of the default +exclusion patterns (e.g. gems) still get the normal backtrace +filtering (Sam Phippen).
        • +
        • Fix ordering of before hooks so that before hooks declared in +RSpec.configure run before before hooks declared in a shared +context (Michi Huber and Tejas Dinkar).
        • +
        • Fix Example#full_description so that it gets filled in by the last +matcher description (as Example#description already did) when no +doc string has been provided (David Chelimsky).
        • +
        • Fix the memoized methods (let and subject) leaking define_method +as a public method. (Thomas Holmes and Jon Rowe) (#873)
        • +
        • Fix warnings coming from the test suite. (Pete Higgins)
        • +
        + +

        Deprecations

        + +
          +
        • Deprecate Configuration#backtrace_clean_patterns in favor of +Configuration#backtrace_exclusion_patterns for greater consistency +and symmetry with new backtrace_inclusion_patterns config option +(Sam Phippen).
        • +
        • Deprecate Configuration#requires= in favor of using ruby's +require. Requires specified by the command line can still be +accessed by the Configuration#require reader. (Bradley Schaefer)
        • +
        • Deprecate calling SharedExampleGroups defined across sibling contexts +(Jon Rowe)
        • +
        + +

        2.13.1 / 2013-03-12

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Use hook classes as proxies rather than extending hook blocks to support +lambdas for before/after/around hooks. (David Chelimsky)
        • +
        • Fix regression in 2.13.0 that caused confusing behavior when overriding +a named subject with an unnamed subject in an inner group and then +referencing the outer group subject's name. The fix for this required +us to disallow using super in a named subject (which is confusing, +anyway -- named subjects create 2 methods, so which method on the +parent example group are you supering to?) but super in an unnamed +subject continues to work (Myron Marston).
        • +
        • Do not allow a referenced let or subject in before(:all) to cause +other let declarations to leak across examples (Myron Marston).
        • +
        • Work around odd ruby 1.9 bug with String#match that was triggered +by passing it a regex from a let declaration. For more info, see +http://bugs.ruby-lang.org/issues/8059 (Aaron Kromer).
        • +
        • Add missing require 'set' to base_text_formatter.rb (Tom +Anderson).
        • +
        + +

        Deprecations

        + +
          +
        • Deprecate accessing let or subject declarations in before(:all). +These were not intended to be called in a before(:all) hook, as +they exist to define state that is reset between each example, while +before(:all) exists to define state that is shared across examples +in an example group (Myron Marston).
        • +
        + +

        2.13.0 / 2013-02-23

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Allow --profile option to take a count argument that +determines the number of slow examples to dump +(Greggory Rothmeier).
        • +
        • Add subject! that is the analog to let!. It defines an +explicit subject and sets a before hook that will invoke +the subject (Zubin Henner).
        • +
        • Fix let and subject declaration so that super +and return can be used in them, just like in a normal +method. (Myron Marston)
        • +
        • Allow output colors to be configured individually. +(Charlie Maffitt)
        • +
        • Always dump slow examples when --profile option is given, +even when an example failed (Myron Marston).
        • +
        + +

        Bug fixes

        + +
          +
        • Don't blow up when dumping error output for instances +of anonymous error classes (Myron Marston).
        • +
        • Fix default backtrace filters so lines from projects +containing "gems" in the name are not filtered, but +lines from installed gems still are (Myron Marston).
        • +
        • Fix autotest command so that is uses double quotes +rather than single quotes for windows compatibility +(Jonas Tingeborn).
        • +
        • Fix its so that uses of subject in a before or let +declaration in the parent group continue to reference the +parent group's subject. (Olek Janiszewski)
        • +
        + +

        2.12.2 / 2012-12-13

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix RSpec::Core::RakeTask so that it is compatible with rake 0.8.7 +on ruby 1.8.7. We had accidentally broke it in the 2.12 release +(Myron Marston).
        • +
        • Fix RSpec::Core::RakeTask so it is tolerant of the Rspec constant +for backwards compatibility (Patrick Van Stee)
        • +
        + +

        2.12.1 / 2012-12-01

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Specs are run even if another at_exit hook calls exit. This allows +Test::Unit and RSpec to run together. (Suraj N. Kurapati)
        • +
        • Fix full doc string concatenation so that it handles the case of a +method string (e.g. "#foo") being nested under a context string +(e.g. "when it is tuesday"), so that we get "when it is tuesday #foo" +rather than "when it is tuesday#foo". (Myron Marston)
        • +
        • Restore public API I unintentionally broke in 2.12.0: +RSpec::Core::Formatters::BaseFormatter#format_backtrce(backtrace, example) +(Myron Marston).
        • +
        + +

        2.12.0 / 2012-11-12

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Add support for custom ordering strategies for groups and examples. +(Myron Marston)
        • +
        • JSON Formatter (Alex Chaffee)
        • +
        • Refactor rake task internals (Sam Phippen)
        • +
        • Refactor HtmlFormatter (Pete Hodgson)
        • +
        • Autotest supports a path to Ruby that contains spaces (dsisnero)
        • +
        • Provide a helpful warning when a shared example group is redefined. +(Mark Burns).
        • +
        • --default_path can be specified as --default-line. --line_number can be +specified as --line-number. Hyphens are more idiomatic command line argument +separators (Sam Phippen).
        • +
        • A more useful error message is shown when an invalid command line option is +used (Jordi Polo).
        • +
        • Add format_docstrings { |str| } config option. It can be used to +apply formatting rules to example group and example docstrings. +(Alex Tan)
        • +
        • Add support for an .rspec-local options file. This is intended to +allow individual developers to set options in a git-ignored file that +override the common project options in .rspec. (Sam Phippen)
        • +
        • Support for mocha 0.13.0. (Andy Lindeman)
        • +
        + +

        Bug fixes

        + +
          +
        • Remove override of ExampleGroup#ancestors. This is a core ruby method that +RSpec shouldn't override. Instead, define ExampleGroup#parent_groups. (Myron +Marston)
        • +
        • Limit monkey patching of shared example/context declaration methods +(shared_examples_for, etc.) to just the objects that need it rather than +every object in the system (Myron Marston).
        • +
        • Fix Metadata#fetch to support computed values (Sam Goldman).
        • +
        • Named subject can now be referred to from within subject block in a nested +group (tomykaira).
        • +
        • Fix fail_fast so that it properly exits when an error occurs in a +before(:all) hook (Bradley Schaefer).
        • +
        • Make the order spec files are loaded consistent, regardless of the +order of the files returned by the OS or the order passed at +the command line (Jo Liss and Sam Phippen).
        • +
        • Ensure instance variables from before(:all) are always exposed +from after(:all), even if an error occurs in before(:all) +(Sam Phippen).
        • +
        • rspec --init no longer generates an incorrect warning about --configure +being deprecated (Sam Phippen).
        • +
        • Fix pluralization of 1 seconds (Odin Dutton)
        • +
        • Fix ANSICON url (Jarmo Pertman)
        • +
        • Use dup of Time so reporting isn't clobbered by examples that modify Time +without properly restoring it. (David Chelimsky)
        • +
        + +

        Deprecations

        + +
          +
        • share_as is no longer needed. shared_context and/or +RSpec::SharedContext provide better mechanisms (Sam Phippen).
        • +
        • Deprecate RSpec.configuration with a block (use RSpec.configure).
        • +
        + +

        2.11.1 / 2012-07-18

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix the way we autoload RSpec::Matchers so that custom matchers can be +defined before rspec-core has been configured to definitely use +rspec-expectations. (Myron Marston)
        • +
        • Fix typo in --help message printed for -e option. (Jo Liss)
        • +
        • Fix ruby warnings. (Myron Marston)
        • +
        • Ignore mock expectation failures when the example has already failed. +Mock expectation failures have always been ignored in this situation, +but due to my changes in 27059bf1 it was printing a confusing message. +(Myron Marston).
        • +
        + +

        2.11.0 / 2012-07-07

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Support multiple --example options. (Daniel Doubrovkine @dblock)
        • +
        • Named subject e.g. subject(:article) { Article.new } + +
        • +
        • config.mock_with and config.expect_with yield custom config object to a +block if given + +
            +
          • aids decoupling from rspec-core's configuation
          • +
        • +
        • include_context and include_examples support a block, which gets eval'd +in the current context (vs the nested context generated by it_behaves_like).
        • +
        • Add config.order = 'random' to the spec_helper.rb generated by rspec +--init.
        • +
        • Delay the loading of DRb (Myron Marston).
        • +
        • Limit monkey patching of describe onto just the objects that need it rather +than every object in the system (Myron Marston).
        • +
        + +

        Bug fixes

        + +
          +
        • Support alternative path separators. For example, on Windows, you can now do +this: rspec spec\subdir. (Jarmo Pertman @jarmo)
        • +
        • When an example raises an error and an after or around hook does as +well, print out the hook error. Previously, the error was silenced and +the user got no feedback about what happened. (Myron Marston)
        • +
        • --require and -I are merged among different configuration sources (Andy +Lindeman)
        • +
        • Delegate to mocha methods instead of aliasing them in mocha adapter.
        • +
        + +

        2.10.1 / 2012-05-19

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • RSpec.reset properly reinits configuration and world
        • +
        • Call to_s before split on exception messages that might not always be +Strings (slyphon)
        • +
        + +

        2.10.0 / 2012-05-03

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Add prepend_before and append_after hooks (preethiramdev) + +
            +
          • intended for extension libs
          • +
          • restores rspec-1 behavior
          • +
        • +
        • Reporting of profiled examples (moro) + +
            +
          • Report the total amount of time taken for the top slowest examples.
          • +
          • Report what percentage the slowest examples took from the total runtime.
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • Properly parse SPEC_OPTS options.
        • +
        • example.description returns the location of the example if there is no +explicit description or matcher-generated description.
        • +
        • RDoc fixes (Grzegorz Świrski)
        • +
        • Do not modify example ancestry when dumping errors (Michael Grosser)
        • +
        + +

        2.9.0 / 2012-03-17

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Support for "X minutes X seconds" spec run duration in formatter. (uzzz)
        • +
        • Strip whitespace from group and example names in doc formatter.
        • +
        • Removed spork-0.9 shim. If you're using spork-0.8.x, you'll need to upgrade +to 0.9.0.
        • +
        + +

        Bug fixes

        + +
          +
        • Restore --full_backtrace option
        • +
        • Ensure that values passed to config.filter_run are respected when running +over DRb (using spork).
        • +
        • Ensure shared example groups are reset after a run (as example groups are).
        • +
        • Remove rescue false from calls to filters represented as Procs
        • +
        • Ensure described_class gets the closest constant (pyromaniac)
        • +
        • In "autorun", don't run the specs in the at_exit hook if there was an +exception (most likely due to a SyntaxError). (sunaku)
        • +
        • Don't extend groups with modules already used to extend ancestor groups.
        • +
        • its correctly memoizes nil or false values (Yamada Masaki)
        • +
        + +

        2.8.0 / 2012-01-04

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • For metadata filtering, restore passing the entire array to the proc, rather +than each item in the array (weidenfreak)
        • +
        • Ensure each spec file is loaded only once + +
            +
          • Fixes a bug that caused all the examples in a file to be run when +referenced twice with line numbers in a command, e.g. + +
              +
            • rspec path/to/file:37 path/to/file:42
            • +
          • +
        • +
        + +

        2.8.0.rc2 / 2011-12-19

        + +

        full changelog

        + +

        Enhancments

        + +
          +
        • new --init command (Peter Schröder) + +
            +
          • generates spec/spec_helper.rb
          • +
          • deletes obsolete files (on confirmation)
          • +
          • merged with and deprecates --configure command, which generated +.rspec
          • +
        • +
        • use require_relative when available (Ian Leitch)
        • +
        • include_context and include_examples accept params (Calvin Bascom)
        • +
        • print the time for every example in the html formatter (Richie Vos)
        • +
        • several tasty refactoring niblets (Sasha)
        • +
        • `it "does something", :x => :foo,'bar',/baz/ + +
            +
          • supports matching n command line tag values with an example or group
          • +
        • +
        + +

        2.8.0.rc1 / 2011-11-06

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • --order (Justin Ko) + +
            +
          • run examples in random order: --order rand
          • +
          • specify the seed: --order rand:123
          • +
        • +
        • --seed SEED + +
            +
          • equivalent of --order rand:SEED
          • +
        • +
        • SharedContext supports let (David Chelimsky)
        • +
        • Filter improvements (David Chelimsky) + +
            +
          • override opposing tags from the command line
          • +
          • override RSpec.configure tags from the command line
          • +
          • --line_number 37 overrides all other filters
          • +
          • path/to/file.rb:37 overrides all other filters
          • +
          • refactor: consolidate filter management in a FilterManger object
          • +
        • +
        • Eliminate Ruby warnings (Matijs van Zuijlen)
        • +
        • Make reporter.report an API (David Chelimsky) + +
            +
          • supports extension tools like interative_rspec
          • +
        • +
        + +

        Changes

        + +
          +
        • change config.color_enabled (getter/setter/predicate) to color to align +with --[no]-color CLI option. + +
            +
          • color_enabled is still supported for now, but will likley be deprecated +in a 2.x release so we can remove it in 3.0.
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • Make sure the bar in --tag foo:bar makes it to DRb (Aaron Gibralter)
        • +
        • Fix bug where full descriptions of groups nested 3 deep were repeated.
        • +
        • Restore report of time to run to start after files are loaded. + +
            +
          • fixes bug where run times were cumalitive in spork
          • +
          • fixes compatibility with time-series metrics
          • +
        • +
        • Don't error out when config.mock_with or expect_with is re-specifying the +current config (Myron Marston)

        • +
        • Deprecations

          + +
            +
          • :alias option on configuration.add_setting. Use :alias_with on the +original setting declaration instead.
          • +
        • +
        + +

        2.7.1 / 2011-10-20

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • tell autotest the correct place to find the rspec executable
        • +
        + +

        2.7.0 / 2011-10-16

        + +

        full changelog

        + +

        NOTE: RSpec's release policy dictates that there should not be any backward +incompatible changes in minor releases, but we're making an exception to +release a change to how RSpec interacts with other command line tools.

        + +

        As of 2.7.0, you must explicity require "rspec/autorun" unless you use the +rspec command (which already does this for you).

        + +

        Enhancements

        + +
          +
        • Add example.exception (David Chelimsky)
        • +
        • --default_path command line option (Justin Ko)
        • +
        • support multiple --line_number options (David J. Hamilton) + +
            +
          • also supports path/to/file.rb:5:9 (runs examples on lines 5 and 9)
          • +
        • +
        • Allow classes/modules to be used as shared example group identifiers (Arthur +Gunn)
        • +
        • Friendly error message when shared context cannot be found (Sławosz +Sławiński)
        • +
        • Clear formatters when resetting config (John Bintz)
        • +
        • Add xspecify and xexample as temp-pending methods (David Chelimsky)
        • +
        • Add --no-drb option (Iain Hecker)
        • +
        • Provide more accurate run time by registering start time before code is +loaded (David Chelimsky) + +
            +
          • reverted in 2.8.0
          • +
        • +
        • Rake task default pattern finds specs in symlinked dirs (Kelly Felkins)
        • +
        • Rake task no longer does anything to invoke bundler since Bundler already +handles it for us. Thanks to Andre Arko for the tip.
        • +
        • Add --failure-exit-code option (Chris Griego)
        • +
        + +

        Bug fixes

        + +
          +
        • Include Rake::DSL to remove deprecation warnings in Rake > 0.8.7 (Pivotal +Casebook)
        • +
        • Only eval let block once even if it returns nil (Adam Meehan)
        • +
        • Fix --pattern option (wasn't being recognized) (David Chelimsky)
        • +
        • Only implicitly require "rspec/autorun" with the rspec command (David +Chelimsky)
        • +
        • Ensure that rspec's at_exit defines the exit code (Daniel Doubrovkine)
        • +
        • Show the correct snippet in the HTML and TextMate formatters (Brian Faherty)
        • +
        + +

        2.6.4 / 2011-06-06

        + +

        full changelog

        + +

        NOTE: RSpec's release policy dictates that there should not be new +functionality in patch releases, but this minor enhancement slipped in by +accident. As it doesn't add a new API, we decided to leave it in rather than +roll back this release.

        + +

        Enhancements

        + +
          +
        • Add summary of commands to run individual failed examples.
        • +
        + +

        Bug fixes

        + +
          +
        • Support exclusion filters in DRb. (Yann Lugrin)
        • +
        • Fix --example escaping when run over DRb. (Elliot Winkler)
        • +
        • Use standard ANSI codes for color formatting so colors work in a wider set of +color schemes.
        • +
        + +

        2.6.3 / 2011-05-24

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Explicitly convert exit code to integer, avoiding TypeError when return +value of run is IO object proxied by DRb::DRbObject (Julian Scheid)
        • +
        • Clarify behavior of --example command line option
        • +
        • Build using a rubygems-1.6.2 to avoid downstream yaml parsing error
        • +
        + +

        2.6.2 / 2011-05-21

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Warn rather than raise when HOME env var is not defined
        • +
        • Properly merge command-line exclusions with default :if and :unless (joshcooper)
        • +
        + +

        2.6.1 / 2011-05-19

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Don't extend nil when filters are nil
        • +
        • require 'rspec/autorun' when running rcov.
        • +
        + +

        2.6.0 / 2011-05-12

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • shared_context (Damian Nurzynski) + +
            +
          • extend groups matching specific metadata with: + +
              +
            • method definitions
            • +
            • subject declarations
            • +
            • let/let! declarations
            • +
            • etc (anything you can do in a group)
            • +
          • +
        • +
        • its([:key]) works for any subject with #[]. (Peter Jaros)
        • +
        • treat_symbols_as_metadata_keys_with_true_values (Myron Marston)
        • +
        • Print a deprecation warning when you configure RSpec after defining an +example. All configuration should happen before any examples are defined. +(Myron Marston)
        • +
        • Pass the exit status of a DRb run to the invoking process. This causes specs +run via DRb to not just return true or false. (Ilkka Laukkanen)
        • +
        • Refactoring of ConfigurationOptions#parse_options (Rodrigo Rosenfeld Rosas)
        • +
        • Report excluded filters in runner output (tip from andyl)
        • +
        • Clean up messages for filters/tags.
        • +
        • Restore --pattern/-P command line option from rspec-1
        • +
        • Support false as well as true in config.full_backtrace= (Andreas Tolf +Tolfsen)
        • +
        + +

        Bug fixes

        + +
          +
        • Don't stumble over an exception without a message (Hans Hasselberg)
        • +
        • Remove non-ascii characters from comments that were choking rcov (Geoffrey +Byers)
        • +
        • Fixed backtrace so it doesn't include lines from before the autorun at_exit +hook (Myron Marston)
        • +
        • Include RSpec::Matchers when first example group is defined, rather than just +before running the examples. This works around an obscure bug in ruby 1.9 +that can cause infinite recursion. (Myron Marston)
        • +
        • Don't send example_group_[started|finished] to formatters for empty groups.
        • +
        • Get specs passing on jruby (Sidu Ponnappa)
        • +
        • Fix bug where mixing nested groups and outer-level examples gave +unpredictable :line_number behavior (Artur Małecki)
        • +
        • Regexp.escape the argument to --example (tip from Elliot Winkler)
        • +
        • Correctly pass/fail pending block with message expectations
        • +
        • CommandLine returns exit status (0/1) instead of true/false
        • +
        • Create path to formatter output file if it doesn't exist (marekj).
        • +
        + +

        2.5.1 / 2011-02-06

        + +

        full changelog

        + +

        NOTE: this release breaks compatibility with rspec/autotest/bundler +integration, but does so in order to greatly simplify it.

        + +

        With this release, if you want the generated autotest command to include +'bundle exec', require Autotest's bundler plugin in a .autotest file in the +project's root directory or in your home directory:

        + +
        require "autotest/bundler"
        +
        + +

        Now you can just type 'autotest' on the commmand line and it will work as you expect.

        + +

        If you don't want 'bundle exec', there is nothing you have to do.

        + +

        2.5.0 / 2011-02-05

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Autotest::Rspec2 parses command line args passed to autotest after '--'
        • +
        • --skip-bundler option for autotest command
        • +
        • Autotest regexp fixes (Jon Rowe)
        • +
        • Add filters to html and textmate formatters (Daniel Quimper)
        • +
        • Explicit passing of block (need for JRuby 1.6) (John Firebaugh)
        • +
        + +

        Bug fixes

        + +
          +
        • fix dom IDs in HTML formatter (Brian Faherty)
        • +
        • fix bug with --drb + formatters when not running in drb
        • +
        • include --tag options in drb args (monocle)
        • +
        • fix regression so now SPEC_OPTS take precedence over CLI options again (Roman +Chernyatchik)
        • +
        • only call its(:attribute) once (failing example from Brian Dunn)
        • +
        • fix bizarre bug where rspec would hang after String.alias :to_int :to_i +(Damian Nurzynski)
        • +
        + +

        Deprecations

        + +
          +
        • implicit inclusion of 'bundle exec' when Gemfile present (use autotest's +bundler plugin instead)
        • +
        + +

        2.4.0 / 2011-01-02

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • start the debugger on -d so the stack trace is visible when it stops +(Clifford Heath)
        • +
        • apply hook filtering to examples as well as groups (Myron Marston)
        • +
        • support multiple formatters, each with their own output
        • +
        • show exception classes in failure messages unless they come from RSpec +matchers or message expectations
        • +
        • before(:all) { pending } sets all examples to pending
        • +
        + +

        Bug fixes

        + +
          +
        • fix bug due to change in behavior of reject in Ruby 1.9.3-dev (Shota +Fukumori)
        • +
        • fix bug when running in jruby: be explicit about passing block to super (John +Firebaugh)
        • +
        • rake task doesn't choke on paths with quotes (Janmejay Singh)
        • +
        • restore --options option from rspec-1
        • +
        • require 'ostruct' to fix bug with its([key]) (Kim Burgestrand)
        • +
        • --configure option generates .rspec file instead of autotest/discover.rb
        • +
        + +

        2.3.1 / 2010-12-16

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • send debugger warning message to $stdout if RSpec.configuration.error_stream +has not been defined yet.
        • +
        • HTML Formatter finally properly displays nested groups (Jarmo Pertman)
        • +
        • eliminate some warnings when running RSpec's own suite (Jarmo Pertman)
        • +
        + +

        2.3.0 / 2010-12-12

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • tell autotest to use "rspec2" if it sees a .rspec file in the project's root +directory + +
            +
          • replaces the need for ./autotest/discover.rb, which will not work with +all versions of ZenTest and/or autotest
          • +
        • +
        • config.expect_with + +
            +
          • :rspec # => rspec/expectations
          • +
          • :stdlib # => test/unit/assertions
          • +
          • :rspec, :stdlib # => both
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • fix dev Gemfile to work on non-mac-os machines (Lake Denman)
        • +
        • ensure explicit subject is only eval'd once (Laszlo Bacsi)
        • +
        + +

        2.2.1 / 2010-11-28

        + +

        full changelog

        + +

        Bug fixes +* alias_method instead of override Kernel#method_missing (John Wilger) +* changed --autotest to --tty in generated command (MIKAMI Yoshiyuki) +* revert change to debugger (had introduced conflict with Rails) + * also restored --debugger/-debug option

        + +

        2.2.0 / 2010-11-28

        + +

        full changelog

        + +

        Deprecations/changes

        + +
          +
        • --debug/-d on command line is deprecated and now has no effect
        • +
        • win32console is now ignored; Windows users must use ANSICON for color support +(Bosko Ivanisevic)
        • +
        + +

        Enhancements

        + +
          +
        • When developing locally rspec-core now works with the rspec-dev setup or your +local gems
        • +
        • Raise exception with helpful message when rspec-1 is loaded alongside rspec-2 +(Justin Ko)
        • +
        • debugger statements just work as long as ruby-debug is installed + +
            +
          • otherwise you get warned, but not fired
          • +
        • +
        • Expose example.metadata in around hooks
        • +
        • Performance improvments (much faster now)
        • +
        + +

        Bug fixes

        + +
          +
        • Make sure --fail-fast makes it across drb
        • +
        • Pass -Ilib:spec to rcov
        • +
        + +

        2.1.0 / 2010-11-07

        + +

        full changelog

        + +

        Enhancments

        + +
          +
        • Add skip_bundler option to rake task to tell rake task to ignore the presence +of a Gemfile (jfelchner)
        • +
        • Add gemfile option to rake task to tell rake task what Gemfile to look for +(defaults to 'Gemfile')
        • +
        • Allow passing caller trace into Metadata to support extensions (Glenn +Vanderburg)
        • +
        • Add deprecation warning for Spec::Runner.configure to aid upgrade from +RSpec-1
        • +
        • Add deprecated Spec::Rake::SpecTask to aid upgrade from RSpec-1
        • +
        • Add 'autospec' command with helpful message to aid upgrade from RSpec-1
        • +
        • Add support for filtering with tags on CLI (Lailson Bandeira)
        • +
        • Add a helpful message about RUBYOPT when require fails in bin/rspec (slyphon)
        • +
        • Add "-Ilib" to the default rcov options (Tianyi Cui)
        • +
        • Make the expectation framework configurable (default rspec, of course) +(Justin Ko)
        • +
        • Add 'pending' to be conditional (Myron Marston)
        • +
        • Add explicit support for :if and :unless as metadata keys for conditional run +of examples (Myron Marston)
        • +
        • Add --fail-fast command line option (Jeff Kreeftmeijer)
        • +
        + +

        Bug fixes

        + +
          +
        • Eliminate stack overflow with "subject { self }"
        • +
        • Require 'rspec/core' in the Raketask (ensures it required when running rcov)
        • +
        + +

        2.0.1 / 2010-10-18

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Restore color when using spork + autotest
        • +
        • Pending examples without docstrings render the correct message (Josep M. +Bach)
        • +
        • Fixed bug where a failure in a spec file ending in anything but _spec.rb +would fail in a confusing way.
        • +
        • Support backtrace lines from erb templates in html formatter (Alex Crichton)
        • +
        + +

        2.0.0 / 2010-10-10

        + +

        full changelog

        + +

        RSpec-1 compatibility

        + +
          +
        • Rake task uses ENV["SPEC"] as file list if present
        • +
        + +

        Bug fixes

        + +
          +
        • Bug Fix: optparse --out foo.txt (Leonardo Bessa)
        • +
        • Suppress color codes for non-tty output (except autotest)
        • +
        + +

        2.0.0.rc / 2010-10-05

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • implicitly require unknown formatters so you don't have to require the file +explicitly on the commmand line (Michael Grosser)
        • +
        • add --out/-o option to assign output target
        • +
        • added fail_fast configuration option to abort on first failure
        • +
        • support a Hash subject (its([:key]) { should == value }) (Josep M. Bach)
        • +
        + +

        Bug fixes

        + +
          +
        • Explicitly require rspec version to fix broken rdoc task (Hans de Graaff)
        • +
        • Ignore backtrace lines that come from other languages, like Java or +Javascript (Charles Lowell)
        • +
        • Rake task now does what is expected when setting (or not setting) +fail_on_error and verbose
        • +
        • Fix bug in which before/after(:all) hooks were running on excluded nested +groups (Myron Marston)
        • +
        • Fix before(:all) error handling so that it fails examples in nested groups, +too (Myron Marston)
        • +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • removed at_exit hook
        • +
        • CTRL-C stops the run (almost) immediately + +
            +
          • first it cleans things up by running the appropriate after(:all) and +after(:suite) hooks
          • +
          • then it reports on any examples that have already run
          • +
        • +
        • cleaned up rake task + +
            +
          • generate correct task under variety of conditions
          • +
          • options are more consistent
          • +
          • deprecated redundant options
          • +
        • +
        • run 'bundle exec autotest' when Gemfile is present
        • +
        • support ERB in .rspec options files (Justin Ko)
        • +
        • depend on bundler for development tasks (Myron Marston)
        • +
        • add example_group_finished to formatters and reporter (Roman Chernyatchik)
        • +
        + +

        Bug fixes

        + +
          +
        • support paths with spaces when using autotest (Andreas Neuhaus)
        • +
        • fix module_exec with ruby 1.8.6 (Myron Marston)
        • +
        • remove context method from top-level + +
            +
          • was conflicting with irb, for example
          • +
        • +
        • errors in before(:all) are now reported correctly (Chad Humphries)
        • +
        + +

        Removals

        + +
          +
        • removed -o --options-file command line option + +
            +
          • use ./.rspec and ~/.rspec
          • +
        • +
        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/file.License.html b/source/documentation/2.14/rspec-core/file.License.html new file mode 100644 index 000000000..dad932a03 --- /dev/null +++ b/source/documentation/2.14/rspec-core/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2009 Chad Humphries, David Chelimsky
        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/file.README.html b/source/documentation/2.14/rspec-core/file.README.html new file mode 100644 index 000000000..4c2b98c88 --- /dev/null +++ b/source/documentation/2.14/rspec-core/file.README.html @@ -0,0 +1,325 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        rspec-core Build Status Code Climate

        + +

        rspec-core provides the structure for writing executable examples of how your +code should behave, and an rspec command with tools to constrain which +examples get run and tailor the output.

        + +

        install

        + +
        gem install rspec      # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-core # for rspec-core only
        +rspec --help
        +
        + +

        basic structure

        + +

        RSpec uses the words "describe" and "it" so we can express concepts like a conversation:

        + +
        "Describe an order."
        +"It sums the prices of its line items."
        +
        + +
        describe Order do
        +  it "sums the prices of its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        The describe method creates an ExampleGroup. Within the +block passed to describe you can declare examples using the it method.

        + +

        Under the hood, an example group is a class in which the block passed to +describe is evaluated. The blocks passed to it are evaluated in the +context of an instance of that class.

        + +

        nested groups

        + +

        You can also declare nested nested groups using the describe or context +methods:

        + +
        describe Order do
        +  context "with no items" do
        +    it "behaves one way" do
        +      # ...
        +    end
        +  end
        +
        +  context "with one item" do
        +    it "behaves another way" do
        +      # ...
        +    end
        +  end
        +end
        +
        + +

        aliases

        + +

        You can declare example groups using either describe or context, though +only describe is available at the top level.

        + +

        You can declare examples within a group using any of it, specify, or +example.

        + +

        shared examples and contexts

        + +

        Declare a shared example group using shared_examples, and then include it +in any group using include_examples.

        + +
        shared_examples "collections" do |collection_class|
        +  it "is empty when first created" do
        +    expect(collection_class.new).to be_empty
        +  end
        +end
        +
        +describe Array do
        +  include_examples "collections", Array
        +end
        +
        +describe Hash do
        +  include_examples "collections", Hash
        +end
        +
        + +

        Nearly anything that can be declared within an example group can be declared +within a shared example group. This includes before, after, and around +hooks, let declarations, and nested groups/contexts.

        + +

        You can also use the names shared_context and include_context. These are +pretty much the same as shared_examples and include_examples, providing +more accurate naming when you share hooks, let declarations, helper methods, +etc, but no examples.

        + +

        metadata

        + +

        rspec-core stores a metadata hash with every example and group, which +contains their descriptions, the locations at which they were +declared, etc, etc. This hash powers many of rspec-core's features, +including output formatters (which access descriptions and locations), +and filtering before and after hooks.

        + +

        Although you probably won't ever need this unless you are writing an +extension, you can access it from an example like this:

        + +
        it "does something" do
        +  expect(example.[:description]).to eq("does something")
        +end
        +
        + +

        described_class

        + +

        When a class is passed to describe, you can access it from an example +using the described_class method, which is a wrapper for +example.metadata[:described_class].

        + +
        describe Widget do
        +  example do
        +    expect(described_class).to equal(Widget)
        +  end
        +end
        +
        + +

        This is useful in extensions or shared example groups in which the specific +class is unknown. Taking the collections shared example group from above, we can +clean it up a bit using described_class:

        + +
        shared_examples "collections" do
        +  it "is empty when first created" do
        +    expect(described_class.new).to be_empty
        +  end
        +end
        +
        +describe Array do
        +  include_examples "collections"
        +end
        +
        +describe Hash do
        +  include_examples "collections"
        +end
        +
        + +

        the rspec command

        + +

        When you install the rspec-core gem, it installs the rspec executable, +which you'll use to run rspec. The rspec command comes with many useful +options. +Run rspec --help to see the complete list.

        + +

        store command line options .rspec

        + +

        You can store command line options in a .rspec file in the project's root +directory, and the rspec command will read them as though you typed them on +the command line.

        + +

        autotest integration

        + +

        rspec-core ships with an Autotest extension, which is loaded automatically if +there is a .rspec file in the project's root directory.

        + +

        rcov integration

        + +

        rcov is best integrated via the rcov rake +task.

        + +

        rcov can also be integrated via the rspec rake task, but it requires a bit +more setup:

        + +
        # Rakefile
        +require 'rspec/core/rake_task'
        +
        +RSpec::Core::RakeTask.new(:spec) do |config|
        +  config.rcov = true
        +end
        +
        +task :default => :spec
        +
        +# spec/spec_helper.rb
        +require 'rspec/autorun' # **add this**
        +
        + +

        get started

        + +

        Start with a simple example of behavior you expect from your system. Do +this before you write any implementation code:

        + +
        # in spec/calculator_spec.rb
        +describe Calculator do
        +  describe '#add' do
        +    it 'returns the sum of its arguments' do
        +      expect(Calculator.new.add(1, 2)).to eq(3)
        +    end
        +  end
        +end
        +
        + +

        Run this with the rspec command, and watch it fail:

        + +
        $ rspec spec/calculator_spec.rb
        +./spec/calculator_spec.rb:1: uninitialized constant Calculator
        +
        + +

        Implement the simplest solution:

        + +
        # in lib/calculator.rb
        +class Calculator
        +  def add(a,b)
        +    a + b
        +  end
        +end
        +
        + +

        Be sure to require the implementation file in the spec:

        + +
        # in spec/calculator_spec.rb
        +# - RSpec adds ./lib to the $LOAD_PATH
        +require "calculator"
        +
        + +

        Now run the spec again, and watch it pass:

        + +
        $ rspec spec/calculator_spec.rb
        +.
        +
        +Finished in 0.000315 seconds
        +1 example, 0 failures
        +
        + +

        Use the documentation formatter to see the resulting spec:

        + +
        $ rspec spec/calculator_spec.rb --format doc
        +Calculator
        +  #add
        +    returns the sum of its arguments
        +
        +Finished in 0.000379 seconds
        +1 example, 0 failures
        +
        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/file_list.html b/source/documentation/2.14/rspec-core/file_list.html new file mode 100644 index 000000000..4fbe39987 --- /dev/null +++ b/source/documentation/2.14/rspec-core/file_list.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-core/frames.html b/source/documentation/2.14/rspec-core/frames.html new file mode 100644 index 000000000..87a4a6df1 --- /dev/null +++ b/source/documentation/2.14/rspec-core/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + diff --git a/source/documentation/2.14/rspec-core/index.html b/source/documentation/2.14/rspec-core/index.html new file mode 100644 index 000000000..4c2b98c88 --- /dev/null +++ b/source/documentation/2.14/rspec-core/index.html @@ -0,0 +1,325 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        rspec-core Build Status Code Climate

        + +

        rspec-core provides the structure for writing executable examples of how your +code should behave, and an rspec command with tools to constrain which +examples get run and tailor the output.

        + +

        install

        + +
        gem install rspec      # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-core # for rspec-core only
        +rspec --help
        +
        + +

        basic structure

        + +

        RSpec uses the words "describe" and "it" so we can express concepts like a conversation:

        + +
        "Describe an order."
        +"It sums the prices of its line items."
        +
        + +
        describe Order do
        +  it "sums the prices of its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        The describe method creates an ExampleGroup. Within the +block passed to describe you can declare examples using the it method.

        + +

        Under the hood, an example group is a class in which the block passed to +describe is evaluated. The blocks passed to it are evaluated in the +context of an instance of that class.

        + +

        nested groups

        + +

        You can also declare nested nested groups using the describe or context +methods:

        + +
        describe Order do
        +  context "with no items" do
        +    it "behaves one way" do
        +      # ...
        +    end
        +  end
        +
        +  context "with one item" do
        +    it "behaves another way" do
        +      # ...
        +    end
        +  end
        +end
        +
        + +

        aliases

        + +

        You can declare example groups using either describe or context, though +only describe is available at the top level.

        + +

        You can declare examples within a group using any of it, specify, or +example.

        + +

        shared examples and contexts

        + +

        Declare a shared example group using shared_examples, and then include it +in any group using include_examples.

        + +
        shared_examples "collections" do |collection_class|
        +  it "is empty when first created" do
        +    expect(collection_class.new).to be_empty
        +  end
        +end
        +
        +describe Array do
        +  include_examples "collections", Array
        +end
        +
        +describe Hash do
        +  include_examples "collections", Hash
        +end
        +
        + +

        Nearly anything that can be declared within an example group can be declared +within a shared example group. This includes before, after, and around +hooks, let declarations, and nested groups/contexts.

        + +

        You can also use the names shared_context and include_context. These are +pretty much the same as shared_examples and include_examples, providing +more accurate naming when you share hooks, let declarations, helper methods, +etc, but no examples.

        + +

        metadata

        + +

        rspec-core stores a metadata hash with every example and group, which +contains their descriptions, the locations at which they were +declared, etc, etc. This hash powers many of rspec-core's features, +including output formatters (which access descriptions and locations), +and filtering before and after hooks.

        + +

        Although you probably won't ever need this unless you are writing an +extension, you can access it from an example like this:

        + +
        it "does something" do
        +  expect(example.[:description]).to eq("does something")
        +end
        +
        + +

        described_class

        + +

        When a class is passed to describe, you can access it from an example +using the described_class method, which is a wrapper for +example.metadata[:described_class].

        + +
        describe Widget do
        +  example do
        +    expect(described_class).to equal(Widget)
        +  end
        +end
        +
        + +

        This is useful in extensions or shared example groups in which the specific +class is unknown. Taking the collections shared example group from above, we can +clean it up a bit using described_class:

        + +
        shared_examples "collections" do
        +  it "is empty when first created" do
        +    expect(described_class.new).to be_empty
        +  end
        +end
        +
        +describe Array do
        +  include_examples "collections"
        +end
        +
        +describe Hash do
        +  include_examples "collections"
        +end
        +
        + +

        the rspec command

        + +

        When you install the rspec-core gem, it installs the rspec executable, +which you'll use to run rspec. The rspec command comes with many useful +options. +Run rspec --help to see the complete list.

        + +

        store command line options .rspec

        + +

        You can store command line options in a .rspec file in the project's root +directory, and the rspec command will read them as though you typed them on +the command line.

        + +

        autotest integration

        + +

        rspec-core ships with an Autotest extension, which is loaded automatically if +there is a .rspec file in the project's root directory.

        + +

        rcov integration

        + +

        rcov is best integrated via the rcov rake +task.

        + +

        rcov can also be integrated via the rspec rake task, but it requires a bit +more setup:

        + +
        # Rakefile
        +require 'rspec/core/rake_task'
        +
        +RSpec::Core::RakeTask.new(:spec) do |config|
        +  config.rcov = true
        +end
        +
        +task :default => :spec
        +
        +# spec/spec_helper.rb
        +require 'rspec/autorun' # **add this**
        +
        + +

        get started

        + +

        Start with a simple example of behavior you expect from your system. Do +this before you write any implementation code:

        + +
        # in spec/calculator_spec.rb
        +describe Calculator do
        +  describe '#add' do
        +    it 'returns the sum of its arguments' do
        +      expect(Calculator.new.add(1, 2)).to eq(3)
        +    end
        +  end
        +end
        +
        + +

        Run this with the rspec command, and watch it fail:

        + +
        $ rspec spec/calculator_spec.rb
        +./spec/calculator_spec.rb:1: uninitialized constant Calculator
        +
        + +

        Implement the simplest solution:

        + +
        # in lib/calculator.rb
        +class Calculator
        +  def add(a,b)
        +    a + b
        +  end
        +end
        +
        + +

        Be sure to require the implementation file in the spec:

        + +
        # in spec/calculator_spec.rb
        +# - RSpec adds ./lib to the $LOAD_PATH
        +require "calculator"
        +
        + +

        Now run the spec again, and watch it pass:

        + +
        $ rspec spec/calculator_spec.rb
        +.
        +
        +Finished in 0.000315 seconds
        +1 example, 0 failures
        +
        + +

        Use the documentation formatter to see the resulting spec:

        + +
        $ rspec spec/calculator_spec.rb --format doc
        +Calculator
        +  #add
        +    returns the sum of its arguments
        +
        +Finished in 0.000379 seconds
        +1 example, 0 failures
        +
        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-core/method_list.html b/source/documentation/2.14/rspec-core/method_list.html new file mode 100644 index 000000000..9510c5157 --- /dev/null +++ b/source/documentation/2.14/rspec-core/method_list.html @@ -0,0 +1,2307 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-core/top-level-namespace.html b/source/documentation/2.14/rspec-core/top-level-namespace.html new file mode 100644 index 000000000..f44ba0ee7 --- /dev/null +++ b/source/documentation/2.14/rspec-core/top-level-namespace.html @@ -0,0 +1,144 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + +
        Extended by:
        +
        RSpec::Core::DSL, RSpec::Core::SharedExampleGroup::TopLevelDSL
        + + + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Kernel, RSpec + + + + +

        + + + + + + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from RSpec::Core::SharedExampleGroup::TopLevelDSL

        +

        share_as, shared_example_groups, shared_examples

        + + + + + + + + + +

        Methods included from RSpec::Core::DSL

        +

        describe

        + + +
        + + + + + \ No newline at end of file From a4744e2a17e3feecebd8433994cb423315cb18ce Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:28:27 +1100 Subject: [PATCH 09/14] rspec-mocks 3.2 documentation --- .../3.2/rspec-mocks/BasicObject.html | 720 ++++ .../documentation/3.2/rspec-mocks/Class.html | 271 ++ .../documentation/3.2/rspec-mocks/RSpec.html | 129 + .../3.2/rspec-mocks/RSpec/Mocks.html | 860 +++++ .../RSpec/Mocks/ArgumentListMatcher.html | 387 ++ .../RSpec/Mocks/ArgumentMatchers.html | 924 +++++ .../RSpec/Mocks/Configuration.html | 1419 +++++++ .../3.2/rspec-mocks/RSpec/Mocks/Constant.html | 1073 ++++++ .../RSpec/Mocks/ConstantMutator.html | 537 +++ .../3.2/rspec-mocks/RSpec/Mocks/Double.html | 157 + .../RSpec/Mocks/ExampleMethods.html | 3383 +++++++++++++++++ .../Mocks/ExampleMethods/ExpectHost.html | 117 + .../3.2/rspec-mocks/RSpec/Mocks/Matchers.html | 118 + .../RSpec/Mocks/MessageExpectation.html | 1883 +++++++++ .../3.2/rspec-mocks/RSpec/Mocks/Syntax.html | 929 +++++ .../rspec-mocks/RSpec/Mocks/TestDouble.html | 613 +++ .../Mocks/VerifyingMessageExpectation.html | 335 ++ .../3.2/rspec-mocks/RSpec/Mocks/Version.html | 139 + .../documentation/3.2/rspec-mocks/_index.html | 306 ++ .../3.2/rspec-mocks/class_list.html | 54 + .../3.2/rspec-mocks/file.Changelog.html | 1338 +++++++ .../3.2/rspec-mocks/file.License.html | 73 + .../3.2/rspec-mocks/file.README.html | 482 +++ .../3.2/rspec-mocks/file_list.html | 62 + .../documentation/3.2/rspec-mocks/frames.html | 26 + .../documentation/3.2/rspec-mocks/index.html | 482 +++ .../3.2/rspec-mocks/method_list.html | 719 ++++ .../3.2/rspec-mocks/top-level-namespace.html | 140 + 28 files changed, 17676 insertions(+) create mode 100644 source/documentation/3.2/rspec-mocks/BasicObject.html create mode 100644 source/documentation/3.2/rspec-mocks/Class.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/Configuration.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/Constant.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/ConstantMutator.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/Double.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/ExampleMethods.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/Matchers.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/MessageExpectation.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/Syntax.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/TestDouble.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/VerifyingMessageExpectation.html create mode 100644 source/documentation/3.2/rspec-mocks/RSpec/Mocks/Version.html create mode 100644 source/documentation/3.2/rspec-mocks/_index.html create mode 100644 source/documentation/3.2/rspec-mocks/class_list.html create mode 100644 source/documentation/3.2/rspec-mocks/file.Changelog.html create mode 100644 source/documentation/3.2/rspec-mocks/file.License.html create mode 100644 source/documentation/3.2/rspec-mocks/file.README.html create mode 100644 source/documentation/3.2/rspec-mocks/file_list.html create mode 100644 source/documentation/3.2/rspec-mocks/frames.html create mode 100644 source/documentation/3.2/rspec-mocks/index.html create mode 100644 source/documentation/3.2/rspec-mocks/method_list.html create mode 100644 source/documentation/3.2/rspec-mocks/top-level-namespace.html diff --git a/source/documentation/3.2/rspec-mocks/BasicObject.html b/source/documentation/3.2/rspec-mocks/BasicObject.html new file mode 100644 index 000000000..88f17c6cd --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/BasicObject.html @@ -0,0 +1,720 @@ + + + + + + Class: BasicObject + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: BasicObject + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/syntax.rb
        + +
        +
        + +

        Overview

        +
        + +

        The legacy :should syntax adds the following methods directly +to BasicObject so that they are available off of any object. +Note, however, that this syntax does not always play nice with +delegate/proxy objects. We recommend you use the non-monkeypatching +:expect syntax instead.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) as_null_object + + + + + + + + + + + + + +
          +

          Tells the object to respond to all messages.

          +
          + +
        • + + +
        • + + + - (Object) null_object? + + + + + + + + + + + + + +
          +

          Returns true if this object has received as_null_object.

          +
          + +
        • + + +
        • + + + - (Object) should_not_receive + + + + + + + + + + + + + +
          +

          Sets and expectation that this object should not receive a message +during this example.

          +
          + +
        • + + +
        • + + + - (Object) should_receive + + + + + + + + + + + + + +
          +

          Sets an expectation that this object should receive a message before the +end of the example.

          +
          + +
        • + + +
        • + + + - (Object) stub + + + + + + + + + + + + + +
          +

          Tells the object to respond to the message with the specified value.

          +
          + +
        • + + +
        • + + + - (Object) stub_chain + + + + + + + + + + + + + +
          +

          Stubs a chain of methods.

          +
          + +
        • + + +
        • + + + - (Object) unstub + + + + + + + + + + + + + +
          +

          Removes a stub.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) as_null_object + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Tells the object to respond to all messages. If specific stub values are +declared, they'll work as expected. If not, the receiver is returned.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 286
        +
        +
        +
        +
        + +
        +

        + + - (Object) null_object? + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Returns true if this object has received as_null_object

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 297
        +
        +
        +
        +
        + +
        +

        + + - (Object) should_not_receive + + + + + +

        +
        + +

        Sets and expectation that this object should not receive a message +during this example.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 226
        +
        +
        +
        +
        + +
        +

        + + - (Object) should_receive + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Sets an expectation that this object should receive a message before the +end of the example.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +logger = double('logger')
        +thing_that_logs = ThingThatLogs.new(logger)
        +logger.should_receive(:log)
        +thing_that_logs.do_something_that_logs_a_message
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 212
        +
        +
        +
        +
        + +
        +

        + + - (Object) stub + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Tells the object to respond to the message with the specified value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +counter.stub(:count).and_return(37)
        +counter.stub(:count => 37)
        +counter.stub(:count) { 37 }
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 231
        +
        +
        +
        +
        + +
        +

        + + + - (Object) stub_chain(method1, method2) + + - (Object) stub_chain("method1.method2") + + - (Object) stub_chain(method1, method_to_value_hash) + + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Stubs a chain of methods.

        + +

        Warning:

        + +

        Chains can be arbitrarily long, which makes it quite painless to violate +the Law of Demeter in violent ways, so you should consider any use of +stub_chain a code smell. Even though not all code smells +indicate real problems (think fluent interfaces), stub_chain +still results in brittle examples. For example, if you write +foo.stub_chain(:bar, :baz => 37) in a spec and then the +implementation calls foo.baz.bar, the stub will not work.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +double.stub_chain("foo.bar") { :baz }
        +double.stub_chain(:foo, :bar => :baz)
        +double.stub_chain(:foo, :bar) { :baz }
        +
        +# Given any of ^^ these three forms ^^:
        +double.foo.bar # => :baz
        +
        +# Common use in Rails/ActiveRecord:
        +Article.stub_chain("recent.published") { [Article.new] }
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 254
        +
        +
        +
        +
        + +
        +

        + + - (Object) unstub + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Removes a stub. On a double, the object will no longer respond to +message. On a real object, the original method (if it exists) +is restored.

        + +

        This is rarely used, but can be useful when a stub is set up during a +shared before hook for the common case, but you want to +replace it for a special case.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 243
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/Class.html b/source/documentation/3.2/rspec-mocks/Class.html new file mode 100644 index 000000000..2f5817322 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/Class.html @@ -0,0 +1,271 @@ + + + + + + Class: Class + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: Class + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/syntax.rb
        + +
        +
        + +

        Overview

        +
        + +

        The legacy :should syntax adds the any_instance +to Class. We generally recommend you use the newer +:expect syntax instead, which allows you to stub any instance +of a class using allow_any_instance_of(klass) or mock any +instance using expect_any_instance_of(klass).

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Recorder) any_instance + + + + + + + + + + + + + +
          +

          Used to set stubs and message expectations on any instance of a given +class.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Recorder) any_instance + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Used to set stubs and message expectations on any instance of a given +class. Returns a Recorder, which records messages +like stub and should_receive for later playback +on instances of the class.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +Car.any_instance.should_receive(:go)
        +race = Race.new
        +race.cars << Car.new
        +race.go # assuming this delegates to all of its cars
        +        # this example would pass
        +
        +Account.any_instance.stub(:balance) { Money.new(:USD, 25) }
        +Account.new.balance # => Money.new(:USD, 25))
        + +
        + +

        Returns:

        +
          + +
        • + + + (Recorder) + + + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 329
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec.html b/source/documentation/3.2/rspec-mocks/RSpec.html new file mode 100644 index 000000000..b1520db07 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec.html @@ -0,0 +1,129 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks.rb,
        + lib/rspec/mocks/proxy.rb,
        lib/rspec/mocks/space.rb,
        lib/rspec/mocks/syntax.rb,
        lib/rspec/mocks/version.rb,
        lib/rspec/mocks/targets.rb,
        lib/rspec/mocks/test_double.rb,
        lib/rspec/mocks/order_group.rb,
        lib/rspec/mocks/mutate_const.rb,
        lib/rspec/mocks/configuration.rb,
        lib/rspec/mocks/message_chain.rb,
        lib/rspec/mocks/method_double.rb,
        lib/rspec/mocks/example_methods.rb,
        lib/rspec/mocks/verifying_proxy.rb,
        lib/rspec/mocks/error_generator.rb,
        lib/rspec/mocks/method_reference.rb,
        lib/rspec/mocks/matchers/receive.rb,
        lib/rspec/mocks/verifying_double.rb,
        lib/rspec/mocks/object_reference.rb,
        lib/rspec/mocks/argument_matchers.rb,
        lib/rspec/mocks/marshal_extension.rb,
        lib/rspec/mocks/any_instance/proxy.rb,
        lib/rspec/mocks/any_instance/chain.rb,
        lib/rspec/mocks/message_expectation.rb,
        lib/rspec/mocks/any_instance/recorder.rb,
        lib/rspec/mocks/argument_list_matcher.rb,
        lib/rspec/mocks/matchers/have_received.rb,
        lib/rspec/mocks/instance_method_stasher.rb,
        lib/rspec/mocks/any_instance/stub_chain.rb,
        lib/rspec/mocks/matchers/receive_messages.rb,
        lib/rspec/mocks/any_instance/message_chains.rb,
        lib/rspec/mocks/verifying_message_expecation.rb,
        lib/rspec/mocks/any_instance/stub_chain_chain.rb,
        lib/rspec/mocks/matchers/receive_message_chain.rb,
        lib/rspec/mocks/any_instance/expectation_chain.rb,
        lib/rspec/mocks/any_instance/expect_chain_chain.rb,
        lib/rspec/mocks/matchers/expectation_customization.rb
        +
        + +
        +
        + +

        Overview

        +
        + +

        Share the top-level RSpec namespace, because we are a core supported +extension.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: Mocks + + + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks.html new file mode 100644 index 000000000..56d26100a --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks.html @@ -0,0 +1,860 @@ + + + + + + Module: RSpec::Mocks + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks.rb,
        + lib/rspec/mocks/proxy.rb,
        lib/rspec/mocks/space.rb,
        lib/rspec/mocks/syntax.rb,
        lib/rspec/mocks/version.rb,
        lib/rspec/mocks/targets.rb,
        lib/rspec/mocks/test_double.rb,
        lib/rspec/mocks/order_group.rb,
        lib/rspec/mocks/mutate_const.rb,
        lib/rspec/mocks/configuration.rb,
        lib/rspec/mocks/message_chain.rb,
        lib/rspec/mocks/method_double.rb,
        lib/rspec/mocks/example_methods.rb,
        lib/rspec/mocks/verifying_proxy.rb,
        lib/rspec/mocks/error_generator.rb,
        lib/rspec/mocks/method_reference.rb,
        lib/rspec/mocks/matchers/receive.rb,
        lib/rspec/mocks/verifying_double.rb,
        lib/rspec/mocks/object_reference.rb,
        lib/rspec/mocks/argument_matchers.rb,
        lib/rspec/mocks/marshal_extension.rb,
        lib/rspec/mocks/any_instance/proxy.rb,
        lib/rspec/mocks/any_instance/chain.rb,
        lib/rspec/mocks/message_expectation.rb,
        lib/rspec/mocks/any_instance/recorder.rb,
        lib/rspec/mocks/argument_list_matcher.rb,
        lib/rspec/mocks/matchers/have_received.rb,
        lib/rspec/mocks/instance_method_stasher.rb,
        lib/rspec/mocks/any_instance/stub_chain.rb,
        lib/rspec/mocks/matchers/receive_messages.rb,
        lib/rspec/mocks/any_instance/message_chains.rb,
        lib/rspec/mocks/verifying_message_expecation.rb,
        lib/rspec/mocks/any_instance/stub_chain_chain.rb,
        lib/rspec/mocks/matchers/receive_message_chain.rb,
        lib/rspec/mocks/any_instance/expectation_chain.rb,
        lib/rspec/mocks/any_instance/expect_chain_chain.rb,
        lib/rspec/mocks/matchers/expectation_customization.rb
        +
        + +
        +
        + +

        Overview

        +
        + +

        Contains top-level utility methods. While this contains a few public +methods, these are not generally meant to be called from a test or example. +They exist primarily for integration with test frameworks (such as +rspec-core).

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: ArgumentMatchers, ExampleMethods, Matchers, Syntax, TestDouble, Version + + + + Classes: ArgumentListMatcher, Configuration, Constant, ConstantMutator, Double, MessageExpectation, VerifyingMessageExpectation + + +

        + +

        Constant Summary

        + +
        + +
        MockExpectationError = +
        +
        + +

        Raised when a message expectation is not satisfied.

        + + +
        +
        +
        + + +
        +
        +
        Class.new(Exception)
        + +
        ExpiredTestDoubleError = +
        +
        + +

        Raised when a test double is used after it has been torn down (typically at +the end of an rspec-core example).

        + + +
        +
        +
        + + +
        +
        +
        Class.new(MockExpectationError)
        + +
        OutsideOfExampleError = +
        +
        + +

        Raised when doubles or partial doubles are used outside of the per-test +lifecycle.

        + + +
        +
        +
        + + +
        +
        +
        Class.new(StandardError)
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) allow_message(subject, message, opts = {}) { ... } + + + + + +

        +
        + +

        Adds an allowance (stub) on subject

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        +

        Defines the implementation of foo on bar, using +the passed block

        +

        + +
        x = 0
        +RSpec::Mocks.allow_message(bar, :foo) { x += 1 }
        + +
        +

        Parameters:

        +
          + +
        • + + subject + + + + + + + — +
          +

          the subject to which the message will be added

          +
          + +
        • + +
        • + + message + + + + + + + — +
          +

          a symbol, representing the message that will be added.

          +
          + +
        • + +
        • + + opts + + + + + + (defaults to: {}) + + + — +
          +

          a hash of options, :expected_from is used to set the original call site

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + + + + + +
          +

          an optional implementation for the allowance

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +69
        +70
        +71
        +
        +
        # File 'lib/rspec/mocks.rb', line 69
        +
        +def self.allow_message(subject, message, opts={}, &block)
        +  space.proxy_for(subject).add_stub(message, opts, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) configuration + + + + + +

        +
        + +

        Mocks specific configuration, as distinct from +RSpec.configuration which is core RSpec configuration.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 169
        +
        +def self.configuration
        +  @configuration ||= Configuration.new
        +end
        +
        +
        + +
        +

        + + + (Object) expect_message(subject, message, opts = {}) { ... } + + + + + +

        +
        + +

        Sets a message expectation on subject.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        +

        Expect the message foo to receive bar, then call +it

        +

        + +
        RSpec::Mocks.expect_message(bar, :foo)
        +bar.foo
        + +
        +

        Parameters:

        +
          + +
        • + + subject + + + + + + + — +
          +

          the subject on which the message will be expected

          +
          + +
        • + +
        • + + message + + + + + + + — +
          +

          a symbol, representing the message that will be expected.

          +
          + +
        • + +
        • + + opts + + + + + + (defaults to: {}) + + + — +
          +

          a hash of options, :expected_from is used to set the original call site

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + + + + + +
          +

          an optional implementation for the expectation

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/mocks.rb', line 84
        +
        +def self.expect_message(subject, message, opts={}, &block)
        +  space.proxy_for(subject).add_message_expectation(message, opts, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) setup + + + + + +

        +
        + +

        Performs per-test/example setup. This should be called before an test or +example begins.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/mocks.rb', line 38
        +
        +def self.setup
        +  @space_stack << (@space = space.new_scope)
        +end
        +
        +
        + +
        +

        + + + (Object) teardown + + + + + +

        +
        + +

        Cleans up all test double state (including any methods that were redefined +on partial doubles). This must be called after each example, even +if an error was raised during the example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/mocks.rb', line 51
        +
        +def self.teardown
        +  space.reset_all
        +  @space_stack.pop
        +  @space = @space_stack.last || @root_space
        +end
        +
        +
        + +
        +

        + + + (Object) verify + + + + + +

        +
        + +

        Verifies any message expectations that were set during the test or example. +This should be called at the end of an example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +44
        +45
        +46
        +
        +
        # File 'lib/rspec/mocks.rb', line 44
        +
        +def self.verify
        +  space.verify_all
        +end
        +
        +
        + +
        +

        + + + (Object) with_temporary_scope + + + + + +

        +
        + +

        Call the passed block and verify mocks after it has executed. This allows +mock usage in arbitrary places, such as a before(:all) hook.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/mocks.rb', line 90
        +
        +def self.with_temporary_scope
        +  setup
        +
        +  begin
        +    yield
        +    verify
        +  ensure
        +    teardown
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html new file mode 100644 index 000000000..b6da69ceb --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html @@ -0,0 +1,387 @@ + + + + + + Class: RSpec::Mocks::ArgumentListMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentListMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_list_matcher.rb
        + +
        +
        + +

        Overview

        +
        + +

        Wrapper for matching arguments against a list of expected values. Used by +the with method on a MessageExpectation:

        + +
        expect(object).to receive(:message).with(:a, 'b', 3)
        +object.message(:a, 'b', 3)
        + +

        Values passed to with can be literal values or argument +matchers that match against the real objects .e.g.

        + +
        expect(object).to receive(:message).with(hash_including(:a => 'b'))
        +
        + +

        Can also be used directly to match the contents of any Array. +This enables 3rd party mocking libs to take advantage of rspec's +argument matching without using the rest of rspec-mocks.

        + +
        require 'rspec/mocks/argument_list_matcher'
        +include RSpec::Mocks::ArgumentMatchers
        +
        +arg_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(123, hash_including(:a => 'b'))
        +arg_list_matcher.args_match?(123, :a => 'b')
        +
        + +

        This class is immutable.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        +

        Constant Summary

        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Boolean) args_match?(*args) + + + + + + + + + + + + + +
          +

          Matches each element in the expected_args against the element +in the same position of the arguments passed to new.

          +
          + +
        • + + +
        • + + + - (ArgumentListMatcher) initialize(*expected_args) + + + + + + + constructor + + + + + + + + +
          +

          Initializes an ArgumentListMatcher with a collection of +literal values and/or argument matchers.

          +
          + +
        • + + +
        + + +
        +

        Constructor Details

        + +
        +

        + + - (ArgumentListMatcher) initialize(*expected_args) + + + + + +

        +
        + +

        Initializes an ArgumentListMatcher with a collection of +literal values and/or argument matchers.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + expected_args + + + (Array) + + + + — +
          +

          a list of expected literals and/or argument matchers

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/mocks/argument_list_matcher.rb', line 45
        +
        +def initialize(*expected_args)
        +  @expected_args = expected_args
        +  ensure_expected_args_valid!
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) args_match?(*args) + + + + + +

        +
        + +

        Matches each element in the expected_args against the element +in the same position of the arguments passed to new.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + args + + + (Array) + + + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/mocks/argument_list_matcher.rb', line 57
        +
        +def args_match?(*args)
        +  Support::FuzzyMatcher.values_match?(resolve_expected_args_based_on(args), args)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html new file mode 100644 index 000000000..d918a8420 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html @@ -0,0 +1,924 @@ + + + + + + Module: RSpec::Mocks::ArgumentMatchers + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ArgumentMatchers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleMethods
        + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + +

        Overview

        +
        + +

        ArgumentMatchers are placeholders that you can include in message +expectations to match arguments against a broader check than simple +equality.

        + +

        With the exception of any_args and no_args, they +all match against the arg in same position in the argument list.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) any_args + + + + + + + + + + + + + +
          +

          Acts like an arg splat, matching any number of args at any point in an arg +list.

          +
          + +
        • + + +
        • + + + - (Object) anything + + + + + + + + + + + + + +
          +

          Matches any argument at all.

          +
          + +
        • + + +
        • + + + - (Object) array_including(*args) + + + + + + + + + + + + + +
          +

          Matches an array that includes the specified items at least once.

          +
          + +
        • + + +
        • + + + - (Object) boolean + + + + + + + + + + + + + +
          +

          Matches a boolean value.

          +
          + +
        • + + +
        • + + + - (Object) duck_type(*args) + + + + + + + + + + + + + +
          +

          Matches if the actual argument responds to the specified messages.

          +
          + +
        • + + +
        • + + + - (Object) hash_excluding(*args) + + + + (also: #hash_not_including) + + + + + + + + + + + +
          +

          Matches a hash that doesn't include the specified key(s) or key/value.

          +
          + +
        • + + +
        • + + + - (Object) hash_including(*args) + + + + + + + + + + + + + +
          +

          Matches a hash that includes the specified key(s) or key/value pairs.

          +
          + +
        • + + +
        • + + + - (Object) instance_of(klass) + + + + (also: #an_instance_of) + + + + + + + + + + + +
          +

          Matches if arg.instance_of?(klass).

          +
          + +
        • + + +
        • + + + - (Object) kind_of(klass) + + + + (also: #a_kind_of) + + + + + + + + + + + +
          +

          Matches if arg.kind_of?(klass).

          +
          + +
        • + + +
        • + + + - (Object) no_args + + + + + + + + + + + + + +
          +

          Matches no arguments.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) any_args + + + + + +

        +
        + +

        Acts like an arg splat, matching any number of args at any point in an arg +list.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(1, 2, any_args)
        +
        +# matches any of these:
        +object.message(1, 2)
        +object.message(1, 2, 3)
        +object.message(1, 2, 3, 4)
        + +
        + + +
        + + + + +
        +
        +
        +
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 27
        +
        +def any_args
        +  AnyArgsMatcher::INSTANCE
        +end
        +
        +
        + +
        +

        + + - (Object) anything + + + + + +

        +
        + +

        Matches any argument at all.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(anything)
        + +
        + + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 36
        +
        +def anything
        +  AnyArgMatcher::INSTANCE
        +end
        +
        +
        + +
        +

        + + - (Object) array_including(*args) + + + + + +

        +
        + +

        Matches an array that includes the specified items at least once. Ignores +duplicates and additional values

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(array_including(1,2,3))
        +expect(object).to receive(:message).with(array_including([1,2,3]))
        + +
        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +90
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 87
        +
        +def array_including(*args)
        +  actually_an_array = Array === args.first && args.count == 1 ? args.first : args
        +  ArrayIncludingMatcher.new(actually_an_array)
        +end
        +
        +
        + +
        +

        + + - (Object) boolean + + + + + +

        +
        + +

        Matches a boolean value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(boolean())
        + +
        + + +
        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 64
        +
        +def boolean
        +  BooleanMatcher::INSTANCE
        +end
        +
        +
        + +
        +

        + + - (Object) duck_type(*args) + + + + + +

        +
        + +

        Matches if the actual argument responds to the specified messages.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(duck_type(:hello))
        +expect(object).to receive(:message).with(duck_type(:hello, :goodbye))
        + +
        + + +
        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 55
        +
        +def duck_type(*args)
        +  DuckTypeMatcher.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) hash_excluding(*args) + + + + Also known as: + hash_not_including + + + + +

        +
        + +

        Matches a hash that doesn't include the specified key(s) or key/value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(hash_excluding(:key => val))
        +expect(object).to receive(:message).with(hash_excluding(:key))
        +expect(object).to receive(:message).with(hash_excluding(:key, :key2 => :val2))
        + +
        + + +
        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 99
        +
        +def hash_excluding(*args)
        +  HashExcludingMatcher.new(ArgumentMatchers.anythingize_lonely_keys(*args))
        +end
        +
        +
        + +
        +

        + + - (Object) hash_including(*args) + + + + + +

        +
        + +

        Matches a hash that includes the specified key(s) or key/value pairs. +Ignores any additional keys.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(hash_including(:key => val))
        +expect(object).to receive(:message).with(hash_including(:key))
        +expect(object).to receive(:message).with(hash_including(:key, :key2 => val2))
        + +
        + + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 76
        +
        +def hash_including(*args)
        +  HashIncludingMatcher.new(ArgumentMatchers.anythingize_lonely_keys(*args))
        +end
        +
        +
        + +
        +

        + + - (Object) instance_of(klass) + + + + Also known as: + an_instance_of + + + + +

        +
        + +

        Matches if arg.instance_of?(klass)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(instance_of(Thing))
        + +
        + + +
        + + + + +
        +
        +
        +
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 110
        +
        +def instance_of(klass)
        +  InstanceOf.new(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) kind_of(klass) + + + + Also known as: + a_kind_of + + + + +

        +
        + +

        Matches if arg.kind_of?(klass)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(kind_of(Thing))
        + +
        + + +
        + + + + +
        +
        +
        +
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 120
        +
        +def kind_of(klass)
        +  KindOf.new(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) no_args + + + + + +

        +
        + +

        Matches no arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(object).to receive(:message).with(no_args)
        + +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 45
        +
        +def no_args
        +  NoArgsMatcher::INSTANCE
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Configuration.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Configuration.html new file mode 100644 index 000000000..30ea57e8b --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Configuration.html @@ -0,0 +1,1419 @@ + + + + + + Class: RSpec::Mocks::Configuration + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/configuration.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides configuration options for rspec-mocks.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) color + + + + + + + + + + writeonly + + + + + + + + +
          +

          Indicates whether or not diffs should be colored.

          +
          + +
        • + + +
        • + + + - (Object) transfer_nested_constants + + + + + + + + + + writeonly + + + + + + + + +
          +

          Sets the default for the transfer_nested_constants option when +stubbing constants.

          +
          + +
        • + + +
        • + + + - (Object) verify_doubled_constant_names + + + + + + + + + + writeonly + + + + + + + + +
          +

          When this is set to true, an error will be raised when +instance_double or class_double is given the name +of an undefined constant.

          +
          + +
        • + + +
        • + + + - (Object) yield_receiver_to_any_instance_implementation_blocks + + + + + + + + + + writeonly + + + + + + + + +
          +

          Sets whether or not RSpec will yield the receiving instance of a message to +blocks that are used for any_instance stub implementations.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Configuration) initialize + + + + + +

        +
        + +

        Returns a new instance of Configuration

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 5
        +
        +def initialize
        +  @yield_receiver_to_any_instance_implementation_blocks = true
        +  @verify_doubled_constant_names = false
        +  @transfer_nested_constants = false
        +  @verify_partial_doubles = false
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) color=(value) (writeonly) + + + + + +

        +
        + +

        Indicates whether or not diffs should be colored. Delegates to +rspec-core's color option if rspec-core is loaded; otherwise you can +set it here.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +134
        +135
        +136
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 134
        +
        +def color=(value)
        +  @color = value
        +end
        +
        +
        + + + +
        +

        + + - (Object) transfer_nested_constants=(value) (writeonly) + + + + + +

        +
        + +

        Sets the default for the transfer_nested_constants option when +stubbing constants.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 113
        +
        +def transfer_nested_constants=(value)
        +  @transfer_nested_constants = value
        +end
        +
        +
        + + + +
        +

        + + - (Object) verify_doubled_constant_names=(value) (writeonly) + + + + + +

        +
        + +

        When this is set to true, an error will be raised when +instance_double or class_double is given the name +of an undefined constant. You probably only want to set this when running +your entire test suite, with all production code loaded. Setting this for +an isolated unit test will prevent you from being able to isolate it!

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +105
        +106
        +107
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 105
        +
        +def verify_doubled_constant_names=(value)
        +  @verify_doubled_constant_names = value
        +end
        +
        +
        + + + +
        +

        + + - (Object) yield_receiver_to_any_instance_implementation_blocks=(value) (writeonly) + + + + + +

        +
        + +

        Sets whether or not RSpec will yield the receiving instance of a message to +blocks that are used for any_instance stub implementations. When set, the +first yielded argument will be the receiving instance. Defaults to +true.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.mock_with :rspec do |mocks|
        +    mocks.yield_receiver_to_any_instance_implementation_blocks = false
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 28
        +
        +def yield_receiver_to_any_instance_implementation_blocks=(value)
        +  @yield_receiver_to_any_instance_implementation_blocks = value
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_stub_and_should_receive_to(*modules) + + + + + +

        +
        + +

        Adds stub and should_receive to the given modules +or classes. This is usually only necessary if you application uses some +proxy classes that “strip themselves down” to a bare minimum set of methods +and remove stub and should_receive in the +process.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.mock_with :rspec do |mocks|
        +    mocks.add_stub_and_should_receive_to Delegator
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 45
        +
        +def add_stub_and_should_receive_to(*modules)
        +  modules.each do |mod|
        +    Syntax.enable_should(mod)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) color? + + + + + +

        +
        + +

        Indicates whether or not diffs should be colored. Delegates to +rspec-core's color option if rspec-core is loaded; otherwise you can +set it here.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 139
        +
        +def color?
        +  ::RSpec.configuration.color_enabled?
        +end
        +
        +
        + +
        +

        + + - (Object) patch_marshal_to_support_partial_doubles=(val) + + + + + +

        +
        + +

        Monkey-patch Marshal.dump to enable dumping of mocked or +stubbed objects. By default this will not work since RSpec mocks works by +adding singleton methods that cannot be serialized. This patch removes +these singleton methods before serialization. Setting to falsey removes the +patch.

        + +

        This method is idempotent.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +151
        +152
        +153
        +154
        +155
        +156
        +157
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 151
        +
        +def patch_marshal_to_support_partial_doubles=(val)
        +  if val
        +    RSpec::Mocks::MarshalExtension.patch!
        +  else
        +    RSpec::Mocks::MarshalExtension.unpatch!
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) reset_syntaxes_to_default + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Resets the configured syntax to the default.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +161
        +162
        +163
        +164
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 161
        +
        +def reset_syntaxes_to_default
        +  self.syntax = [:should, :expect]
        +  RSpec::Mocks::Syntax.warn_about_should!
        +end
        +
        +
        + +
        +

        + + - (Object) syntax + + + + + +

        +
        + +

        Returns an array with a list of syntaxes that are enabled.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +unless RSpec::Mocks.configuration.syntax.include?(:expect)
        +  raise "this RSpec extension gem requires the rspec-mocks `:expect` syntax"
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +89
        +90
        +91
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 89
        +
        +def syntax
        +  syntaxes = []
        +  syntaxes << :should  if Syntax.should_enabled?
        +  syntaxes << :expect if Syntax.expect_enabled?
        +  syntaxes
        +end
        +
        +
        + +
        +

        + + - (Object) syntax=(*values) + + + + + +

        +
        + +

        Provides the ability to set either expect, should +or both syntaxes. RSpec uses expect syntax by default. This is +needed if you want to explicitly enable should syntax and/or +explicitly disable expect syntax.

        + +

        end

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.mock_with :rspec do |mocks|
        +    mocks.syntax = [:expect, :should]
        +  end
        + +
        + + +
        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 65
        +
        +def syntax=(*values)
        +  syntaxes = values.flatten
        +  if syntaxes.include?(:expect)
        +    Syntax.enable_expect
        +  else
        +    Syntax.disable_expect
        +  end
        +
        +  if syntaxes.include?(:should)
        +    Syntax.enable_should
        +  else
        +    Syntax.disable_should
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) transfer_nested_constants? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 107
        +
        +def transfer_nested_constants?
        +  !!@transfer_nested_constants
        +end
        +
        +
        + +
        +

        + + - (Boolean) verify_doubled_constant_names? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +96
        +97
        +98
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 96
        +
        +def verify_doubled_constant_names?
        +  !!@verify_doubled_constant_names
        +end
        +
        +
        + +
        +

        + + - (Object) verify_partial_doubles=(val) + + + + + +

        +
        + +

        When set to true, partial mocks will be verified the same as object +doubles. Any stubs will have their arguments checked against the original +method, and methods that do not exist cannot be stubbed.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 118
        +
        +def verify_partial_doubles=(val)
        +  @verify_partial_doubles = !!val
        +end
        +
        +
        + +
        +

        + + - (Boolean) verify_partial_doubles? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +122
        +123
        +124
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 122
        +
        +def verify_partial_doubles?
        +  @verify_partial_doubles
        +end
        +
        +
        + +
        +

        + + - (Boolean) yield_receiver_to_any_instance_implementation_blocks? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 12
        +
        +def yield_receiver_to_any_instance_implementation_blocks?
        +  @yield_receiver_to_any_instance_implementation_blocks
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Constant.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Constant.html new file mode 100644 index 000000000..7d328cc33 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Constant.html @@ -0,0 +1,1073 @@ + + + + + + Class: RSpec::Mocks::Constant + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Constant + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        Support::RecursiveConstMethods
        + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides information about constants that may (or may not) have been +mutated by rspec-mocks.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (String) name + + + + + + + + + readonly + + + + + + + + + +
          +

          The fully qualified name of the constant.

          +
          + +
        • + + +
        • + + + - (Object?) original_value + + + + + + + + + + + + + + + + +
          +

          The original value (e.g. before it was mutated by rspec-mocks) of the +constant, or nil if the constant was not previously defined.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (Constant) original(name) + + + + + + + + + + + + + +
          +

          Queries rspec-mocks to find out information about the named constant.

          +
          + +
        • + + +
        + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Boolean) hidden? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has hidden this constant.

          +
          + +
        • + + +
        • + + + - (Constant) initialize(name) {|_self| ... } + + + + + + + constructor + + + + + + private + + +
          +

          A new instance of Constant.

          +
          + +
        • + + +
        • + + + - (Boolean) mutated? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has mutated (stubbed or hidden) this constant.

          +
          + +
        • + + +
        • + + + - (Boolean) previously_defined? + + + + + + + + + + + + + +
          +

          Whether or not the constant was defined before the current example.

          +
          + +
        • + + +
        • + + + - (Boolean) stubbed? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has stubbed this constant.

          +
          + +
        • + + +
        • + + + - (Object) to_s + + + + (also: #inspect) + + + + + + + + + + + +
          +

          The default to_s isn't very useful, so a custom version is +provided.

          +
          + +
        • + + +
        • + + + - (Boolean) valid_name? + + + + + + + + + + + + + +
          +

          Whether or not the provided constant name is a valid Ruby constant name.

          +
          + +
        • + + +
        + + + +
        +

        Constructor Details

        + +
        +

        + + - (Constant) initialize(name) {|_self| ... } + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of Constant

        + + +
        +
        +
        + +

        Yields:

        +
          + +
        • + + + (_self) + + + +
        • + +
        +

        Yield Parameters:

        +
          + +
        • + + _self + + + (RSpec::Mocks::Constant) + + + + — +
          +

          the object that the method was called on

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 11
        +
        +def initialize(name)
        +  @name = name
        +  @previously_defined = false
        +  @stubbed = false
        +  @hidden = false
        +  @valid_name = true
        +  yield self if block_given?
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (String) name (readonly) + + + + + +

        +
        + +

        Returns The fully qualified name of the constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The fully qualified name of the constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 21
        +
        +def name
        +  @name
        +end
        +
        +
        + + + +
        +

        + + - (Object?) original_value + + + + + +

        +
        + +

        Returns The original value (e.g. before it was mutated by rspec-mocks) of +the constant, or nil if the constant was not previously defined.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object, nil) + + + + — +
          +

          The original value (e.g. before it was mutated by rspec-mocks) of the +constant, or nil if the constant was not previously defined.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 26
        +
        +def original_value
        +  @original_value
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Constant) original(name) + + + + + +

        +
        + +

        Queries rspec-mocks to find out information about the named constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + + — +
          +

          the name of the constant

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Constant) + + + + — +
          +

          an object contaning information about the named constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 86
        +
        +def self.original(name)
        +  mutator = ::RSpec::Mocks.space.constant_mutator_for(name)
        +  mutator ? mutator.to_constant : unmutated(name)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) hidden? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has hidden this constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has hidden this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 51
        +
        +def hidden?
        +  @hidden
        +end
        +
        +
        + +
        +

        + + - (Boolean) mutated? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has mutated (stubbed or hidden) this +constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has mutated (stubbed or hidden) this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 39
        +
        +def mutated?
        +  @stubbed || @hidden
        +end
        +
        +
        + +
        +

        + + - (Boolean) previously_defined? + + + + + +

        +
        + +

        Returns Whether or not the constant was defined before the current example.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not the constant was defined before the current example.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 33
        +
        +def previously_defined?
        +  @previously_defined
        +end
        +
        +
        + +
        +

        + + - (Boolean) stubbed? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has stubbed this constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has stubbed this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 45
        +
        +def stubbed?
        +  @stubbed
        +end
        +
        +
        + +
        +

        + + - (Object) to_s + + + + Also known as: + inspect + + + + +

        +
        + +

        The default to_s isn't very useful, so a custom version is +provided.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 62
        +
        +def to_s
        +  "#<#{self.class.name} #{name}>"
        +end
        +
        +
        + +
        +

        + + - (Boolean) valid_name? + + + + + +

        +
        + +

        Returns Whether or not the provided constant name is a valid Ruby constant +name.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not the provided constant name is a valid Ruby constant name.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 57
        +
        +def valid_name?
        +  @valid_name
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ConstantMutator.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ConstantMutator.html new file mode 100644 index 000000000..6fb754b0b --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ConstantMutator.html @@ -0,0 +1,537 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        Support::RecursiveConstMethods
        + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides a means to stub constants.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) hide(constant_name) + + + + + +

        +
        + +
        + Note: +
        +

        It's recommended that you use hide_const in your examples. +This is an alternate public API that is provided so you can hide constants +in other contexts (e.g. helper classes).

        +
        +
        + + +

        Hides a constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +127
        +128
        +129
        +130
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 127
        +
        +def self.hide(constant_name)
        +  mutate(ConstantHider.new(constant_name, nil, {}))
        +  nil
        +end
        +
        +
        + +
        +

        + + + (Object) raise_on_invalid_const + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Used internally by the constant stubbing to raise a helpful error when a +constant like “A::B::C” is stubbed and A::B is not a module (and thus, +it's impossible to define “A::B::C” since only modules can have nested +constants).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +327
        +328
        +329
        +330
        +331
        +332
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 327
        +
        +def self.raise_on_invalid_const
        +  lambda do |const_name, failed_name|
        +    raise "Cannot stub constant #{failed_name} on #{const_name} " \
        +          "since #{const_name} is not a module."
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) stub(constant_name, value, options = {}) + + + + + +

        +
        + +
        + Note: +
        +

        It's recommended that you use stub_const in your examples. +This is an alternate public API that is provided so you can stub constants +in other contexts (e.g. helper classes).

        +
        +
        + + +

        Stubs a constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        • + + value + + + (Object) + + + + — +
          +

          The value to make the constant refer to. When the example completes, the +constant will be restored to its prior state.

          +
          + +
        • + +
        • + + options + + + (Hash) + + + (defaults to: {}) + + + — +
          +

          Stubbing options.

          +
          + +
        • + +
        + + + + + + + + +

        Options Hash (options):

        +
          + +
        • + :transfer_nested_constants + (Boolean, Array<Symbol>) + + + + + —
          +

          Determines what nested constants, if any, will be transferred from the +original value of the constant to the new value of the constant. This only +works if both the original and new values are modules (or classes).

          +
          + +
        • + +
        + + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +
          +

          the stubbed value of the constant

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 107
        +
        +def self.stub(constant_name, value, options={})
        +  mutator = if recursive_const_defined?(constant_name, &raise_on_invalid_const)
        +              DefinedConstantReplacer
        +            else
        +              UndefinedConstantSetter
        +            end
        +
        +  mutate(mutator.new(constant_name, value, options[:transfer_nested_constants]))
        +  value
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Double.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Double.html new file mode 100644 index 000000000..8e8e13927 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Double.html @@ -0,0 +1,157 @@ + + + + + + Class: RSpec::Mocks::Double + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Double + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        TestDouble
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/test_double.rb
        + +
        +
        + +

        Overview

        +
        + +

        A generic test double object. double, +instance_double and friends return an instance of this.

        + + +
        +
        +
        + + +
        + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from TestDouble

        +

        #==, #as_null_object, #freeze, #initialize, #null_object?

        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + + in the class RSpec::Mocks::TestDouble + +

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ExampleMethods.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ExampleMethods.html new file mode 100644 index 000000000..bbf193226 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ExampleMethods.html @@ -0,0 +1,3383 @@ + + + + + + Module: RSpec::Mocks::ExampleMethods + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ExampleMethods + + + +

        + +
        + + + + + +
        Includes:
        +
        ArgumentMatchers
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/example_methods.rb
        + +
        +
        + +

        Overview

        +
        + +

        Contains methods intended to be used from within code examples. Mix this in +to your test context (such as a test framework base class) to use +rspec-mocks with your test framework. If you're using rspec-core, +it'll take care of doing this for you.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: ExpectHost + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from ArgumentMatchers

        +

        #any_args, #anything, #array_including, #boolean, #duck_type, #hash_excluding, #hash_including, #instance_of, #kind_of, #no_args

        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) allow + + + + + +

        +
        + +
        + Note: +
        +

        If you disable the :expect syntax this method will be +undefined.

        +
        +
        + + +

        Used to wrap an object in preparation for stubbing a method on it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +allow(dbl).to receive(:foo).with(5).and_return(:return_value)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 298
        +
        +
        +
        +
        + +
        +

        + + - (Object) allow_any_instance_of + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to wrap a class in preparation for stubbing a method on instances of +it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +allow_any_instance_of(MyClass).to receive(:foo)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 318
        +
        +
        +
        +
        + +
        +

        + + - (Object) allow_message_expectations_on_nil + + + + + +

        +
        + +

        Disables warning messages about expectations being set on nil.

        + +

        By default warning messages are issued when expectations are set on nil. +This is to prevent false-positives and to catch potential bugs early on.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +201
        +202
        +203
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 201
        +
        +def allow_message_expectations_on_nil
        +  RSpec::Mocks.space.proxy_for(nil).warn_about_expectations = false
        +end
        +
        +
        + +
        +

        + + + - (Object) class_double(doubled_class) + + - (Object) class_double(doubled_class, name) + + - (Object) class_double(doubled_class, stubs) + + - (Object) class_double(doubled_class, name, stubs) + + + + + + +

        +
        + +

        Constructs a test double against a specific class. If the given class name +has been loaded, only class methods defined on the class are allowed to be +stubbed. In all other ways it behaves like a double.

        + + +
        +
        +
        + +

        Overloads:

        +
          + + +
        • + - (Object) class_double(doubled_class) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Module) + + + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) class_double(doubled_class, name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Module) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) class_double(doubled_class, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Module) + + + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) class_double(doubled_class, name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Module) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Returns:

        +
          + +
        • + + + + + + + +
          +

          ClassVerifyingDouble

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 80
        +
        +def class_double(doubled_class, *args)
        +  ref = ObjectReference.for(doubled_class)
        +  ExampleMethods.declare_verifying_double(ClassVerifyingDouble, ref, *args)
        +end
        +
        +
        + +
        +

        + + + - (Object) class_spy(doubled_class) + + - (Object) class_spy(doubled_class, name) + + - (Object) class_spy(doubled_class, stubs) + + - (Object) class_spy(doubled_class, name, stubs) + + + + + + +

        +
        + +

        Constructs a test double that is optimized for use with +have_received against a specific class. If the given class +name has been loaded, only class methods defined on the class are allowed +to be stubbed. With a normal double one has to stub methods in order to be +able to spy them. An class_spy automatically spies on all class methods to +which the class responds.

        + + +
        +
        +
        + +

        Overloads:

        +
          + + +
        • + - (Object) class_spy(doubled_class) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Module) + + + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) class_spy(doubled_class, name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) class_spy(doubled_class, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Module) + + + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) class_spy(doubled_class, name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Returns:

        +
          + +
        • + + + + + + + +
          +

          ClassVerifyingDouble

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +192
        +193
        +194
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 192
        +
        +def class_spy(*args)
        +  class_double(*args).as_null_object
        +end
        +
        +
        + +
        +

        + + + - (Double) double + + - (Double) double(name) + + - (Double) double(stubs) + + - (Double) double(name, stubs) + + + + + + +

        +
        + +

        Constructs an instance of :Mocks::Double +configured with an optional name, used for reporting in failure messages, +and an optional hash of message/return-value pairs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +book = double("book", :title => "The RSpec Book")
        +book.title #=> "The RSpec Book"
        +
        +card = double("card", :suit => "Spades", :rank => "A")
        +card.suit  #=> "Spades"
        +card.rank  #=> "A"
        + +
        + +

        Overloads:

        +
          + + + +
        • + - (Double) double(name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Double) double(stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Double) double(name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Double) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 35
        +
        +def double(*args)
        +  ExampleMethods.declare_double(Double, *args)
        +end
        +
        +
        + +
        +

        + + - (Object) expect + + + + + +

        +
        + +
        + Note: +
        +

        This method is usually provided by rspec-expectations. However, if you use +rspec-mocks without rspec-expectations, there's a definition of it that +is made available here. If you disable the :expect syntax this +method will be undefined.

        +
        +
        + + +

        Used to wrap an object in preparation for setting a mock expectation on it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(obj).to receive(:foo).with(5).and_return(:return_value)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 285
        +
        +
        +
        +
        + +
        +

        + + - (Object) expect_any_instance_of + + + + + +

        +
        + +
        + Note: +
        +

        If you disable the :expect syntax this method will be +undefined.

        +
        +
        + + +

        Used to wrap a class in preparation for setting a mock expectation on +instances of it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect_any_instance_of(MyClass).to receive(:foo)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 308
        +
        +
        +
        +
        + +
        +

        + + - (Object) have_received(method_name, &block) + + + + + +

        +
        + +

        Verifies that the given object received the expected message during the +course of the test. On a spy objects or as null object doubles this works +for any method, on other objects the method must have been stubbed +beforehand in order for messages to be verified.

        + +

        Stubbing and verifying messages received in this way implements the Test +Spy pattern.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +invitation = double('invitation', accept: true)
        +user.accept_invitation(invitation)
        +expect(invitation).to have_received(:accept)
        +
        +# You can also use most message expectations:
        +expect(invitation).to have_received(:accept).with(mailer).once
        + +
        +

        Parameters:

        +
          + +
        • + + method_name + + + (Symbol) + + + + — +
          +

          name of the method expected to have been called.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +281
        +282
        +283
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 281
        +
        +def have_received(method_name, &block)
        +  Matchers::HaveReceived.new(method_name, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) hide_const(constant_name) + + + + + +

        +
        + +

        Hides the named constant with the given value. The constant will be +undefined for the duration of the test.

        + +

        Like method stubs, the constant will be restored to its original value when +the example completes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +hide_const("MyClass") # => MyClass is now an undefined constant
        + +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +258
        +259
        +260
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 258
        +
        +def hide_const(constant_name)
        +  ConstantMutator.hide(constant_name)
        +end
        +
        +
        + +
        +

        + + + - (Object) instance_double(doubled_class) + + - (Object) instance_double(doubled_class, name) + + - (Object) instance_double(doubled_class, stubs) + + - (Object) instance_double(doubled_class, name, stubs) + + + + + + +

        +
        + +

        Constructs a test double against a specific class. If the given class name +has been loaded, only instance methods defined on the class are allowed to +be stubbed. In all other ways it behaves like a double.

        + + +
        +
        +
        + +

        Overloads:

        +
          + + +
        • + - (Object) instance_double(doubled_class) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) instance_double(doubled_class, name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) instance_double(doubled_class, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) instance_double(doubled_class, name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Returns:

        +
          + +
        • + + + + + + + +
          +

          InstanceVerifyingDouble

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 57
        +
        +def instance_double(doubled_class, *args)
        +  ref = ObjectReference.for(doubled_class)
        +  ExampleMethods.declare_verifying_double(InstanceVerifyingDouble, ref, *args)
        +end
        +
        +
        + +
        +

        + + + - (Object) instance_spy(doubled_class) + + - (Object) instance_spy(doubled_class, name) + + - (Object) instance_spy(doubled_class, stubs) + + - (Object) instance_spy(doubled_class, name, stubs) + + + + + + +

        +
        + +

        Constructs a test double that is optimized for use with +have_received against a specific class. If the given class +name has been loaded, only instance methods defined on the class are +allowed to be stubbed. With a normal double one has to stub methods in +order to be able to spy them. An instance_spy automatically spies on all +instance methods to which the class responds.

        + + +
        +
        +
        + +

        Overloads:

        +
          + + +
        • + - (Object) instance_spy(doubled_class) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) instance_spy(doubled_class, name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) instance_spy(doubled_class, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) instance_spy(doubled_class, name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + doubled_class + + + (String, Class) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Returns:

        +
          + +
        • + + + + + + + +
          +

          InstanceVerifyingDouble

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +145
        +146
        +147
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 145
        +
        +def instance_spy(*args)
        +  instance_double(*args).as_null_object
        +end
        +
        +
        + +
        +

        + + + - (Object) object_double(object_or_name) + + - (Object) object_double(object_or_name, name) + + - (Object) object_double(object_or_name, stubs) + + - (Object) object_double(object_or_name, name, stubs) + + + + + + +

        +
        + +

        Constructs a test double against a specific object. Only the methods the +object responds to are allowed to be stubbed. If a String argument is +provided, it is assumed to reference a constant object which is used for +verification. In all other ways it behaves like a double.

        + + +
        +
        +
        + +

        Overloads:

        +
          + + +
        • + - (Object) object_double(object_or_name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + object_or_name + + + (String, Object) + + + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) object_double(object_or_name, name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + object_or_name + + + (String, Object) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) object_double(object_or_name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + object_or_name + + + (String, Object) + + + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) object_double(object_or_name, name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + object_or_name + + + (String, Object) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Returns:

        +
          + +
        • + + + + + + + +
          +

          ObjectVerifyingDouble

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 103
        +
        +def object_double(object_or_name, *args)
        +  ref = ObjectReference.for(object_or_name, :allow_direct_object_refs)
        +  ExampleMethods.declare_verifying_double(ObjectVerifyingDouble, ref, *args)
        +end
        +
        +
        + +
        +

        + + + - (Object) object_spy(object_or_name) + + - (Object) object_spy(object_or_name, name) + + - (Object) object_spy(object_or_name, stubs) + + - (Object) object_spy(object_or_name, name, stubs) + + + + + + +

        +
        + +

        Constructs a test double that is optimized for use with +have_received against a specific object. Only instance methods +defined on the object are allowed to be stubbed. With a normal double one +has to stub methods in order to be able to spy them. An object_spy +automatically spies on all methods to which the object responds.

        + + +
        +
        +
        + +

        Overloads:

        +
          + + +
        • + - (Object) object_spy(object_or_name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + object_or_name + + + (String, Object) + + + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) object_spy(object_or_name, name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + object_or_name + + + (String, Class) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) object_spy(object_or_name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + object_or_name + + + (String, Object) + + + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Object) object_spy(object_or_name, name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + object_or_name + + + (String, Class) + + + +
          • + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Returns:

        +
          + +
        • + + + + + + + +
          +

          ObjectVerifyingDouble

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +168
        +169
        +170
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 168
        +
        +def object_spy(*args)
        +  object_double(*args).as_null_object
        +end
        +
        +
        + +
        +

        + + - (Object) receive + + + + + +

        +
        + +
        + Note: +
        +

        If you disable the :expect syntax this method will be +undefined.

        +
        +
        + + +

        Used to specify a message that you expect or allow an object to receive. +The object returned by receive supports the same fluent +interface that should_receive and stub have +always supported, allowing you to constrain the arguments or number of +times, and configure how the object should respond to the message.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(obj).to receive(:hello).with("world").exactly(3).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 328
        +
        +
        +
        +
        + +
        +

        + + + - (Object) receive_message_chain(method1, method2) + + - (Object) receive_message_chain("method1.method2") + + - (Object) receive_message_chain(method1, method_to_value_hash) + + + + + + +

        +
        + +
        + Note: +
        +

        If you disable the :expect syntax this method will be +undefined.

        +
        +
        + + +

        stubs/mocks a chain of messages on an object or test double.

        + +

        Warning:

        + +

        Chains can be arbitrarily long, which makes it quite painless to violate +the Law of Demeter in violent ways, so you should consider any use of +receive_message_chain a code smell. Even though not all code +smells indicate real problems (think fluent interfaces), +receive_message_chain still results in brittle examples. For +example, if you write allow(foo).to receive_message_chain(:bar, :baz +=> 37) in a spec and then the implementation calls +foo.baz.bar, the stub will not work.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +allow(double).to receive_message_chain("foo.bar") { :baz }
        +allow(double).to receive_message_chain(:foo, :bar => :baz)
        +allow(double).to receive_message_chain(:foo, :bar) { :baz }
        +
        +# Given any of ^^ these three forms ^^:
        +double.foo.bar # => :baz
        +
        +# Common use in Rails/ActiveRecord:
        +allow(Article).to receive_message_chain("recent.published") { [Article.new] }
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 355
        +
        +
        +
        +
        + +
        +

        + + - (Object) receive_messages + + + + + +

        +
        + +
        + Note: +
        +

        If you disable the :expect syntax this method will be +undefined.

        +
        +
        + + +

        Shorthand syntax used to setup message(s), and their return value(s), that +you expect or allow an object to receive. The method takes a hash of +messages and their respective return values. Unlike with +receive, you cannot apply further customizations using a block +or the fluent interface.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +allow(obj).to receive_messages(:speak => "Hello World")
        +allow(obj).to receive_messages(:speak => "Hello", :meow => "Meow")
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 341
        +
        +
        +
        +
        + +
        +

        + + + - (Double) spy + + - (Double) spy(name) + + - (Double) spy(stubs) + + - (Double) spy(name, stubs) + + + + + + +

        +
        + +

        Constructs a test double that is optimized for use with +have_received. With a normal double one has to stub methods in +order to be able to spy them. A spy automatically spies on all methods.

        + + +
        +
        +
        + +

        Overloads:

        +
          + + + +
        • + - (Double) spy(name) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Double) spy(stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + + +
        • + - (Double) spy(name, stubs) +
          +
          + + +
          +
          +
          +

          Parameters:

          +
            + +
          • + + name + + + (String/Symbol) + + + + — +
            +

            name or description to be used in failure messages

            +
            + +
          • + +
          • + + stubs + + + (Hash) + + + + — +
            +

            hash of message/return-value pairs

            +
            + +
          • + +
          + + +
          +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Double) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +121
        +122
        +123
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 121
        +
        +def spy(*args)
        +  double(*args).as_null_object
        +end
        +
        +
        + +
        +

        + + - (Object) stub_const(constant_name, value, options = {}) + + + + + +

        +
        + +

        Stubs the named constant with the given value. Like method stubs, the +constant will be restored to its original value (or lack of one, if it was +undefined) when the example completes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +stub_const("MyClass", Class.new) # => Replaces (or defines) MyClass with a new class object.
        +stub_const("SomeModel::PER_PAGE", 5) # => Sets SomeModel::PER_PAGE to 5.
        +
        +class CardDeck
        +  SUITS = [:Spades, :Diamonds, :Clubs, :Hearts]
        +  NUM_CARDS = 52
        +end
        +
        +stub_const("CardDeck", Class.new)
        +CardDeck::SUITS # => uninitialized constant error
        +CardDeck::NUM_CARDS # => uninitialized constant error
        +
        +stub_const("CardDeck", Class.new, :transfer_nested_constants => true)
        +CardDeck::SUITS # => our suits array
        +CardDeck::NUM_CARDS # => 52
        +
        +stub_const("CardDeck", Class.new, :transfer_nested_constants => [:SUITS])
        +CardDeck::SUITS # => our suits array
        +CardDeck::NUM_CARDS # => uninitialized constant error
        + +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        • + + value + + + (Object) + + + + — +
          +

          The value to make the constant refer to. When the example completes, the +constant will be restored to its prior state.

          +
          + +
        • + +
        • + + options + + + (Hash) + + + (defaults to: {}) + + + — +
          +

          Stubbing options.

          +
          + +
        • + +
        + + + + + + + + +

        Options Hash (options):

        +
          + +
        • + :transfer_nested_constants + (Boolean, Array<Symbol>) + + + + + —
          +

          Determines what nested constants, if any, will be transferred from the +original value of the constant to the new value of the constant. This only +works if both the original and new values are modules (or classes).

          +
          + +
        • + +
        + + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +
          +

          the stubbed value of the constant

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +242
        +243
        +244
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 242
        +
        +def stub_const(constant_name, value, options={})
        +  ConstantMutator.stub(constant_name, value, options)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html new file mode 100644 index 000000000..409894667 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::ExampleMethods::ExpectHost + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ExampleMethods::ExpectHost + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/example_methods.rb
        + +
        +
        + +

        Overview

        +
        + +

        This module exists to host the expect method for cases where +rspec-mocks is used w/o rspec-expectations.

        + + +
        +
        +
        + + +
        + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Matchers.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Matchers.html new file mode 100644 index 000000000..5d75b179a --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Matchers.html @@ -0,0 +1,118 @@ + + + + + + Module: RSpec::Mocks::Matchers + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Matchers + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks.rb,
        + lib/rspec/mocks/matchers/receive.rb,
        lib/rspec/mocks/matchers/have_received.rb,
        lib/rspec/mocks/matchers/receive_messages.rb,
        lib/rspec/mocks/matchers/receive_message_chain.rb,
        lib/rspec/mocks/matchers/expectation_customization.rb
        +
        + +
        +
        + +

        Overview

        +
        + +

        Namespace for mock-related matchers.

        + + +
        +
        +
        + + +
        + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/MessageExpectation.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/MessageExpectation.html new file mode 100644 index 000000000..646fb3a17 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/MessageExpectation.html @@ -0,0 +1,1883 @@ + + + + + + Class: RSpec::Mocks::MessageExpectation + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::MessageExpectation + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/message_expectation.rb
        + +
        +
        + +

        Overview

        +
        + +

        Represents an individual method stub or message expectation. The methods +defined here can be used to configure how it behaves. The methods return +self so that they can be chained together to form a fluent +interface.

        + + +
        +
        +
        + + +
        +

        Direct Known Subclasses

        +

        VerifyingMessageExpectation

        +
        + + + + + + + + +

        + Configuring Responses + (collapse) +

        + + + +

        + Constraining Receive Counts + (collapse) +

        + + + +

        + Other Constraints + (collapse) +

        + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (nil) and_call_original + + + + + +

        +
        + +
        + Note: +
        +

        This is only available on partial doubles.

        +
        +
        + + +

        Tells the object to delegate to the original unmodified method when it +receives the message.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(counter).to receive(:increment).and_call_original
        +original_count = counter.count
        +counter.increment
        +expect(counter.count).to eq(original_count + 1)
        + +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + + — +
          +

          No further chaining is supported after this.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +94
        +95
        +96
        +97
        +98
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 94
        +
        +def and_call_original
        +  and_wrap_original do |original, *args, &block|
        +    original.call(*args, &block)
        +  end
        +end
        +
        +
        + +
        +

        + + + - (nil) and_raise + + - (nil) and_raise(ExceptionClass) + + - (nil) and_raise(ExceptionClass, message) + + - (nil) and_raise(exception_instance) + + + + + + +

        +
        + +
        + Note: +
        +

        When you pass an exception class, the MessageExpectation will raise an +instance of it, creating it with exception and passing +message if specified. If the exception class initializer +requires more than one parameters, you must pass in an instance and not the +class, otherwise this method will raise an ArgumentError exception.

        +
        +
        + + +

        Tells the object to raise an exception when the message is received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        allow(car).to receive(:go).and_raise
        +allow(car).to receive(:go).and_raise(OutOfGas)
        +allow(car).to receive(:go).and_raise(OutOfGas, "At least 2 oz of gas needed to drive")
        +allow(car).to receive(:go).and_raise(OutOfGas.new(2, :oz))
        + +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + + — +
          +

          No further chaining is supported after this.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 144
        +
        +def and_raise(exception=RuntimeError, message=nil)
        +  if exception.respond_to?(:exception)
        +    exception = message ? exception.exception(message) : exception.exception
        +  end
        +
        +  self.terminal_implementation_action = Proc.new { raise exception }
        +  nil
        +end
        +
        +
        + +
        +

        + + + - (nil) and_return(value) + + - (nil) and_return(first_value, second_value) + + + + + + +

        +
        + +

        Tells the object to return a value when it receives the message. Given more +than one value, the first value is returned the first time the message is +received, the second value is returned the next time, etc, etc.

        + +

        If the message is received more times than there are values, the last value +is received for every subsequent call.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        allow(counter).to receive(:count).and_return(1)
        +counter.count # => 1
        +counter.count # => 1
        +
        +allow(counter).to receive(:count).and_return(1,2,3)
        +counter.count # => 1
        +counter.count # => 2
        +counter.count # => 3
        +counter.count # => 3
        +counter.count # => 3
        +# etc
        + +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + + — +
          +

          No further chaining is supported after this.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 67
        +
        +def and_return(first_value, *values)
        +  if negative?
        +    raise "`and_return` is not supported with negative message expectations"
        +  end
        +
        +  if block_given?
        +    raise ArgumentError, "Implementation blocks aren't supported with `and_return`"
        +  end
        +
        +  values.unshift(first_value)
        +  @expected_received_count = [@expected_received_count, values.size].max unless ignoring_args? || (@expected_received_count == 0 && @at_least)
        +  self.terminal_implementation_action = AndReturnImplementation.new(values)
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + + - (nil) and_throw(symbol) + + - (nil) and_throw(symbol, object) + + + + + + +

        +
        + +

        Tells the object to throw a symbol (with the object if that form is used) +when the message is received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        allow(car).to receive(:go).and_throw(:out_of_gas)
        +allow(car).to receive(:go).and_throw(:out_of_gas, :level => 0.1)
        + +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + + — +
          +

          No further chaining is supported after this.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +163
        +164
        +165
        +166
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 163
        +
        +def and_throw(*args)
        +  self.terminal_implementation_action = Proc.new { throw(*args) }
        +  nil
        +end
        +
        +
        + +
        +

        + + - (nil) and_wrap_original(&block) + + + + + +

        +
        + +
        + Note: +
        +

        This is only available on partial doubles.

        +
        +
        + + +

        Decorates the stubbed method with the supplied block. The original +unmodified method is passed to the block along with any method call +arguments so you can delegate to it, whilst still being able to change what +args are passed to it and/or change the return value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(api).to receive(:large_list).and_wrap_original do |original_method, *args, &block|
        +  original_method.call(*args, &block).first(10)
        +end
        + +
        + +

        Returns:

        +
          + +
        • + + + (nil) + + + + — +
          +

          No further chaining is supported after this.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 112
        +
        +def and_wrap_original(&block)
        +  if RSpec::Mocks::TestDouble === @method_double.object
        +    @error_generator.raise_only_valid_on_a_partial_double(:and_call_original)
        +  else
        +    warn_about_stub_override if implementation.inner_action
        +    @implementation = AndWrapOriginalImplementation.new(@method_double.original_method, block)
        +    @yield_receiver_to_implementation_block = false
        +  end
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) and_yield(*args) {|@eval_context = Object.new| ... } + + + + + +

        +
        + +

        Tells the object to yield one or more args to a block when the message is +received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        stream.stub(:open).and_yield(StringIO.new)
        + +
        + +

        Yields:

        +
          + +
        • + + + (@eval_context = Object.new) + + + +
        • + +
        +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +174
        +175
        +176
        +177
        +178
        +179
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 174
        +
        +def and_yield(*args, &block)
        +  yield @eval_context = Object.new if block
        +  @args_to_yield << args
        +  self.initial_implementation_action = AndYieldImplementation.new(@args_to_yield, @eval_context, @error_generator)
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) at_least(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received at least a specific number +of times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(dealer).to receive(:deal_card).at_least(9).times
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +202
        +203
        +204
        +205
        +206
        +207
        +208
        +209
        +210
        +211
        +212
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 202
        +
        +def at_least(n, &block)
        +  set_expected_received_count :at_least, n
        +
        +  if n == 0
        +    raise "at_least(0) has been removed, use allow(...).to receive(:message) instead"
        +  end
        +
        +  self.inner_implementation_action = block
        +
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) at_most(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received at most a specific number of +times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(dealer).to receive(:deal_card).at_most(10).times
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +220
        +221
        +222
        +223
        +224
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 220
        +
        +def at_most(n, &block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :at_most, n
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) exactly(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received a specific number of times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(dealer).to receive(:deal_card).exactly(10).times
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +190
        +191
        +192
        +193
        +194
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 190
        +
        +def exactly(n, &block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, n
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) never + + + + + +

        +
        + +

        Expect a message not to be received at all.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(car).to receive(:stop).never
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +243
        +244
        +245
        +246
        +247
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 243
        +
        +def never
        +  ErrorGenerator.raise_double_negation_error("expect(obj)") if negative?
        +  @expected_received_count = 0
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) once(&block) + + + + + +

        +
        + +

        Expect a message to be received exactly one time.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(car).to receive(:go).once
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +254
        +255
        +256
        +257
        +258
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 254
        +
        +def once(&block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, 1
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) ordered(&block) + + + + + +

        +
        + +

        Expect messages to be received in a specific order.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(api).to receive(:prepare).ordered
        +expect(api).to receive(:run).ordered
        +expect(api).to receive(:finish).ordered
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +327
        +328
        +329
        +330
        +331
        +332
        +333
        +334
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 327
        +
        +def ordered(&block)
        +  self.inner_implementation_action = block
        +  additional_expected_calls.times do
        +    @order_group.register(self)
        +  end
        +  @ordered = true
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) thrice(&block) + + + + + +

        +
        + +

        Expect a message to be received exactly three times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(car).to receive(:go).thrice
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +276
        +277
        +278
        +279
        +280
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 276
        +
        +def thrice(&block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, 3
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) times(&block) + + + + + +

        +
        + +

        Syntactic sugar for exactly, at_least and +at_most

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(dealer).to receive(:deal_card).exactly(10).times
        +expect(dealer).to receive(:deal_card).at_least(10).times
        +expect(dealer).to receive(:deal_card).at_most(10).times
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +233
        +234
        +235
        +236
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 233
        +
        +def times(&block)
        +  self.inner_implementation_action = block
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) twice(&block) + + + + + +

        +
        + +

        Expect a message to be received exactly two times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(car).to receive(:go).twice
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +265
        +266
        +267
        +268
        +269
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 265
        +
        +def twice(&block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, 2
        +  self
        +end
        +
        +
        + +
        +

        + + - (MessageExpecation) with(*args, &block) + + + + + +

        +
        + +

        Constrains a stub or message expectation to invocations with specific +arguments.

        + +

        With a stub, if the message might be received with other args as well, you +should stub a default value first, and then stub or mock the same message +using with to constrain to specific arguments.

        + +

        A message expectation will fail if the message is received with different +arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        allow(cart).to receive(:add) { :failure }
        +allow(cart).to receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
        +cart.add(Book.new(:isbn => 1234567890))
        +# => :failure
        +cart.add(Book.new(:isbn => 1934356379))
        +# => :success
        +
        +expect(cart).to receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
        +cart.add(Book.new(:isbn => 1234567890))
        +# => failed expectation
        +cart.add(Book.new(:isbn => 1934356379))
        +# => passes
        + +
        + +

        Returns:

        +
          + +
        • + + + (MessageExpecation) + + + + — +
          +

          self, to support further chaining.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +309
        +310
        +311
        +312
        +313
        +314
        +315
        +316
        +317
        +318
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 309
        +
        +def with(*args, &block)
        +  if args.empty?
        +    raise ArgumentError,
        +          "`with` must have at least one argument. Use `no_args` matcher to set the expectation of receiving no arguments."
        +  end
        +
        +  self.inner_implementation_action = block
        +  @argument_list_matcher = ArgumentListMatcher.new(*args)
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Syntax.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Syntax.html new file mode 100644 index 000000000..de277e1e7 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Syntax.html @@ -0,0 +1,929 @@ + + + + + + Module: RSpec::Mocks::Syntax + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Syntax + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        + +

        Provides methods for enabling and disabling the available syntaxes provided +by rspec-mocks.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) default_should_syntax_host + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Determines where the methods like should_receive, and +stub are added.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +181
        +182
        +183
        +184
        +185
        +186
        +187
        +188
        +189
        +190
        +191
        +192
        +193
        +194
        +195
        +196
        +197
        +198
        +199
        +200
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 181
        +
        +def self.default_should_syntax_host
        +  # JRuby 1.7.4 introduces a regression whereby `defined?(::BasicObject) => nil`
        +  # yet `BasicObject` still exists and patching onto ::Object breaks things
        +  # e.g. SimpleDelegator expectations won't work
        +  #
        +  # See: https://github.com/jruby/jruby/issues/814
        +  if defined?(JRUBY_VERSION) && JRUBY_VERSION == '1.7.4' && RUBY_VERSION.to_f > 1.8
        +    return ::BasicObject
        +  end
        +
        +  # On 1.8.7, Object.ancestors.last == Kernel but
        +  # things blow up if we include `RSpec::Mocks::Methods`
        +  # into Kernel...not sure why.
        +  return Object unless defined?(::BasicObject)
        +
        +  # MacRuby has BasicObject but it's not the root class.
        +  return Object unless Object.ancestors.last == ::BasicObject
        +
        +  ::BasicObject
        +end
        +
        +
        + +
        +

        + + + (Object) disable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Disables the expect syntax (expect(dbl).to receive, +allow(dbl).to receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +150
        +151
        +152
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +165
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 150
        +
        +def self.disable_expect(syntax_host=::RSpec::Mocks::ExampleMethods)
        +  return unless expect_enabled?(syntax_host)
        +
        +  syntax_host.class_exec do
        +    undef receive
        +    undef receive_messages
        +    undef receive_message_chain
        +    undef allow
        +    undef expect_any_instance_of
        +    undef allow_any_instance_of
        +  end
        +
        +  RSpec::Mocks::ExampleMethods::ExpectHost.class_exec do
        +    undef expect
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) disable_should(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Disables the should syntax (dbl.stub, +dbl.should_receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 89
        +
        +def self.disable_should(syntax_host=default_should_syntax_host)
        +  return unless should_enabled?(syntax_host)
        +
        +  syntax_host.class_exec do
        +    undef should_receive
        +    undef should_not_receive
        +    undef stub
        +    undef unstub
        +    undef stub_chain
        +    undef as_null_object
        +    undef null_object?
        +    undef received_message?
        +  end
        +
        +  Class.class_exec do
        +    undef any_instance
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) enable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Enables the expect syntax (expect(dbl).to receive, +allow(dbl).to receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 110
        +
        +def self.enable_expect(syntax_host=::RSpec::Mocks::ExampleMethods)
        +  return if expect_enabled?(syntax_host)
        +
        +  syntax_host.class_exec do
        +    def receive(method_name, &block)
        +      Matchers::Receive.new(method_name, block)
        +    end
        +
        +    def receive_messages(message_return_value_hash)
        +      matcher = Matchers::ReceiveMessages.new(message_return_value_hash)
        +      matcher.warn_about_block if block_given?
        +      matcher
        +    end
        +
        +    def receive_message_chain(*messages, &block)
        +      Matchers::ReceiveMessageChain.new(messages, &block)
        +    end
        +
        +    def allow(target)
        +      AllowanceTarget.new(target)
        +    end
        +
        +    def expect_any_instance_of(klass)
        +      AnyInstanceExpectationTarget.new(klass)
        +    end
        +
        +    def allow_any_instance_of(klass)
        +      AnyInstanceAllowanceTarget.new(klass)
        +    end
        +  end
        +
        +  RSpec::Mocks::ExampleMethods::ExpectHost.class_exec do
        +    def expect(target)
        +      ExpectationTarget.new(target)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) enable_should(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Enables the should syntax (dbl.stub, +dbl.should_receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 26
        +
        +def self.enable_should(syntax_host=default_should_syntax_host)
        +  @warn_about_should = false if syntax_host == default_should_syntax_host
        +  return if should_enabled?(syntax_host)
        +
        +  syntax_host.class_exec do
        +    def should_receive(message, opts={}, &block)
        +      ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__)
        +      ::RSpec::Mocks.expect_message(self, message, opts, &block)
        +    end
        +
        +    def should_not_receive(message, &block)
        +      ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__)
        +      ::RSpec::Mocks.expect_message(self, message, {}, &block).never
        +    end
        +
        +    def stub(message_or_hash, opts={}, &block)
        +      ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__)
        +      if ::Hash === message_or_hash
        +        message_or_hash.each { |message, value| stub(message).and_return value }
        +      else
        +        ::RSpec::Mocks.allow_message(self, message_or_hash, opts, &block)
        +      end
        +    end
        +
        +    def unstub(message)
        +      ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__, "`allow(...).to_receive(...).and_call_original` or explicitly enable `:should`")
        +      ::RSpec::Mocks.space.proxy_for(self).remove_stub(message)
        +    end
        +
        +    def stub_chain(*chain, &blk)
        +      ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__)
        +      ::RSpec::Mocks::StubChain.stub_chain_on(self, *chain, &blk)
        +    end
        +
        +    def as_null_object
        +      ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__)
        +      @_null_object = true
        +      ::RSpec::Mocks.space.proxy_for(self).as_null_object
        +    end
        +
        +    def null_object?
        +      ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__)
        +      defined?(@_null_object)
        +    end
        +
        +    def received_message?(message, *args, &block)
        +      ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__)
        +      ::RSpec::Mocks.space.proxy_for(self).received_message?(message, *args, &block)
        +    end
        +
        +    unless Class.respond_to? :any_instance
        +      Class.class_exec do
        +        def any_instance
        +          ::RSpec::Mocks::Syntax.warn_unless_should_configured(__method__)
        +          ::RSpec::Mocks.space.any_instance_proxy_for(self)
        +        end
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Boolean) expect_enabled?(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Indicates whether or not the expect syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +175
        +176
        +177
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 175
        +
        +def self.expect_enabled?(syntax_host=::RSpec::Mocks::ExampleMethods)
        +  syntax_host.method_defined?(:allow)
        +end
        +
        +
        + +
        +

        + + + (Boolean) should_enabled?(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Indicates whether or not the should syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 169
        +
        +def self.should_enabled?(syntax_host=default_should_syntax_host)
        +  syntax_host.method_defined?(:should_receive)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/TestDouble.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/TestDouble.html new file mode 100644 index 000000000..b28defb15 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/TestDouble.html @@ -0,0 +1,613 @@ + + + + + + Module: RSpec::Mocks::TestDouble + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::TestDouble + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Double
        + + + +
        Defined in:
        +
        lib/rspec/mocks/test_double.rb
        + +
        +
        + +

        Overview

        +
        + +

        Implements the methods needed for a pure test double. RSpec::Mocks::Double +includes this module, and it is provided for cases where you want a pure +test double without subclassing RSpec::Mocks::Double.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) ==(other) + + + + + + + + + + + + + +
          +

          This allows for comparing the mock to other objects that proxy such as +ActiveRecords belongs_to proxy objects.

          +
          + +
        • + + +
        • + + + - (Object) as_null_object + + + + + + + + + + + + + +
          +

          Tells the object to respond to all messages.

          +
          + +
        • + + +
        • + + + - (Object) freeze + + + + + + + + + + + + + +
          +

          Override for default freeze implementation to prevent freezing of test +doubles.

          +
          + +
        • + + +
        • + + + - (Object) initialize(name = nil, stubs = {}) + + + + + + + + + + + + + +
          +

          Creates a new test double with a name (that will be used in +error messages only).

          +
          + +
        • + + +
        • + + + - (Boolean) null_object? + + + + + + + + + + + + + +
          +

          Returns true if this object has received as_null_object.

          +
          + +
        • + + +
        + + +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(message, *args, &block) (private) + + + + + +

        +
        + + +
        +
        +
        + +

        Raises:

        +
          + +
        • + + + (NoMethodError) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 73
        +
        +def method_missing(message, *args, &block)
        +  proxy = __mock_proxy
        +  proxy.record_message_received(message, *args, &block)
        +
        +  if proxy.null_object?
        +    case message
        +    when :to_int        then return 0
        +    when :to_a, :to_ary then return nil
        +    when :to_str        then return to_s
        +    else return self
        +    end
        +  end
        +
        +  # Defined private and protected methods will still trigger `method_missing`
        +  # when called publicly. We want ruby's method visibility error to get raised,
        +  # so we simply delegate to `super` in that case.
        +  # ...well, we would delegate to `super`, but there's a JRuby
        +  # bug, so we raise our own visibility error instead:
        +  # https://github.com/jruby/jruby/issues/1398
        +  visibility = proxy.visibility_for(message)
        +  if visibility == :private || visibility == :protected
        +    ErrorGenerator.new(self, @name).raise_non_public_error(
        +      message, visibility
        +    )
        +  end
        +
        +  # Required wrapping doubles in an Array on Ruby 1.9.2
        +  raise NoMethodError if [:to_a, :to_ary].include? message
        +  proxy.raise_unexpected_message_error(message, *args)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(other) + + + + + +

        +
        + +

        This allows for comparing the mock to other objects that proxy such as +ActiveRecords belongs_to proxy objects. By making the other object run the +comparison, we're sure the call gets delegated to the proxy target.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 36
        +
        +def ==(other)
        +  other == __mock_proxy
        +end
        +
        +
        + +
        +

        + + - (Object) as_null_object + + + + + +

        +
        + +

        Tells the object to respond to all messages. If specific stub values are +declared, they'll work as expected. If not, the receiver is returned.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 23
        +
        +def as_null_object
        +  __mock_proxy.as_null_object
        +end
        +
        +
        + +
        +

        + + - (Object) freeze + + + + + +

        +
        + +

        Override for default freeze implementation to prevent freezing of test +doubles.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 67
        +
        +def freeze
        +  RSpec.warn_with("WARNING: you attempted to freeze a test double. This is explicitly a no-op as freezing doubles can lead to undesired behaviour when resetting tests.")
        +end
        +
        +
        + +
        +

        + + - (Object) initialize(name = nil, stubs = {}) + + + + + +

        +
        + +

        Creates a new test double with a name (that will be used in +error messages only)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 9
        +
        +def initialize(name=nil, stubs={})
        +  @__expired = false
        +  if Hash === name && stubs.empty?
        +    stubs = name
        +    @name = nil
        +  else
        +    @name = name
        +  end
        +  assign_stubs(stubs)
        +end
        +
        +
        + +
        +

        + + - (Boolean) null_object? + + + + + +

        +
        + +

        Returns true if this object has received as_null_object

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 28
        +
        +def null_object?
        +  __mock_proxy.null_object?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/VerifyingMessageExpectation.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/VerifyingMessageExpectation.html new file mode 100644 index 000000000..e54887e21 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/VerifyingMessageExpectation.html @@ -0,0 +1,335 @@ + + + + + + Class: RSpec::Mocks::VerifyingMessageExpectation + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::VerifyingMessageExpectation + + + Private +

        + +
        + +
        Inherits:
        +
        + MessageExpectation + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/verifying_message_expecation.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        A message expectation that knows about the real implementation of the +message being expected, so that it can verify that any expectations have +the valid arguments.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) method_reference + + + + + + + + + + + + + + private + + +
          +

          A level of indirection is used here rather than just passing in the method +itself, since method look up is expensive and we only want to do it if +actually needed.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from MessageExpectation

        +

        #and_call_original, #and_raise, #and_return, #and_throw, #and_wrap_original, #and_yield, #at_least, #at_most, #exactly, #never, #once, #ordered, #thrice, #times, #twice

        + + + + + + +
        +

        Constructor Details

        + +
        +

        + + - (VerifyingMessageExpectation) initialize(*args) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of VerifyingMessageExpectation

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/mocks/verifying_message_expecation.rb', line 20
        +
        +def initialize(*args)
        +  super
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) method_reference + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        A level of indirection is used here rather than just passing in the method +itself, since method look up is expensive and we only want to do it if +actually needed.

        + +

        Conceptually the method reference makes more sense as a constructor +argument since it should be immutable, but it is significantly more +straight forward to build the object in pieces so for now it stays as an +accessor.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/mocks/verifying_message_expecation.rb', line 18
        +
        +def method_reference
        +  @method_reference
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Version.html b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Version.html new file mode 100644 index 000000000..41ff05b79 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/RSpec/Mocks/Version.html @@ -0,0 +1,139 @@ + + + + + + Module: RSpec::Mocks::Version + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Version + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/version.rb
        + +
        +
        + +

        Overview

        +
        + +

        Version information for RSpec mocks.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + +
        + +
        STRING = +
        +
        + +

        Version of RSpec mocks currently in use in SemVer format.

        + + +
        +
        +
        + + +
        +
        +
        '3.2.0.pre'
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/_index.html b/source/documentation/3.2/rspec-mocks/_index.html new file mode 100644 index 000000000..2f7433522 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/_index.html @@ -0,0 +1,306 @@ + + + + + + Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.4

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + + + + + + + + + + +
          +
        • D
        • +
            + +
          • + Double + + (RSpec::Mocks) + +
          • + +
          +
        + + + + + + + + +
          +
        • R
        • + +
        + + +
        + + +
          +
        • S
        • +
            + +
          • + Syntax + + (RSpec::Mocks) + +
          • + +
          +
        + + +
          +
        • T
        • + +
        + + + + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/class_list.html b/source/documentation/3.2/rspec-mocks/class_list.html new file mode 100644 index 000000000..0ecba5f3f --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/class_list.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-mocks/file.Changelog.html b/source/documentation/3.2/rspec-mocks/file.Changelog.html new file mode 100644 index 000000000..235bf6e69 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/file.Changelog.html @@ -0,0 +1,1338 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +
        +

        3.2.0 Development

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Treat any_args as an arg splat, allowing it to match an +arbitrary number of args at any point in an arg list. (Myron Marston, +#786)

          +
        • +

          Print diffs when arguments in mock expectations are mismatched. (Sam +Phippen, #751)

          +
        • +

          Support names for verified doubles (instance_double, +instance_spy, class_double, +class_spy, object_double, +object_spy). (Cezary Baginski, #826)

          +
        + +

        Bug Fixes:

        +
        • +

          Provide a clear error when users wrongly combine no_args with +additional arguments (e.g. expect().to receive().with(no_args, +1)). (Myron Marston, #786)

          +
        • +

          Provide a clear error when users wrongly use any_args multiple +times in the same argument list (e.g. expect().to +receive().with(any_args, 1, any_args). (Myron Marston, #786)

          +
        • +

          Prevent the error generator from using user object #description methods. +See #685. +(Sam Phippen, #751)

          +
        • +

          Make verified doubles declared as +(instance|class)_double(SomeConst) work properly when +SomeConst has previously been stubbed. +(instance|class)_double("SomeClass") already worked +properly. (Myron Marston, #824)

          +
        • +

          Add a matcher description for receive, +receive_messages and receive_message_chain. +(Myron Marston, #828)

          +
        • +

          Validate invocation args for null object verified doubles. (Myron Marston, +#829)

          +
        • +

          Fix RSpec::Mocks::Constant.original when called with an +invalid constant to return an object indicating the constant name is +invalid, rather than blowing up. (Myron Marston, #833)

          +
        + +

        3.1.3 / 2014-10-08

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Correct received messages count when used with have_received +matcher. (Jon Rowe, #793)

          +
        • +

          Provide a clear error message when you use +allow_any_instance_of(...) or +expect_any_instance_of(...) with the +have_received matcher (they are not intended to be used +together and previously caused an odd internal failure in rspec-mocks). +(Jon Rowe, #799).

          +
        • +

          Fix verified double with verification so that it applies to +method stubs. (Myron Marston, #790)

          +
        + +

        3.1.2 / 2014-09-26

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Provide a clear error message when you use allow(...) with the +have_received matcher (they are not intended to be used +together and previously caused an odd internal failure in rspec-mocks). +(Jon Rowe, #788).

          +
        + +

        3.1.1 / 2014-09-18

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Prevent included modules being detected as prepended modules on Ruby 2.0 +when using any_instance_of(...). (Tony Novak, #781)

          +
        + +

        3.1.0 / 2014-09-04

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Add spying methods (spy, ìnstance_spy, +class_spy and object_spy) which create doubles +as null objects for use with spying in testing. (Sam Phippen, #671)

          +
        • +

          have_received matcher will raise “does not implement” errors +correctly when used with verifying doubles and partial doubles. (Xavier +Shay, #722)

          +
        • +

          Allow matchers to be used in place of keyword arguments in +with expectations. (Xavier Shay, #726)

          +
        • +

          Add thrice modifier to message expectation interface as a +synonym for exactly(3).times. (Dennis Taylor, #753)

          +
        • +

          Add more thrice synonyms e.g. .at_least(:thrice), +.at_most(:thrice), receive(...).thrice and +have_received(...).thrice. (Jon Rowe, #754)

          +
        • +

          Add and_wrap_original modifier for partial doubles to mutate +the response from a method. (Jon Rowe, #762)

          +
        + +

        Bug Fixes:

        +
        • +

          Remove any_number_of_times from any_instance +recorders that were erroneously causing mention of the method in +documentation. (Jon Rowe, #760)

          +
        • +

          Prevent included modules being detected as prepended modules on Ruby 2.0. +(Eugene Kenny, #771)

          +
        + +

        3.0.4 / 2014-08-14

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Restore kind_of(x) to match using arg.kind_of?(x) +(like RSpec 2) rather than x === arg. (Jon Rowe, #750)

          +
        + +

        3.0.3 / 2014-07-21

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          have_received matcher will raise “does not implement” errors +correctly when used with verifying doubles and partial doubles. (Xavier +Shay, #722)

          +
        • +

          Make double.as_null_object.dup and +double.as_null_object.clone make the copies be null objects. +(Myron Marston, #732)

          +
        • +

          Don't inadvertently define BasicObject in 1.8.7. (Chris +Griego, #739)

          +
        + +

        3.0.2 / 2014-06-19

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix edge case that triggered “can't add a new key into hash during +iteration” during mock verification. (Sam Phippen, Myron Marston, #711)

          +
        • +

          Fix verifying doubles so that when they accidentally leak into another +example, they provide the same clear error message that normal doubles do. +(Myron Marston, #718)

          +
        • +

          Make ordered work with exact receive counts. (Sam Phippen, +#713)

          +
        + +

        3.0.1 / 2014-06-07

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix receive_message_chain(...) so that it supports +with just like stub_chain did. (Jon Rowe, #697)

          +
        • +

          Fix regression in expect_any_instance_of so that it expects +the message on any instance rather than on every +instance. (Myron Marston, #699)

          +
        + +

        3.0.0 / 2014-06-01

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix module prepend detection to work properly on ruby 2.0 for a case where +a module is extended onto itself. (Myron Marston)

          +
        • +

          Fix transfer_nested_constants option so that transferred +constants get properly reset at the end of the example. (Myron Marston)

          +
        • +

          Fix config.transfer_nested_constants = true so that you +don't erroneously get errors when stubbing a constant that is not a +module or a class. (Myron Marston)

          +
        • +

          Fix regression that caused double(:class => SomeClass) to +later trigger infinite recursion. (Myron Marston)

          +
        • +

          Fix bug in have_received(...).with(...).ordered where it was +not taking the args into account when checking the order. (Myron Marston)

          +
        • +

          Fix bug in have_received(...).ordered where it was wrongly +considering stubs when checking the order. (Myron Marston)

          +
        • +

          Message expectation matchers now show descriptions from argument matchers +when their expectations aren't met. (Jon Rowe)

          +
        • +

          Display warning when encountering TypeError during instance +method staging on 2.0.0-p195, suffers from bugs.ruby-lang.org/issues/8686 +too. (Cezar Halmagean).

          +
        + +

        3.0.0.rc1 / 2014-05-18

        + +

        Full +Changelog

        + +

        Breaking Changes for 3.0.0:

        +
        • +

          Remove RSpec::Mocks::TestDouble.extend_onto. (Myron Marston)

          +
        • +

          Remove RSpec::Mocks::ConstantStubber. (Jon Rowe)

          +
        • +

          Make monkey-patch of Marshal to support dumping of stubbed objects opt-in. +(Xavier Shay)

          +
        + +

        Enhancements:

        +
        • +

          Instead of crashing when cleaning up stub methods on a frozen object, it +now issues a warning explaining that it's impossible to clean up the +stubs. (Justin Coyne and Sam Phippen)

          +
        • +

          Add meaningful descriptions to anything, +duck_type and instance_of argument matchers. +(Jon Rowe)

          +
        + +

        Bug Fixes:

        +
        • +

          Fix regression introduced in 3.0.0.beta2 that caused +double.as_null_object.to_str to return the double rather than +a string. (Myron Marston)

          +
        • +

          Fix bug in expect(dbl).to receive_message_chain(:foo, :bar) +where it was not setting an expectation for the last message in the chain. +(Jonathan del Strother)

          +
        • +

          Allow verifying partial doubles to have private methods stubbed. (Xavier +Shay)

          +
        • +

          Fix bug with allowing/expecting messages on Class objects which have had +their singleton class prepended to. (Jon Rowe)

          +
        • +

          Fix an issue with 1.8.7 not running implementation blocks on partial +doubles. (Maurício Linhares)

          +
        • +

          Prevent StackLevelTooDeep errors when stubbing an +any_instance method that's accessed in +inspect by providing our own inspect output. (Jon Rowe)

          +
        • +

          Fix bug in any_instance logic that did not allow you to mock +or stub private methods if verify_partial_doubles was +configured. (Oren Dobzinski)

          +
        • +

          Include useful error message when trying to observe an unimplemented method +on an any instance. (Xavier Shay)

          +
        • +

          Fix and_call_original to work properly when multiple classes +in an inheritance hierarchy have been stubbed with the same method. (Myron +Marston)

          +
        • +

          Fix any_instance so that it updates existing instances that +have already been stubbed. (Myron Marston)

          +
        • +

          Fix verified doubles so that their class name is included in failure +messages. (Myron Marston)

          +
        • +

          Fix expect_any_instance_of so that when the message is +received on an individual instance that has been directly stubbed, it +still satisfies the expectation. (Sam Phippen, Myron Marston)

          +
        • +

          Explicitly disallow using any_instance to mock or stub a +method that is defined on a module prepended onto the class. This +triggered SystemStackError before and is very hard to support +so we are not supporting it at this time. (Myron Marston)

          +
        + +

        3.0.0.beta2 / 2014-02-17

        + +

        Full +Changelog

        + +

        Breaking Changes for 3.0.0:

        +
        • +

          Rename RSpec::Mocks::Mock to +RSpec::Mocks::Double. (Myron Marston)

          +
        • +

          Change how to integrate rspec-mocks in other test frameworks. You now need +to include RSpec::Mocks::ExampleMethods in your test context. +(Myron Marston)

          +
        • +

          Prevent RSpec mocks' doubles and partial doubles from being used +outside of the per-test lifecycle (e.g. from a before(:all) +hook). (Sam Phippen)

          +
        • +

          Remove the host argument of RSpec::Mocks.setup. +Instead RSpec::Mocks::ExampleMethods should be included +directly in the scope where RSpec's mocking capabilities are used. +(Sam Phippen)

          +
        • +

          Make test doubles raise errors if you attempt to use them after they get +reset, to help surface issues when you accidentally retain references to +test doubles and attempt to reuse them in another example. (Myron Marston)

          +
        • +

          Remove support for and_return { value } and +and_return without arguments. (Yuji Nakayama)

          +
        + +

        Enhancements:

        +
        • +

          Add receive_message_chain which provides the functionality of +the old stub_chain for the new allow/expect syntax. Use it +like so: allow(...).to receive_message_chain(:foo, :bar, +:bazz). (Sam Phippen).

          +
        • +

          Change argument matchers to use === as their primary matching +protocol, since their semantics mirror that of a case or rescue statement +(which uses === for matching). (Myron Marston)

          +
        • +

          Add RSpec::Mocks.with_temporary_scope, which allows you to +create temporary rspec-mocks scopes in arbitrary places (such as a +before(:all) hook). (Myron Marston)

          +
        • +

          Support keyword arguments when checking arity with verifying doubles. +(Xavier Shay)

          +
        + +

        Bug Fixes:

        +
        • +

          Fix regression in 3.0.0.beta1 that caused +double("string_name" => :value) to stop working. +(Xavier Shay)

          +
        • +

          Fix the way rspec-mocks and rspec-core interact so that if users define a +let with the same name as one of the methods from +RSpec::Mocks::ArgumentMatchers, the user's +let takes precedence. (Michi Huber, Myron Marston)

          +
        • +

          Fix verified doubles so that their methods match the visibility (public, +protected or private) of the interface they verify against. (Myron +Marston)

          +
        • +

          Fix verified null object doubles so that they do not wrongly report that +they respond to anything. They only respond to methods available on the +interface they verify against. (Myron Marston)

          +
        • +

          Fix deprecation warning for use of old :should syntax w/o +explicit config so that it no longer is silenced by an extension gem such +as rspec-rails when it calls +config.add_stub_and_should_receive_to. (Sam Phippen)

          +
        • +

          Fix expect syntax so that it does not wrongly emit a +“You're overriding a previous implementation for this stub” warning +when you are not actually doing that. (Myron Marston)

          +
        • +

          Fix any_instance.unstub when used on sub classes for whom the +super class has had any_instance.stub invoked on. (Jon Rowe)

          +
        • +

          Fix regression in +stub_chain/receive_message_chain that caused it +to raise an ArgumentError when passing args to the stubbed +methods. (Sam Phippen)

          +
        • +

          Correct stub of undefined parent modules all the way down when stubbing a +nested constant. (Xavier Shay)

          +
        • +

          Raise VerifyingDoubleNotDefinedError when a constant is not +defined for a verifying class double. (Maurício Linhares)

          +
        • +

          Remove Double#to_str, which caused confusing raise +some_double behavior. (Maurício Linhares)

          +
        + +

        3.0.0.beta1 / 2013-11-07

        + +

        Full +Changelog

        + +

        Breaking Changes for 3.0.0:

        +
        • +

          Raise an explicit error if should_not_receive(...).and_return +is used. (Sam Phippen)

          +
        • +

          Remove 1.8.6 workarounds. (Jon Rowe)

          +
        • +

          Remove stub! and unstub!. (Sam Phippen)

          +
        • +

          Remove mock(name, methods) and stub(name, +methods), leaving double(name, methods) for creating +test doubles. (Sam Phippen, Michi Huber)

          +
        • +

          Remove any_number_of_times since +should_receive(:msg).any_number_of_times is really a stub in +a mock's clothing. (Sam Phippen)

          +
        • +

          Remove support for re-using the same null-object test double in multiple +examples. Test doubles are designed to only live for one example. (Myron +Marston)

          +
        • +

          Make at_least(0) raise an error. (Sam Phippen)

          +
        • +

          Remove support for require 'spec/mocks' which had been +kept in place for backwards compatibility with RSpec 1. (Myron Marston)

          +
        • +

          Blocks provided to with are always used as implementation. +(Xavier Shay)

          +
        • +

          The config option (added in 2.99) to yield the receiver to +any_instance implementation blocks now defaults to “on”. (Sam +Phippen)

          +
        + +

        Enhancements:

        +
        • +

          Allow the have_received matcher to use a block to set further +expectations on arguments. (Tim Cowlishaw)

          +
        • +

          Provide instance_double and class_double to +create verifying doubles, ported from rspec-fire. (Xavier +Shay)

          +
        • +

          as_null_object on a verifying double only responds to defined +methods. (Xavier Shay)

          +
        • +

          Provide object_double to create verified doubles of specific +object instances. (Xavier Shay)

          +
        • +

          Provide verify_partial_doubles configuration that provides +object_double like verification behaviour on partial doubles. +(Xavier Shay)

          +
        • +

          Improved performance of double creation, particularly those with many +attributes. (Xavier Shay)

          +
        • +

          Default value of transfer_nested_constants option for constant +stubbing can be configured. (Xavier Shay)

          +
        • +

          Messages can be allowed or expected on in bulk via +receive_messages(:message => :value). (Jon Rowe)

          +
        • +

          allow(Klass.any_instance) and +expect(Klass.any_instance) now print a warning. This is +usually a mistake, and users usually want +allow_any_instance_of or expect_any_instance_of +instead. (Sam Phippen)

          +
        • +

          instance_double and class_double raise +ArgumentError if the underlying module is loaded and the +arity of the method being invoked does not match the arity of the method +as it is actually implemented. (Andy Lindeman)

          +
        • +

          Spies can now check their invocation ordering is correct. (Jon Rowe)

          +
        + +

        Deprecations:

        +
        • +

          Using the old :should syntax without explicitly configuring it +is deprecated. It will continue to work but will emit a deprecation +warning in RSpec 3 if you do not explicitly enable it. (Sam Phippen)

          +
        + +

        Bug Fixes:

        +
        • +

          Fix and_call_original to handle a complex edge case involving +singleton class ancestors. (Marc-André Lafortune, Myron Marston)

          +
        • +

          When generating an error message for unexpected arguments, use +#inspect rather than #description if +#description returns nil or +'' so that you still get a useful message. (Nick +DeLuca)

          +
        + +

        2.99.2 / 2014-07-21

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Warn about upcoming change to #=== matching and +DateTime#=== behaviour. (Jon Rowe, #735)

          +
        + +

        2.99.1 / 2014-06-12

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix bug that caused errors at the end of each example when a +double.as_null_object had been frozen. (Yuji Nakayama, #698)

          +
        + +

        Deprecations:

        +
        • +

          Deprecate freezing a test double. (Yuji Nakayama, #698)

          +
        + +

        2.99.0 / 2014-06-01

        + +

        Full +Changelog

        + +

        No changes. Just taking it out of pre-release.

        + +

        2.99.0.rc1 / 2014-05-18

        + +

        Full +Changelog

        + +

        Deprecations:

        +
        • +

          Deprecate RSpec::Mocks::TestDouble.extend_onto. (Myron +Marston)

          +
        • +

          Deprecate RSpec::Mocks::ConstantStubber. (Jon Rowe)

          +
        • +

          Deprecate Marshal.dump monkey-patch without opt-in. (Xavier +Shay)

          +
        + +

        2.99.0.beta2 / 2014-02-17

        + +

        Full +Changelog

        + +

        Deprecations:

        +
        • +

          Deprecate RSpec::Mocks::Mock in favor of +RSpec::Mocks::Double. (Myron Marston)

          +
        • +

          Deprecate the host argument of +RSpec::Mocks.setup. Instead +RSpec::Mocks::ExampleMethods should be included directly in +the scope where RSpec's mocking capabilities are used. (Sam Phippen)

          +
        • +

          Deprecate using any of rspec-mocks' features outside the per-test +lifecycle (e.g. from a before(:all) hook). (Myron Marston)

          +
        • +

          Deprecate re-using a test double in another example. (Myron Marston)

          +
        • +

          Deprecate and_return { value } and and_return +without arguments. (Yuji Nakayama)

          +
        + +

        2.99.0.beta1 / 2013-11-07

        + +

        Full +Changelog

        + +

        Deprecations

        +
        • +

          Expecting to use lambdas or other strong arity implementations for stub +methods with mis-matched arity is deprecated and support for them will be +removed in 3.0. Either provide the right amount of arguments or use a weak +arity implementation (methods with splats or procs). (Jon Rowe)

          +
        • +

          Using the same test double instance in multiple examples is deprecated. +Test doubles are only meant to live for one example. The mocks and stubs +have always been reset between examples; however, in 2.x the +as_null_object state was not reset and some users relied on +this to have a null object double that is used for many examples. This +behavior will be removed in 3.0. (Myron Marston)

          +
        • +

          Print a detailed warning when an any_instance implementation +block is used when the new +yield_receiver_to_any_instance_implementation_blocks config +option is not explicitly set, as RSpec 3.0 will default to enabling this +new feature. (Sam Phippen)

          +
        + +

        Enhancements:

        +
        • +

          Add a config option to yield the receiver to any_instance +implementation blocks. (Sam Phippen)

          +
        + +

        2.14.6 / 2014-02-20

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Ensure any_instance method stubs and expectations are torn +down regardless of expectation failures. (Sam Phippen)

          +
        + +

        2.14.5 / 2014-02-01

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix regression that caused block implementations to not receive all args +on 1.8.7 if the block also receives a block, due to Proc#arity reporting +1 no matter how many args the block receives if it receives a +block, too. (Myron Marston)

          +
        + +

        2.14.4 / 2013-10-15

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix issue where unstubing methods on “any instances” would not remove +stubs on existing instances (Jon Rowe)

          +
        • +

          Fix issue with receive(:message) do … end precedence preventing the usage +of modifications (and_return etc) (Jon Rowe)

          +
        + +

        2.14.3 / 2013-08-08

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix stubbing some instance methods for classes whose hierarchy includes a +prepended Module (Bradley Schaefer)

          +
        + +

        2.14.2 / 2013-07-30

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix as_null_object doubles so that they return +nil from to_ary (Jon Rowe).

          +
        • +

          Fix regression in 2.14 that made stub! (with an implicit +receiver) return a test double rather than stub a method (Myron Marston).

          +
        + +

        2.14.1 / 2013-07-07

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Restore double.as_null_object behavior from 2.13 and earlier: +a double's nullness persisted between examples in earlier examples. +While this is not an intended use case (test doubles are meant to live for +only one example), we don't want to break behavior users rely on in a +minor relase. This will be deprecated in 2.99 and removed in 3.0. (Myron +Marston)

          +
        + +

        2.14.0 / 2013-07-06

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Document test spies in the readme. (Adarsh Pandit)

          +
        • +

          Add an array_including matcher. (Sam Phippen)

          +
        • +

          Add a syntax-agnostic API for mocking or stubbing a method. This is +intended for use by libraries such as rspec-rails that need to mock or +stub a method, and work regardless of the syntax the user has configured +(Paul Annesley, Myron Marston and Sam Phippen).

          +
        + +

        Bug Fixes:

        +
        • +

          Fix double so that it sets up passed stubs correctly +regardless of the configured syntax (Paul Annesley).

          +
        • +

          Allow a block implementation to be used in combination with +and_yield, and_raise, and_return or +and_throw. This got fixed in 2.13.1 but failed to get merged +into master for the 2.14.0.rc1 release (Myron Marston).

          +
        • +

          Marshal.dump does not unnecessarily duplicate objects when +rspec-mocks has not been fully initialized. This could cause errors when +using spork or similar preloading gems (Andy Lindeman).

          +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Refactor internals so that the mock proxy methods and state are held +outside of the mocked object rather than inside it. This paves the way for +future syntax enhancements and removes the need for some hacky work +arounds for any_instance dup'ing and YAML +serialization, among other things. Note that the code now relies upon +__id__ returning a unique, consistent value for any object +you want to mock or stub (Myron Marston).

          +
        • +

          Add support for test spies. This allows you to verify a message was +received afterwards using the have_received matcher. Note +that you must first stub the method or use a null double. (Joe Ferris and +Joël Quenneville)

          +
        • +

          Make at_least and at_most style receive +expectations print that they were expecting at least or at most some +number of calls, rather than just the number of calls given in the +expectation (Sam Phippen)

          +
        • +

          Make with style receive expectations print the args they were +expecting, and the args that they got (Sam Phippen)

          +
        • +

          Fix some warnings seen under ruby 2.0.0p0 (Sam Phippen).

          +
        • +

          Add a new :expect syntax for message expectations (Myron +Marston and Sam Phippen).

          +
        + +

        Bug fixes

        +
        • +

          Fix any_instance so that a frozen object can be +dup'd when methods have been stubbed on that type using +any_instance (Jon Rowe).

          +
        • +

          Fix and_call_original so that it properly raises an +ArgumentError when the wrong number of args are passed (Jon +Rowe).

          +
        • +

          Fix double on 1.9.2 so you can wrap them in an Array using +Array(my_double) (Jon Rowe).

          +
        • +

          Fix stub_const and hide_const to handle constants +that redefine send (Sam Phippen).

          +
        • +

          Fix Marshal.dump extension so that it correctly handles nil. +(Luke Imhoff, Jon Rowe)

          +
        • +

          Fix isolation of allow_message_expectations_on_nil (Jon Rowe)

          +
        • +

          Use inspect to format actual arguments on expectations in failure messages +(#280, Ben Langfeld)

          +
        • +

          Protect against improperly initialised test doubles (#293) (Joseph +Shraibman and Jon Rowe)

          +
        + +

        Deprecations

        +
        • +

          Deprecate stub and mock as aliases for +double. double is the best term for creating a +test double, and it reduces confusion to have only one term (Michi Huber).

          +
        • +

          Deprecate stub! and unstub! in favor of +stub and unstub (Jon Rowe).

          +
        • +

          Deprecate at_least(0).times and +any_number_of_times (Michi Huber).

          +
        + +

        2.13.1 / 2013-04-06

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Allow a block implementation to be used in combination with +and_yield, and_raise, and_return or +and_throw (Myron Marston).

          +
        + +

        2.13.0 / 2013-02-23

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix bug that caused weird behavior when a method that had previously been +stubbed with multiple return values (e.g. +obj.stub(:foo).and_return(1, 2)) was later mocked with a +single return value (e.g. +obj.should_receive(:foo).once.and_return(1)). (Myron Marston)

          +
        • +

          Fix bug related to a mock expectation for a method that already had +multiple stubs with different with constraints. Previously, +the first stub was used, even though it may not have matched the passed +args. The fix defers this decision until the message is received so that +the proper stub response can be chosen based on the passed arguments +(Myron Marston).

          +
        • +

          Do not call nil? extra times on a mocked object, in case +nil? itself is expected a set number of times (Myron +Marston).

          +
        • +

          Fix missing_default_stub_error message so array args are +handled properly (Myron Marston).

          +
        • +

          Explicitly disallow any_instance.unstub! (Ryan Jones).

          +
        • +

          Fix any_instance stubbing so that it works with +Delegator subclasses (Myron Marston).

          +
        • +

          Fix and_call_original so that it works with +Delegator subclasses (Myron Marston).

          +
        • +

          Fix any_instance.should_not_receive when +any_instance.should_receive is used on the same class in the +same example. Previously it would wrongly report a failure even when the +message was not received (Myron Marston).

          +
        + +

        2.12.2 / 2013-01-27

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix and_call_original to work properly for methods defined on +a module extended onto an object instance (Myron Marston).

          +
        • +

          Fix stub_const with an undefined constnat name to work +properly with constant strings that are prefixed with :: – +and edge case I missed in the bug fix in the 2.12.1 release (Myron +Marston).

          +
        • +

          Ensure method visibility on a partial mock is restored after reseting +method stubs, even on a singleton module (created via extend +self) when the method visibility differs between the instance and +singleton versions (Andy Lindeman).

          +
        + +

        2.12.1 / 2012-12-21

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix any_instance to support and_call_original. +(Myron Marston)

          +
        • +

          Properly restore stubbed aliased methods on rubies that report the +incorrect owner (Myron Marston and Andy Lindeman).

          +
        • +

          Fix hide_const and stub_const with a defined +constnat name to work properly with constant strings that are prefixed +with :: (Myron Marston).

          +
        + +

        2.12.0 / 2012-11-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          and_raise can accept an exception class and message, more +closely matching Kernel#raise (e.g., +foo.stub(:bar).and_raise(RuntimeError, "message")) +(Bas Vodde)

          +
        • +

          Add and_call_original, which will delegate the message to the +original method (Myron Marston).

          +
        + +

        Deprecations:

        +
        • +

          Add deprecation warning when using and_return with +should_not_receive (Neha Kumari)

          +
        + +

        2.11.3 / 2012-09-19

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix :transfer_nested_constants option of +stub_const so that it doesn't blow up when there are +inherited constants. (Myron Marston)

          +
        • +

          any_instance stubs can be used on classes that override +Object#method. (Andy Lindeman)

          +
        • +

          Methods stubbed with any_instance are unstubbed after the test +finishes. (Andy Lindeman)

          +
        • +

          Fix confusing error message when calling a mocked class method an extra +time with the wrong arguments (Myron Marston).

          +
        + +

        2.11.2 / 2012-08-11

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Don't modify dup on classes that don't support +dup (David Chelimsky)

          +
        • +

          Fix any_instance so that it works properly with methods +defined on a superclass. (Daniel Eguzkiza)

          +
        • +

          Fix stub_const so that it works properly for nested constants +that share a name with a top-level constant (e.g. “MyGem::Hash”). (Myron +Marston)

          +
        + +

        2.11.1 / 2012-07-09

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix should_receive so that when it is called on an +as_null_object double with no implementation, and there is a +previous explicit stub for the same method, the explicit stub remains +(rather than being overriden with the null object +implementation–return self). (Myron Marston)

          +
        + +

        2.11.0 / 2012-07-07

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Expose ArgumentListMatcher as a formal API

          +
          • +

            supports use by 3rd party mock frameworks like Surrogate

            +
          +
        • +

          Add stub_const API to stub constants for the duration of an +example (Myron Marston).

          +
        + +

        Bug fixes

        +
        • +

          Fix regression of edge case behavior. double.should_receive(:foo) { a +} was causing a NoMethodError when +double.stub(:foo).and_return(a, b) had been setup before +(Myron Marston).

          +
        • +

          Infinite loop generated by using any_instance and +dup. (Sidu Ponnappa @kaiwren)

          +
        • +

          double.should_receive(:foo).at_least(:once).and_return(a) +always returns a even if :foo is already stubbed.

          +
        • +

          Prevent infinite loop when interpolating a null double into a string as an +integer ("%i" % double.as_null_object). (Myron +Marston)

          +
        • +

          Fix should_receive so that null object behavior (e.g. +returning self) is preserved if no implementation is given (Myron +Marston).

          +
        • +

          Fix and_raise so that it raises RuntimeError +rather than Exception by default, just like ruby does. +(Andrew Marshall)

          +
        + +

        2.10.1 / 2012-05-05

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fix regression of edge case behavior (github.com/rspec/rspec-mocks/issues/132)

          +
          • +

            fixed failure of +object.should_receive(:message).at_least(0).times.and_return +value

            +
          • +

            fixed failure of object.should_not_receive(:message).and_return +value

            +
          +
        + +

        2.10.0 / 2012-05-03

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fail fast when an exactly or at_most expectation +is exceeded

          +
        + +

        2.9.0 / 2012-03-17

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Support order constraints across objects (preethiramdev)

          +
        + +

        Bug fixes

        +
        • +

          Allow a as_null_object to be passed to with

          +
        • +

          Pass proc to block passed to stub (Aubrey Rhodes)

          +
        • +

          Initialize child message expectation args to match any args (#109 - +preethiramdev)

          +
        + +

        2.8.0 / 2012-01-04

        + +

        Full +Changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc2 / 2011-12-19

        + +

        Full +Changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc1 / 2011-11-06

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Eliminate Ruby warnings (Matijs van Zuijlen)

          +
        + +

        2.7.0 / 2011-10-16

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Use __send__ rather than send (alextk)

          +
        • +

          Add support for any_instance.stub_chain (Sidu Ponnappa)

          +
        • +

          Add support for any_instance argument matching based on +with (Sidu Ponnappa and Andy Lindeman)

          +
        + +

        Changes

        +
        • +

          Check for failure_message_for_should or +failure_message instead of description to detect +a matcher (Tibor Claassen)

          +
        + +

        Bug fixes

        +
        • +

          pass a hash to any_instance.stub. (Justin Ko)

          +
        • +

          allow to_ary to be called without raising +NoMethodError (Mikhail Dieterle)

          +
        • +

          any_instance properly restores private methods (Sidu Ponnappa)

          +
        + +

        2.6.0 / 2011-05-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Add support for any_instance.stub and +any_instance.should_receive (Sidu Ponnappa and Andy Lindeman)

          +
        + +

        Bug fixes

        +
        • +

          fix bug in which multiple chains with shared messages ending in hashes +failed to return the correct value

          +
        + +

        2.5.0 / 2011-02-05

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          message expectation counts now work in combination with a stub (Damian +Nurzynski)

          +
        • +

          fix failure message when message received with incorrect args (Josep M. +Bach)

          +
        + +

        2.4.0 / 2011-01-02

        + +

        Full +Changelog

        + +

        No functional changes in this release, which was made to align with the +rspec-core-2.4.0 release.

        + +

        2.3.0 / 2010-12-12

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix our Marshal extension so that it does not interfere with objects that +have their own @mock_proxy instance variable. (Myron Marston)

          +
        + +

        2.2.0 / 2010-11-28

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Added “rspec/mocks/standalone” for exploring the rspec-mocks in irb.

          +
        + +

        Bug fix

        +
        • +

          Eliminate warning on splat args without parens (Gioele Barabucci)

          +
        • +

          Fix bug where +obj.should_receive(:foo).with(stub.as_null_object) would pass +with a false positive.

          +
        + +

        2.1.0 / 2010-11-07

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix serialization of stubbed object (Josep M Bach)

          +
        + +

        2.0.0 / 2010-10-10

        + +

        Full +Changelog

        + +

        2.0.0.rc / 2010-10-05

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          support passing a block to an expectation block (Nicolas Braem)

          +
          • +

            obj.should_receive(:msg) {|&block| ... }

            +
          +
        + +

        Bug fixes

        +
        • +

          Fix YAML serialization of stub (Myron Marston)

          +
        • +

          Fix rdoc rake task (Hans de Graaff)

          +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fixed regression that broke obj.stub_chain(:a, :b => :c)

          +
        • +

          fixed regression that broke obj.stub_chain(:a, :b) { :c }

          +
        • +

          respond_to? always returns true when using +as_null_object

          +
        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/file.License.html b/source/documentation/3.2/rspec-mocks/file.License.html new file mode 100644 index 000000000..1249668c1 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2012 David Chelimsky, Myron Marston
        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/file.README.html b/source/documentation/3.2/rspec-mocks/file.README.html new file mode 100644 index 000000000..401056496 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/file.README.html @@ -0,0 +1,482 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +
        +

        RSpec Mocks

        + +

        rspec-mocks is a test-double framework for rspec with support for method +stubs, fakes, and message expectations on generated test-doubles and real +objects alike.

        + +

        Install

        + +
        gem install rspec       # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-mocks # for rspec-mocks only
        + +

        Test Doubles

        + +

        A test double is an object that stands in for another object in your system +during a code example. Use the double method, passing in an +optional identifier, to create one:

        + +
        book = double("book")
        +
        + +

        Most of the time you will want some confidence that your doubles resemble +an existing object in your system. Verifying doubles are provided for this +purpose. If the existing object is available, they will prevent you from +adding stubs and expectations for methods that do not exist or that have an +invalid number of parameters.

        + +
        book = instance_double("Book", :pages => 250)
        +
        + +

        Verifying doubles have some clever tricks to enable you to both test in +isolation without your dependencies loaded while still being able to +validate them against real objects. More detail is available in their +documentation.

        + +

        Verifying doubles can also accept custom identifiers, just like double(), +e.g.:

        + +
        books = []
        +books << instance_double("Book", :rspec_book, :pages => 250)
        +books << instance_double("Book", "(Untitled)", :pages => 5000)
        +
        +puts books.inspect # with names, it's clearer which were actually added
        +
        + +

        Method Stubs

        + +

        A method stub is an implementation that returns a pre-determined value. +Method stubs can be declared on test doubles or real objects using the same +syntax. rspec-mocks supports 3 forms for declaring method stubs:

        + +
        allow(book).to receive(:title) { "The RSpec Book" }
        +allow(book).to receive(:title).and_return("The RSpec Book")
        +allow(book).to receive_messages(
        +    :title => "The RSpec Book", 
        +    :subtitle => "Behaviour-Driven Development with RSpec, Cucumber, and Friends")
        +
        + +

        You can also use this shortcut, which creates a test double and declares a +method stub in one statement:

        + +
        book = double("book", :title => "The RSpec Book")
        +
        + +

        The first argument is a name, which is used for documentation and appears +in failure messages. If you don't care about the name, you can leave it +out, making the combined instantiation/stub declaration very terse:

        + +
        double(:foo => 'bar')
        +
        + +

        This is particularly nice when providing a list of test doubles to a method +that iterates through them:

        + +
        order.calculate_total_price(double(:price => 1.99), double(:price => 2.99))
        +
        + +

        Consecutive return values

        + +

        When a stub might be invoked more than once, you can provide additional +arguments to and_return. The invocations cycle through the +list. The last value is returned for any subsequent invocations:

        + +
        allow(die).to receive(:roll).and_return(1, 2, 3)
        +die.roll # => 1
        +die.roll # => 2
        +die.roll # => 3
        +die.roll # => 3
        +die.roll # => 3
        +
        + +

        To return an array in a single invocation, declare an array:

        + +
        allow(team).to receive(:players).and_return([double(:name => "David")])
        +
        + +

        Message Expectations

        + +

        A message expectation is an expectation that the test double will receive a +message some time before the example ends. If the message is received, the +expectation is satisfied. If not, the example fails.

        + +
        validator = double("validator")
        +expect(validator).to receive(:validate) { "02134" }
        +zipcode = Zipcode.new("02134", validator)
        +zipcode.valid?
        +
        + +

        Test Spies

        + +

        Verifies the given object received the expected message during the course +of the test. For a message to be verified, the given object must be setup +to spy on it, either by having it explicitly stubbed or by being a null +object double (e.g. double(...).as_null_object). Convenience +methods are provided to easily create null object doubles for this purpose:

        + +
        spy("invitation") # => same as `double("invitation").as_null_object`
        +instance_spy("Invitation") # => same as `instance_double("Invitation").as_null_object`
        +class_spy("Invitation") # => same as `class_double("Invitation").as_null_object`
        +object_spy("Invitation") # => same as `object_double("Invitation").as_null_object`
        +
        + +

        Stubbing and verifying messages received in this way implements the Test +Spy pattern.

        + +
        invitation = spy('invitation')
        +
        +user.accept_invitation(invitation)
        +
        +expect(invitation).to have_received(:accept)
        +
        +# You can also use other common message expectations. For example:
        +expect(invitation).to have_received(:accept).with(mailer)
        +expect(invitation).to have_received(:accept).twice
        +expect(invitation).to_not have_received(:accept).with(mailer)
        +
        +# One can specify a return value on the spy the same way one would a double.
        +invitation = spy('invitation', :accept => true)
        +expect(invitation).to have_received(:accept).with(mailer)
        +expect(invitation.accept).to eq(true)
        +
        + +

        Nomenclature

        + +

        Mock Objects and Test Stubs

        + +

        The names Mock Object and Test Stub suggest specialized Test Doubles. i.e. +a Test Stub is a Test Double that only supports method stubs, and a Mock +Object is a Test Double that supports message expectations and method +stubs.

        + +

        There is a lot of overlapping nomenclature here, and there are many +variations of these patterns (fakes, spies, etc). Keep in mind that most of +the time we're talking about method-level concepts that are variations +of method stubs and message expectations, and we're applying to them to +one generic kind of object: a Test Double.

        + +

        Test-Specific Extension

        + +

        a.k.a. Partial Double, a Test-Specific Extension is an extension of a real +object in a system that is instrumented with test-double like behaviour in +the context of a test. This technique is very common in Ruby because we +often see class objects acting as global namespaces for methods. For +example, in Rails:

        + +
        person = double("person")
        +allow(Person).to receive(:find) { person }
        +
        + +

        In this case we're instrumenting Person to return the person object +we've defined whenever it receives the find message. We +can also set a message expectation so that the example fails if +find is not called:

        + +
        person = double("person")
        +expect(Person).to receive(:find) { person }
        +
        + +

        RSpec replaces the method we're stubbing or mocking with its own +test-double-like method. At the end of the example, RSpec verifies any +message expectations, and then restores the original methods.

        + +

        Expecting Arguments

        + +
        expect(double).to receive(:msg).with(*args)
        +expect(double).to_not receive(:msg).with(*args)
        +
        + +

        You can set multiple expectations for the same message if you need to:

        + +
        expect(double).to receive(:msg).with("A", 1, 3)
        +expect(double).to receive(:msg).with("B", 2, 4)
        +
        + +

        Argument Matchers

        + +

        Arguments that are passed to with are compared with actual +arguments received using ==. In cases in which you want to specify things +about the arguments rather than the arguments themselves, you can use any +of the matchers that ship with rspec-expectations. They don't all make +syntactic sense (they were primarily designed for use with +RSpec::Expectations), but you are free to create your own custom +RSpec::Matchers.

        + +

        rspec-mocks also adds some keyword Symbols that you can use to specify +certain kinds of arguments:

        + +
        expect(double).to receive(:msg).with(no_args)
        +expect(double).to receive(:msg).with(any_args)
        +expect(double).to receive(:msg).with(1, any_args) # any args acts like an arg splat and can go anywhere
        +expect(double).to receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can be any kind of Numeric
        +expect(double).to receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
        +expect(double).to receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
        +expect(double).to receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
        +expect(double).to receive(:msg).with(1, duck_type(:abs, :div), "b") #2nd argument can be object that responds to #abs and #div
        +expect(double).to receive(:msg).with(hash_including(:a => 5)) # first arg is a hash with a: 5 as one of the key-values
        +expect(double).to receive(:msg).with(array_including(5)) # first arg is an array with 5 as one of the key-values
        +expect(double).to receive(:msg).with(hash_excluding(:a => 5)) # first arg is a hash without a: 5 as one of the key-values
        +
        + +

        Receive Counts

        + +
        expect(double).to receive(:msg).once
        +expect(double).to receive(:msg).twice
        +expect(double).to receive(:msg).exactly(n).times
        +expect(double).to receive(:msg).at_least(:once)
        +expect(double).to receive(:msg).at_least(:twice)
        +expect(double).to receive(:msg).at_least(n).times
        +expect(double).to receive(:msg).at_most(:once)
        +expect(double).to receive(:msg).at_most(:twice)
        +expect(double).to receive(:msg).at_most(n).times
        +
        + +

        Ordering

        + +
        expect(double).to receive(:msg).ordered
        +expect(double).to receive(:other_msg).ordered
        +  # This will fail if the messages are received out of order
        +
        + +

        This can include the same message with different arguments:

        + +
        expect(double).to receive(:msg).with("A", 1, 3).ordered
        +expect(double).to receive(:msg).with("B", 2, 4).ordered
        +
        + +

        Setting Responses

        + +

        Whether you are setting a message expectation or a method stub, you can +tell the object precisely how to respond. The most generic way is to pass a +block to receive:

        + +
        expect(double).to receive(:msg) { value }
        +
        + +

        When the double receives the msg message, it evaluates the +block and returns the result.

        + +
        expect(double).to receive(:msg).and_return(value)
        +expect(double).to receive(:msg).exactly(3).times.and_return(value1, value2, value3)
        +  # returns value1 the first time, value2 the second, etc
        +expect(double).to receive(:msg).and_raise(error)
        +  # error can be an instantiated object or a class
        +  # if it is a class, it must be instantiable with no args
        +expect(double).to receive(:msg).and_throw(:msg)
        +expect(double).to receive(:msg).and_yield(values, to, yield)
        +expect(double).to receive(:msg).and_yield(values, to, yield).and_yield(some, other, values, this, time)
        +  # for methods that yield to a block multiple times
        +
        + +

        Any of these responses can be applied to a stub as well

        + +
        allow(double).to receive(:msg).and_return(value)
        +allow(double).to receive(:msg).and_return(value1, value2, value3)
        +allow(double).to receive(:msg).and_raise(error)
        +allow(double).to receive(:msg).and_throw(:msg)
        +allow(double).to receive(:msg).and_yield(values, to, yield)
        +allow(double).to receive(:msg).and_yield(values, to, yield).and_yield(some, other, values, this, time)
        +
        + +

        Arbitrary Handling

        + +

        Once in a while you'll find that the available expectations don't +solve the particular problem you are trying to solve. Imagine that you +expect the message to come with an Array argument that has a specific +length, but you don't care what is in it. You could do this:

        + +
        expect(double).to receive(:msg) do |arg|
        +  expect(arg.size).to eq 7
        +end
        +
        + +

        If the method being stubbed itself takes a block, and you need to yield to +it in some special way, you can use this:

        + +
        expect(double).to receive(:msg) do |&arg|
        +  begin
        +    arg.call
        +  ensure
        +    # cleanup
        +  end
        +end
        +
        + +

        Delegating to the Original Implementation

        + +

        When working with a partial mock object, you may occasionally want to set a +message expecation without interfering with how the object responds to the +message. You can use and_call_original to achieve this:

        + +
        expect(Person).to receive(:find).and_call_original
        +Person.find # => executes the original find method and returns the result
        +
        + +

        Combining Expectation Details

        + +

        Combining the message name with specific arguments, receive counts and +responses you can get quite a bit of detail in your expectations:

        + +
        expect(double).to receive(:<<).with("illegal value").once.and_raise(ArgumentError)
        +
        + +

        While this is a good thing when you really need it, you probably don't +really need it! Take care to specify only the things that matter to the +behavior of your code.

        + +

        Stubbing and Hiding Constants

        + +

        See the mutating +constants README for info on this feature.

        + +

        Use before(:example), not before(:context)

        + +

        Stubs in before(:context) are not supported. The reason is +that all stubs and mocks get cleared out after each example, so any stub +that is set in before(:context) would work in the first +example that happens to run in that group, but not for any others.

        + +

        Instead of before(:context), use +before(:example).

        + +

        Settings mocks or stubs on any instance of a class

        + +

        rspec-mocks provides two methods, allow_any_instance_of and +expect_any_instance_of, that will allow you to stub or mock +any instance of a class. They are used in place of allow or +expect:

        + +
        allow_any_instance_of(Widget).to receive(:name).and_return("Wibble")
        +expect_any_instance_of(Widget).to receive(:name).and_return("Wobble")
        +
        + +

        These methods add the appropriate stub or expectation to all instances of +Widget.

        + +

        This feature is sometimes useful when working with legacy code, though in +general we discourage its use for a number of reasons:

        +
        • +

          The rspec-mocks API is designed for individual object +instances, but this feature operates on entire classes of objects. As a +result there are some sematically confusing edge cases. For example in +expect_any_instance_of(Widget).to receive(:name).twice it +isn't clear whether each specific instance is expected to receive +name twice, or if two receives total are expected. (It's +the former.)

          +
        • +

          Using this feature is often a design smell. It may be that your test is +trying to do too much or that the object under test is too complex.

          +
        • +

          It is the most complicated feature of rspec-mocks, and has +historically received the most bug reports. (None of the core team +actively use it, which doesn't help.)

          +
        + +

        Further Reading

        + +

        There are many different viewpoints about the meaning of mocks and stubs. +If you are interested in learning more, here is some recommended reading:

        + + +

        Also see

        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/file_list.html b/source/documentation/3.2/rspec-mocks/file_list.html new file mode 100644 index 000000000..ac9df6c7e --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/file_list.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-mocks/frames.html b/source/documentation/3.2/rspec-mocks/frames.html new file mode 100644 index 000000000..43d89f7b9 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.4 + + + + diff --git a/source/documentation/3.2/rspec-mocks/index.html b/source/documentation/3.2/rspec-mocks/index.html new file mode 100644 index 000000000..0064fed3d --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/index.html @@ -0,0 +1,482 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +
        +

        RSpec Mocks

        + +

        rspec-mocks is a test-double framework for rspec with support for method +stubs, fakes, and message expectations on generated test-doubles and real +objects alike.

        + +

        Install

        + +
        gem install rspec       # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-mocks # for rspec-mocks only
        + +

        Test Doubles

        + +

        A test double is an object that stands in for another object in your system +during a code example. Use the double method, passing in an +optional identifier, to create one:

        + +
        book = double("book")
        +
        + +

        Most of the time you will want some confidence that your doubles resemble +an existing object in your system. Verifying doubles are provided for this +purpose. If the existing object is available, they will prevent you from +adding stubs and expectations for methods that do not exist or that have an +invalid number of parameters.

        + +
        book = instance_double("Book", :pages => 250)
        +
        + +

        Verifying doubles have some clever tricks to enable you to both test in +isolation without your dependencies loaded while still being able to +validate them against real objects. More detail is available in their +documentation.

        + +

        Verifying doubles can also accept custom identifiers, just like double(), +e.g.:

        + +
        books = []
        +books << instance_double("Book", :rspec_book, :pages => 250)
        +books << instance_double("Book", "(Untitled)", :pages => 5000)
        +
        +puts books.inspect # with names, it's clearer which were actually added
        +
        + +

        Method Stubs

        + +

        A method stub is an implementation that returns a pre-determined value. +Method stubs can be declared on test doubles or real objects using the same +syntax. rspec-mocks supports 3 forms for declaring method stubs:

        + +
        allow(book).to receive(:title) { "The RSpec Book" }
        +allow(book).to receive(:title).and_return("The RSpec Book")
        +allow(book).to receive_messages(
        +    :title => "The RSpec Book", 
        +    :subtitle => "Behaviour-Driven Development with RSpec, Cucumber, and Friends")
        +
        + +

        You can also use this shortcut, which creates a test double and declares a +method stub in one statement:

        + +
        book = double("book", :title => "The RSpec Book")
        +
        + +

        The first argument is a name, which is used for documentation and appears +in failure messages. If you don't care about the name, you can leave it +out, making the combined instantiation/stub declaration very terse:

        + +
        double(:foo => 'bar')
        +
        + +

        This is particularly nice when providing a list of test doubles to a method +that iterates through them:

        + +
        order.calculate_total_price(double(:price => 1.99), double(:price => 2.99))
        +
        + +

        Consecutive return values

        + +

        When a stub might be invoked more than once, you can provide additional +arguments to and_return. The invocations cycle through the +list. The last value is returned for any subsequent invocations:

        + +
        allow(die).to receive(:roll).and_return(1, 2, 3)
        +die.roll # => 1
        +die.roll # => 2
        +die.roll # => 3
        +die.roll # => 3
        +die.roll # => 3
        +
        + +

        To return an array in a single invocation, declare an array:

        + +
        allow(team).to receive(:players).and_return([double(:name => "David")])
        +
        + +

        Message Expectations

        + +

        A message expectation is an expectation that the test double will receive a +message some time before the example ends. If the message is received, the +expectation is satisfied. If not, the example fails.

        + +
        validator = double("validator")
        +expect(validator).to receive(:validate) { "02134" }
        +zipcode = Zipcode.new("02134", validator)
        +zipcode.valid?
        +
        + +

        Test Spies

        + +

        Verifies the given object received the expected message during the course +of the test. For a message to be verified, the given object must be setup +to spy on it, either by having it explicitly stubbed or by being a null +object double (e.g. double(...).as_null_object). Convenience +methods are provided to easily create null object doubles for this purpose:

        + +
        spy("invitation") # => same as `double("invitation").as_null_object`
        +instance_spy("Invitation") # => same as `instance_double("Invitation").as_null_object`
        +class_spy("Invitation") # => same as `class_double("Invitation").as_null_object`
        +object_spy("Invitation") # => same as `object_double("Invitation").as_null_object`
        +
        + +

        Stubbing and verifying messages received in this way implements the Test +Spy pattern.

        + +
        invitation = spy('invitation')
        +
        +user.accept_invitation(invitation)
        +
        +expect(invitation).to have_received(:accept)
        +
        +# You can also use other common message expectations. For example:
        +expect(invitation).to have_received(:accept).with(mailer)
        +expect(invitation).to have_received(:accept).twice
        +expect(invitation).to_not have_received(:accept).with(mailer)
        +
        +# One can specify a return value on the spy the same way one would a double.
        +invitation = spy('invitation', :accept => true)
        +expect(invitation).to have_received(:accept).with(mailer)
        +expect(invitation.accept).to eq(true)
        +
        + +

        Nomenclature

        + +

        Mock Objects and Test Stubs

        + +

        The names Mock Object and Test Stub suggest specialized Test Doubles. i.e. +a Test Stub is a Test Double that only supports method stubs, and a Mock +Object is a Test Double that supports message expectations and method +stubs.

        + +

        There is a lot of overlapping nomenclature here, and there are many +variations of these patterns (fakes, spies, etc). Keep in mind that most of +the time we're talking about method-level concepts that are variations +of method stubs and message expectations, and we're applying to them to +one generic kind of object: a Test Double.

        + +

        Test-Specific Extension

        + +

        a.k.a. Partial Double, a Test-Specific Extension is an extension of a real +object in a system that is instrumented with test-double like behaviour in +the context of a test. This technique is very common in Ruby because we +often see class objects acting as global namespaces for methods. For +example, in Rails:

        + +
        person = double("person")
        +allow(Person).to receive(:find) { person }
        +
        + +

        In this case we're instrumenting Person to return the person object +we've defined whenever it receives the find message. We +can also set a message expectation so that the example fails if +find is not called:

        + +
        person = double("person")
        +expect(Person).to receive(:find) { person }
        +
        + +

        RSpec replaces the method we're stubbing or mocking with its own +test-double-like method. At the end of the example, RSpec verifies any +message expectations, and then restores the original methods.

        + +

        Expecting Arguments

        + +
        expect(double).to receive(:msg).with(*args)
        +expect(double).to_not receive(:msg).with(*args)
        +
        + +

        You can set multiple expectations for the same message if you need to:

        + +
        expect(double).to receive(:msg).with("A", 1, 3)
        +expect(double).to receive(:msg).with("B", 2, 4)
        +
        + +

        Argument Matchers

        + +

        Arguments that are passed to with are compared with actual +arguments received using ==. In cases in which you want to specify things +about the arguments rather than the arguments themselves, you can use any +of the matchers that ship with rspec-expectations. They don't all make +syntactic sense (they were primarily designed for use with +RSpec::Expectations), but you are free to create your own custom +RSpec::Matchers.

        + +

        rspec-mocks also adds some keyword Symbols that you can use to specify +certain kinds of arguments:

        + +
        expect(double).to receive(:msg).with(no_args)
        +expect(double).to receive(:msg).with(any_args)
        +expect(double).to receive(:msg).with(1, any_args) # any args acts like an arg splat and can go anywhere
        +expect(double).to receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can be any kind of Numeric
        +expect(double).to receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
        +expect(double).to receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
        +expect(double).to receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
        +expect(double).to receive(:msg).with(1, duck_type(:abs, :div), "b") #2nd argument can be object that responds to #abs and #div
        +expect(double).to receive(:msg).with(hash_including(:a => 5)) # first arg is a hash with a: 5 as one of the key-values
        +expect(double).to receive(:msg).with(array_including(5)) # first arg is an array with 5 as one of the key-values
        +expect(double).to receive(:msg).with(hash_excluding(:a => 5)) # first arg is a hash without a: 5 as one of the key-values
        +
        + +

        Receive Counts

        + +
        expect(double).to receive(:msg).once
        +expect(double).to receive(:msg).twice
        +expect(double).to receive(:msg).exactly(n).times
        +expect(double).to receive(:msg).at_least(:once)
        +expect(double).to receive(:msg).at_least(:twice)
        +expect(double).to receive(:msg).at_least(n).times
        +expect(double).to receive(:msg).at_most(:once)
        +expect(double).to receive(:msg).at_most(:twice)
        +expect(double).to receive(:msg).at_most(n).times
        +
        + +

        Ordering

        + +
        expect(double).to receive(:msg).ordered
        +expect(double).to receive(:other_msg).ordered
        +  # This will fail if the messages are received out of order
        +
        + +

        This can include the same message with different arguments:

        + +
        expect(double).to receive(:msg).with("A", 1, 3).ordered
        +expect(double).to receive(:msg).with("B", 2, 4).ordered
        +
        + +

        Setting Responses

        + +

        Whether you are setting a message expectation or a method stub, you can +tell the object precisely how to respond. The most generic way is to pass a +block to receive:

        + +
        expect(double).to receive(:msg) { value }
        +
        + +

        When the double receives the msg message, it evaluates the +block and returns the result.

        + +
        expect(double).to receive(:msg).and_return(value)
        +expect(double).to receive(:msg).exactly(3).times.and_return(value1, value2, value3)
        +  # returns value1 the first time, value2 the second, etc
        +expect(double).to receive(:msg).and_raise(error)
        +  # error can be an instantiated object or a class
        +  # if it is a class, it must be instantiable with no args
        +expect(double).to receive(:msg).and_throw(:msg)
        +expect(double).to receive(:msg).and_yield(values, to, yield)
        +expect(double).to receive(:msg).and_yield(values, to, yield).and_yield(some, other, values, this, time)
        +  # for methods that yield to a block multiple times
        +
        + +

        Any of these responses can be applied to a stub as well

        + +
        allow(double).to receive(:msg).and_return(value)
        +allow(double).to receive(:msg).and_return(value1, value2, value3)
        +allow(double).to receive(:msg).and_raise(error)
        +allow(double).to receive(:msg).and_throw(:msg)
        +allow(double).to receive(:msg).and_yield(values, to, yield)
        +allow(double).to receive(:msg).and_yield(values, to, yield).and_yield(some, other, values, this, time)
        +
        + +

        Arbitrary Handling

        + +

        Once in a while you'll find that the available expectations don't +solve the particular problem you are trying to solve. Imagine that you +expect the message to come with an Array argument that has a specific +length, but you don't care what is in it. You could do this:

        + +
        expect(double).to receive(:msg) do |arg|
        +  expect(arg.size).to eq 7
        +end
        +
        + +

        If the method being stubbed itself takes a block, and you need to yield to +it in some special way, you can use this:

        + +
        expect(double).to receive(:msg) do |&arg|
        +  begin
        +    arg.call
        +  ensure
        +    # cleanup
        +  end
        +end
        +
        + +

        Delegating to the Original Implementation

        + +

        When working with a partial mock object, you may occasionally want to set a +message expecation without interfering with how the object responds to the +message. You can use and_call_original to achieve this:

        + +
        expect(Person).to receive(:find).and_call_original
        +Person.find # => executes the original find method and returns the result
        +
        + +

        Combining Expectation Details

        + +

        Combining the message name with specific arguments, receive counts and +responses you can get quite a bit of detail in your expectations:

        + +
        expect(double).to receive(:<<).with("illegal value").once.and_raise(ArgumentError)
        +
        + +

        While this is a good thing when you really need it, you probably don't +really need it! Take care to specify only the things that matter to the +behavior of your code.

        + +

        Stubbing and Hiding Constants

        + +

        See the mutating +constants README for info on this feature.

        + +

        Use before(:example), not before(:context)

        + +

        Stubs in before(:context) are not supported. The reason is +that all stubs and mocks get cleared out after each example, so any stub +that is set in before(:context) would work in the first +example that happens to run in that group, but not for any others.

        + +

        Instead of before(:context), use +before(:example).

        + +

        Settings mocks or stubs on any instance of a class

        + +

        rspec-mocks provides two methods, allow_any_instance_of and +expect_any_instance_of, that will allow you to stub or mock +any instance of a class. They are used in place of allow or +expect:

        + +
        allow_any_instance_of(Widget).to receive(:name).and_return("Wibble")
        +expect_any_instance_of(Widget).to receive(:name).and_return("Wobble")
        +
        + +

        These methods add the appropriate stub or expectation to all instances of +Widget.

        + +

        This feature is sometimes useful when working with legacy code, though in +general we discourage its use for a number of reasons:

        +
        • +

          The rspec-mocks API is designed for individual object +instances, but this feature operates on entire classes of objects. As a +result there are some sematically confusing edge cases. For example in +expect_any_instance_of(Widget).to receive(:name).twice it +isn't clear whether each specific instance is expected to receive +name twice, or if two receives total are expected. (It's +the former.)

          +
        • +

          Using this feature is often a design smell. It may be that your test is +trying to do too much or that the object under test is too complex.

          +
        • +

          It is the most complicated feature of rspec-mocks, and has +historically received the most bug reports. (None of the core team +actively use it, which doesn't help.)

          +
        + +

        Further Reading

        + +

        There are many different viewpoints about the meaning of mocks and stubs. +If you are interested in learning more, here is some recommended reading:

        + + +

        Also see

        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-mocks/method_list.html b/source/documentation/3.2/rspec-mocks/method_list.html new file mode 100644 index 000000000..b70dd4af8 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/method_list.html @@ -0,0 +1,719 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-mocks/top-level-namespace.html b/source/documentation/3.2/rspec-mocks/top-level-namespace.html new file mode 100644 index 000000000..64cab9283 --- /dev/null +++ b/source/documentation/3.2/rspec-mocks/top-level-namespace.html @@ -0,0 +1,140 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + + + +
        Includes:
        +
        RSpec::Mocks::ExampleMethods
        + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: RSpec + + + + Classes: BasicObject, Class + + +

        + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from RSpec::Mocks::ExampleMethods

        +

        #allow, #allow_any_instance_of, #allow_message_expectations_on_nil, #class_double, #class_spy, #double, #expect, #expect_any_instance_of, #have_received, #hide_const, #instance_double, #instance_spy, #object_double, #object_spy, #receive, #receive_message_chain, #receive_messages, #spy, #stub_const

        + + + + + + + + + +

        Methods included from RSpec::Mocks::ArgumentMatchers

        +

        #any_args, #anything, #array_including, #boolean, #duck_type, #hash_excluding, #hash_including, #instance_of, #kind_of, #no_args

        + + +
        + + + + + \ No newline at end of file From 30c6462578b5ac0654acd1b532f77d60e717dd3e Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:28:48 +1100 Subject: [PATCH 10/14] rspec-expectations 3.2 documentation --- .../3.2/rspec-expectations/BasicObject.html | 392 ++ .../3.2/rspec-expectations/RSpec.html | 128 + .../RSpec/Expectations.html | 407 ++ .../RSpec/Expectations/Configuration.html | 896 ++++ .../RSpec/Expectations/ExpectationTarget.html | 515 +++ .../RSpec/Expectations/Syntax.html | 838 ++++ .../rspec-expectations/RSpec/Matchers.html | 3903 +++++++++++++++++ .../RSpec/Matchers/AliasedMatcher.html | 545 +++ .../RSpec/Matchers/BuiltIn.html | 133 + .../RSpec/Matchers/BuiltIn/All.html | 454 ++ .../RSpec/Matchers/BuiltIn/BaseMatcher.html | 799 ++++ .../BaseMatcher/DefaultFailureMessages.html | 304 ++ .../RSpec/Matchers/BuiltIn/Be.html | 437 ++ .../RSpec/Matchers/BuiltIn/BeAKindOf.html | 196 + .../Matchers/BuiltIn/BeAnInstanceOf.html | 291 ++ .../RSpec/Matchers/BuiltIn/BeBetween.html | 684 +++ .../RSpec/Matchers/BuiltIn/BeComparedTo.html | 607 +++ .../RSpec/Matchers/BuiltIn/BeFalsey.html | 364 ++ .../RSpec/Matchers/BuiltIn/BeNil.html | 364 ++ .../RSpec/Matchers/BuiltIn/BePredicate.html | 683 +++ .../RSpec/Matchers/BuiltIn/BeTruthy.html | 364 ++ .../RSpec/Matchers/BuiltIn/BeWithin.html | 648 +++ .../RSpec/Matchers/BuiltIn/Change.html | 843 ++++ .../Matchers/BuiltIn/ChangeFromValue.html | 357 ++ .../Matchers/BuiltIn/ChangeRelatively.html | 279 ++ .../RSpec/Matchers/BuiltIn/ChangeToValue.html | 357 ++ .../RSpec/Matchers/BuiltIn/Compound.html | 533 +++ .../RSpec/Matchers/BuiltIn/Compound/And.html | 311 ++ .../BuiltIn/Compound/NestedEvaluator.html | 333 ++ .../RSpec/Matchers/BuiltIn/Compound/Or.html | 299 ++ .../BuiltIn/Compound/SequentialEvaluator.html | 302 ++ .../Matchers/BuiltIn/ContainExactly.html | 460 ++ .../RSpec/Matchers/BuiltIn/Cover.html | 440 ++ .../RSpec/Matchers/BuiltIn/EndWith.html | 209 + .../RSpec/Matchers/BuiltIn/Eq.html | 520 +++ .../RSpec/Matchers/BuiltIn/Eql.html | 442 ++ .../RSpec/Matchers/BuiltIn/Equal.html | 464 ++ .../RSpec/Matchers/BuiltIn/Exist.html | 605 +++ .../Matchers/BuiltIn/Exist/ExistenceTest.html | 583 +++ .../RSpec/Matchers/BuiltIn/Has.html | 509 +++ .../Matchers/BuiltIn/HaveAttributes.html | 767 ++++ .../RSpec/Matchers/BuiltIn/Include.html | 749 ++++ .../RSpec/Matchers/BuiltIn/Match.html | 369 ++ .../Matchers/BuiltIn/OperatorMatcher.html | 304 ++ .../RSpec/Matchers/BuiltIn/Output.html | 973 ++++ .../RSpec/Matchers/BuiltIn/RaiseError.html | 634 +++ .../RSpec/Matchers/BuiltIn/RespondTo.html | 661 +++ .../RSpec/Matchers/BuiltIn/Satisfy.html | 509 +++ .../BuiltIn/SpecificValuesChange.html | 281 ++ .../Matchers/BuiltIn/StartAndEndWith.html | 456 ++ .../RSpec/Matchers/BuiltIn/StartWith.html | 209 + .../RSpec/Matchers/BuiltIn/ThrowSymbol.html | 716 +++ .../RSpec/Matchers/BuiltIn/YieldControl.html | 884 ++++ .../Matchers/BuiltIn/YieldSuccessiveArgs.html | 353 ++ .../RSpec/Matchers/BuiltIn/YieldWithArgs.html | 269 ++ .../Matchers/BuiltIn/YieldWithNoArgs.html | 191 + .../RSpec/Matchers/Composable.html | 779 ++++ .../Matchers/Composable/DescribableItem.html | 137 + .../RSpec/Matchers/DSL.html | 226 + .../Matchers/DSL/DefaultImplementations.html | 450 ++ .../RSpec/Matchers/DSL/Macros.html | 1000 +++++ .../RSpec/Matchers/DSL/Macros/Deprecated.html | 402 ++ .../RSpec/Matchers/DSL/Matcher.html | 995 +++++ .../RSpec/Matchers/MatcherProtocol.html | 1068 +++++ .../RSpec/Matchers/Pretty.html | 446 ++ .../3.2/rspec-expectations/_index.html | 677 +++ .../3.2/rspec-expectations/class_list.html | 54 + .../rspec-expectations/file.Changelog.html | 1135 +++++ .../3.2/rspec-expectations/file.License.html | 73 + .../3.2/rspec-expectations/file.README.html | 340 ++ .../3.2/rspec-expectations/file_list.html | 62 + .../3.2/rspec-expectations/frames.html | 26 + .../3.2/rspec-expectations/index.html | 340 ++ .../3.2/rspec-expectations/method_list.html | 1757 ++++++++ .../top-level-namespace.html | 129 + 75 files changed, 40219 insertions(+) create mode 100644 source/documentation/3.2/rspec-expectations/BasicObject.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Expectations.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Expectations/Configuration.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Expectations/ExpectationTarget.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Expectations/Syntax.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/AliasedMatcher.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/All.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher/DefaultFailureMessages.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeBetween.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalsey.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeTruthy.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeFromValue.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeRelatively.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeToValue.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/And.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/NestedEvaluator.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/Or.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/SequentialEvaluator.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ContainExactly.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Exist/ExistenceTest.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/HaveAttributes.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/OperatorMatcher.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Output.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/SpecificValuesChange.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/Composable.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/Composable/DescribableItem.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/DefaultImplementations.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Macros.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Macros/Deprecated.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Matcher.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/MatcherProtocol.html create mode 100644 source/documentation/3.2/rspec-expectations/RSpec/Matchers/Pretty.html create mode 100644 source/documentation/3.2/rspec-expectations/_index.html create mode 100644 source/documentation/3.2/rspec-expectations/class_list.html create mode 100644 source/documentation/3.2/rspec-expectations/file.Changelog.html create mode 100644 source/documentation/3.2/rspec-expectations/file.License.html create mode 100644 source/documentation/3.2/rspec-expectations/file.README.html create mode 100644 source/documentation/3.2/rspec-expectations/file_list.html create mode 100644 source/documentation/3.2/rspec-expectations/frames.html create mode 100644 source/documentation/3.2/rspec-expectations/index.html create mode 100644 source/documentation/3.2/rspec-expectations/method_list.html create mode 100644 source/documentation/3.2/rspec-expectations/top-level-namespace.html diff --git a/source/documentation/3.2/rspec-expectations/BasicObject.html b/source/documentation/3.2/rspec-expectations/BasicObject.html new file mode 100644 index 000000000..44e521303 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/BasicObject.html @@ -0,0 +1,392 @@ + + + + + + Class: BasicObject + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: BasicObject + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        The legacy :should syntax adds the following methods directly to +BasicObject so that they are available off of any object. Note, however, +that this syntax does not always play nice with delegate/proxy objects. +We recommend you use the non-monkeypatching :expect syntax instead.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) should + + + + + +

        +
        + +
        + Note: +

        This is only available when you have enabled the :should syntax.

        +
        +
        + +

        Passes if matcher returns true. Available on every Object.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        actual.should eq expected
        +actual.should match /expression/
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + +
        • + +
        • + + message + + + (String) + + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if the expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 109
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) should_not + + + + + +

        +
        + +
        + Note: +

        This is only available when you have enabled the :should syntax.

        +
        +
        + +

        Passes if matcher returns false. Available on every Object.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        actual.should_not eq expected
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + +
        • + +
        • + + message + + + (String) + + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          false if the negative expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 131
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec.html b/source/documentation/3.2/rspec-expectations/RSpec.html new file mode 100644 index 000000000..8f1dfd1dc --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec.html @@ -0,0 +1,128 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers.rb,
        + lib/rspec/expectations.rb,
        lib/rspec/matchers/dsl.rb,
        lib/rspec/matchers/pretty.rb,
        lib/rspec/matchers/built_in.rb,
        lib/rspec/expectations/syntax.rb,
        lib/rspec/matchers/composable.rb,
        lib/rspec/matchers/built_in/be.rb,
        lib/rspec/expectations/version.rb,
        lib/rspec/expectations/handler.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/matchers/built_in/all.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/expectations/fail_with.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/built_in/output.rb,
        lib/rspec/matchers/aliased_matcher.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/matcher_protocol.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/built_in/compound.rb,
        lib/rspec/matchers/matcher_delegator.rb,
        lib/rspec/expectations/configuration.rb,
        lib/rspec/matchers/built_in/operators.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/be_between.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/generated_descriptions.rb,
        lib/rspec/expectations/expectation_target.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/expectations/minitest_integration.rb,
        lib/rspec/matchers/built_in/have_attributes.rb,
        lib/rspec/matchers/built_in/contain_exactly.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        RSpec's top level namespace. All of rspec-expectations is contained +in the RSpec::Expectations and RSpec::Matchers namespaces.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: Expectations, Matchers + + + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Expectations.html b/source/documentation/3.2/rspec-expectations/RSpec/Expectations.html new file mode 100644 index 000000000..74ea366ab --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Expectations.html @@ -0,0 +1,407 @@ + + + + + + Module: RSpec::Expectations + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations.rb,
        + lib/rspec/expectations/syntax.rb,
        lib/rspec/expectations/version.rb,
        lib/rspec/expectations/handler.rb,
        lib/rspec/expectations/fail_with.rb,
        lib/rspec/expectations/configuration.rb,
        lib/rspec/expectations/expectation_target.rb,
        lib/rspec/expectations/minitest_integration.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        RSpec::Expectations provides a simple, readable API to express +the expected outcomes in a code example. To express an expected +outcome, wrap an object or block in expect, call to or to_not +(aliased as not_to) and pass it a matcher object:

        + +
        expect(order.total).to eq(Money.new(5.55, :USD))
        +expect(list).to include(user)
        +expect(message).not_to match(/foo/)
        +expect { do_something }.to raise_error
        +
        + +

        The last form (the block form) is needed to match against ruby constructs +that are not objects, but can only be observed when executing a block +of code. This includes raising errors, throwing symbols, yielding, +and changing values.

        + +

        When expect(...).to is invoked with a matcher, it turns around +and calls matcher.matches?(<object wrapped by expect>). For example, +in the expression:

        + +
        expect(order.total).to eq(Money.new(5.55, :USD))
        +
        + +

        ...eq(Money.new(5.55, :USD)) returns a matcher object, and it results +in the equivalent of eq.matches?(order.total). If matches? returns +true, the expectation is met and execution continues. If false, then +the spec fails with the message returned by eq.failure_message.

        + +

        Given the expression:

        + +
        expect(order.entries).not_to include(entry)
        +
        + +

        ...the not_to method (also available as to_not) invokes the equivalent of +include.matches?(order.entries), but it interprets false as success, and +true as a failure, using the message generated by +include.failure_message_when_negated.

        + +

        rspec-expectations ships with a standard set of useful matchers, and writing +your own matchers is quite simple.

        + +

        See RSpec::Matchers for more information about the +built-in matchers that ship with rspec-expectations, and how to write your +own custom matchers.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: Syntax + + + + Classes: Configuration, ExpectationNotMetError, ExpectationTarget + + +

        + +

        Constant Summary

        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (RSpec::Expectations::Configuration) configuration + + + + + +

        +
        +

        The configuration object.

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +140
        +141
        +142
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 140
        +
        +def self.configuration
        +  @configuration ||= Configuration.new
        +end
        +
        +
        + +
        +

        + + + (Object) fail_with(message, expected = nil, actual = nil) + + + + + +

        +
        +

        Raises an RSpec::Expectations::ExpectationNotMetError with message. +Adds a diff to the failure message when expected and actual are +both present.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + +
        • + +
        • + + expected + + + (Object) + + + (defaults to: nil) + + +
        • + +
        • + + actual + + + (Object) + + + (defaults to: nil) + + +
        • + +
        + +

        Raises:

        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/expectations/fail_with.rb', line 21
        +
        +def fail_with(message, expected=nil, actual=nil)
        +  unless message
        +    raise ArgumentError, "Failure message is nil. Does your matcher define the " \
        +                         "appropriate failure_message[_when_negated] method to return a string?"
        +  end
        +
        +  diff = differ.diff(actual, expected)
        +  message = "#{message}\nDiff:#{diff}" unless diff.empty?
        +
        +  raise RSpec::Expectations::ExpectationNotMetError, message
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Expectations/Configuration.html b/source/documentation/3.2/rspec-expectations/RSpec/Expectations/Configuration.html new file mode 100644 index 000000000..3f8d4be93 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Expectations/Configuration.html @@ -0,0 +1,896 @@ + + + + + + Class: RSpec::Expectations::Configuration + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/configuration.rb
        + +
        +
        + +

        Overview

        +
        +

        Provides configuration options for rspec-expectations. +If you are using rspec-core, you can access this via a +block passed to RSpec::Core::Configuration#expect_with. +Otherwise, you can access it via RSpec::Expectations.configuration.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |rspec|
        +  rspec.expect_with :rspec do |c|
        +    # c is the config object
        +  end
        +end
        +
        +# or
        +
        +RSpec::Expectations.configuration
        + +
        + + +
        +

        Constant Summary

        + +
        + +
        NullBacktraceFormatter = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        +

        Null implementation of a backtrace formatter used by default +when rspec-core is not loaded. Does no filtering.

        + + +
        +
        +
        + + +
        +
        +
        Module.new do
        +  def self.format_backtrace(backtrace)
        +    backtrace
        +  end
        +end
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) backtrace_formatter + + + + + +

        +
        +

        Sets or gets the backtrace formatter. The backtrace formatter should +implement #format_backtrace(Array<String>). This is used +to format backtraces of errors handled by the raise_error +matcher.

        + +

        If you are using rspec-core, rspec-core's backtrace formatting +will be used (including respecting the presence or absence of +the --backtrace option).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +101
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 101
        +
        +attr_writer :backtrace_formatter
        +
        +
        + + + +
        +

        + + - (Object) color=(value) (writeonly) + + + + + +

        +
        +

        Indicates whether or not diffs should be colored. +Delegates to rspec-core's color option if rspec-core +is loaded; otherwise you can set it here.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 68
        +
        +def color=(value)
        +  @color = value
        +end
        +
        +
        + + + +
        +

        + + - (Object) include_chain_clauses_in_custom_matcher_descriptions=(value) (writeonly) + + + + + +

        +
        +

        Sets if custom matcher descriptions and failure messages +should include clauses from methods defined using chain.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + value + + + (Boolean) + + + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 113
        +
        +def include_chain_clauses_in_custom_matcher_descriptions=(value)
        +  @include_chain_clauses_in_custom_matcher_descriptions = value
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_should_and_should_not_to(*modules) + + + + + +

        +
        +

        Adds should and should_not to the given classes +or modules. This can be used to ensure should works +properly on things like proxy objects (particular +Delegator-subclassed objects on 1.8).

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + modules + + + (Array<Module>) + + + + — +

          the list of classes or modules +to add should and should_not to.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +85
        +86
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 85
        +
        +def add_should_and_should_not_to(*modules)
        +  modules.each do |mod|
        +    Expectations::Syntax.enable_should(mod)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) color? + + + + + +

        +
        +

        Indicates whether or not diffs should be colored. +Delegates to rspec-core's color option if rspec-core +is loaded; otherwise you can set it here.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 73
        +
        +def color?
        +  ::RSpec.configuration.color_enabled?
        +end
        +
        +
        + +
        +

        + + - (Boolean) include_chain_clauses_in_custom_matcher_descriptions? + + + + + +

        +
        +

        Indicates whether or not custom matcher descriptions and failure messages +should include clauses from methods defined using chain. It is +false by default for backwards compatibility.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 118
        +
        +def include_chain_clauses_in_custom_matcher_descriptions?
        +  @include_chain_clauses_in_custom_matcher_descriptions ||= false
        +end
        +
        +
        + +
        +

        + + - (Array<Symbol>) syntax + + + + + +

        +
        +

        The list of configured syntaxes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        unless RSpec::Matchers.configuration.syntax.include?(:expect)
        +  raise "this RSpec extension gem requires the rspec-expectations `:expect` syntax"
        +end
        + +
        + +

        Returns:

        +
          + +
        • + + + (Array<Symbol>) + + + + — +

          the list of configured syntaxes.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 53
        +
        +def syntax
        +  syntaxes = []
        +  syntaxes << :should if Expectations::Syntax.should_enabled?
        +  syntaxes << :expect if Expectations::Syntax.expect_enabled?
        +  syntaxes
        +end
        +
        +
        + +
        +

        + + - (Object) syntax=(values) + + + + + +

        +
        +

        Configures the supported syntax.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |rspec|
        +  rspec.expect_with :rspec do |c|
        +    c.syntax = :should
        +    # or
        +    c.syntax = :expect
        +    # or
        +    c.syntax = [:should, :expect]
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + values + + + (Array<Symbol>, Symbol) + + + + — +

          the syntaxes to enable

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 33
        +
        +def syntax=(values)
        +  if Array(values).include?(:expect)
        +    Expectations::Syntax.enable_expect
        +  else
        +    Expectations::Syntax.disable_expect
        +  end
        +
        +  if Array(values).include?(:should)
        +    Expectations::Syntax.enable_should
        +  else
        +    Expectations::Syntax.disable_should
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Expectations/ExpectationTarget.html b/source/documentation/3.2/rspec-expectations/RSpec/Expectations/ExpectationTarget.html new file mode 100644 index 000000000..f6e654118 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Expectations/ExpectationTarget.html @@ -0,0 +1,515 @@ + + + + + + Class: RSpec::Expectations::ExpectationTarget + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::ExpectationTarget + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/expectation_target.rb
        + +
        +
        + +

        Overview

        +
        + +
        + Note: +

        ExpectationTarget is not intended to be instantiated +directly by users. Use expect instead.

        +
        +
        + +

        Wraps the target of an expectation.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(something)       # => ExpectationTarget wrapping something
        +expect { do_something } # => ExpectationTarget wrapping the block
        +
        +# used with `to`
        +expect(actual).to eq(3)
        +
        +# with `not_to`
        +expect(actual).not_to eq(3)
        + +
        + + +
        +

        Constant Summary

        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ExpectationTarget) initialize(value) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of ExpectationTarget

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 25
        +
        +def initialize(value)
        +  @target = value
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) not_to(matcher = nil, message = nil, &block) + + + + Also known as: + to_not + + + + +

        +
        +

        Runs the given expectation, passing if matcher returns false.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(value).not_to eq(5)
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (String or Proc) + + + (defaults to: nil) + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          false if the negative expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 65
        +
        +def not_to(matcher=nil, message=nil, &block)
        +  prevent_operator_matchers(:not_to) unless matcher
        +  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(@target, matcher, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Boolean) to(matcher = nil, message = nil, &block) + + + + + +

        +
        +

        Runs the given expectation, passing if matcher returns true.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(value).to eq(5)
        +expect { perform }.to raise_error
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (String or Proc) + + + (defaults to: nil) + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if the expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 52
        +
        +def to(matcher=nil, message=nil, &block)
        +  prevent_operator_matchers(:to) unless matcher
        +  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(@target, matcher, message, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Expectations/Syntax.html b/source/documentation/3.2/rspec-expectations/RSpec/Expectations/Syntax.html new file mode 100644 index 000000000..2d9e0ea0f --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Expectations/Syntax.html @@ -0,0 +1,838 @@ + + + + + + Module: RSpec::Expectations::Syntax + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Syntax + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Provides methods for enabling and disabling the available +syntaxes provided by rspec-expectations.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) default_should_host + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Determines where we add should and should_not.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 11
        +
        +def default_should_host
        +  @default_should_host ||= ::Object.ancestors.last
        +end
        +
        +
        + +
        +

        + + + (Object) disable_expect(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Disables the expect syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 80
        +
        +def disable_expect(syntax_host=::RSpec::Matchers)
        +  return unless expect_enabled?(syntax_host)
        +
        +  syntax_host.module_exec do
        +    undef expect
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) disable_should(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Disables the should syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 57
        +
        +def disable_should(syntax_host=default_should_host)
        +  return unless should_enabled?(syntax_host)
        +
        +  syntax_host.module_exec do
        +    undef should
        +    undef should_not
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) enable_expect(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Enables the expect syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 68
        +
        +def enable_expect(syntax_host=::RSpec::Matchers)
        +  return if expect_enabled?(syntax_host)
        +
        +  syntax_host.module_exec do
        +    def expect(value=::RSpec::Expectations::ExpectationTarget::UndefinedValue, &block)
        +      ::RSpec::Expectations::ExpectationTarget.for(value, block)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) enable_should(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Enables the should syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 38
        +
        +def enable_should(syntax_host=default_should_host)
        +  @warn_about_should = false if syntax_host == default_should_host
        +  return if should_enabled?(syntax_host)
        +
        +  syntax_host.module_exec do
        +    def should(matcher=nil, message=nil, &block)
        +      ::RSpec::Expectations::Syntax.warn_about_should_unless_configured(__method__)
        +      ::RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
        +    end
        +
        +    def should_not(matcher=nil, message=nil, &block)
        +      ::RSpec::Expectations::Syntax.warn_about_should_unless_configured(__method__)
        +      ::RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Boolean) expect_enabled?(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates whether or not the expect syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +96
        +97
        +98
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 96
        +
        +def expect_enabled?(syntax_host=::RSpec::Matchers)
        +  syntax_host.method_defined?(:expect)
        +end
        +
        +
        + +
        +

        + + + (Boolean) should_enabled?(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates whether or not the should syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +90
        +91
        +92
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 90
        +
        +def should_enabled?(syntax_host=default_should_host)
        +  syntax_host.method_defined?(:should)
        +end
        +
        +
        + +
        +

        + + + (Object) warn_about_should! + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Instructs rspec-expectations to warn on first usage of should or should_not. +Enabled by default. This is largely here to facilitate testing.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 18
        +
        +def warn_about_should!
        +  @warn_about_should = true
        +end
        +
        +
        + +
        +

        + + + (Object) warn_about_should_unless_configured(method_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Generates a deprecation warning for the given method if no warning +has already been issued.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 25
        +
        +def warn_about_should_unless_configured(method_name)
        +  return unless @warn_about_should
        +
        +  RSpec.deprecate(
        +    "Using `#{method_name}` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax",
        +    :replacement => "the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }`"
        +  )
        +
        +  @warn_about_should = false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers.html new file mode 100644 index 000000000..82ff38955 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers.html @@ -0,0 +1,3903 @@ + + + + + + Module: RSpec::Matchers + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers.rb,
        + lib/rspec/matchers/dsl.rb,
        lib/rspec/matchers/pretty.rb,
        lib/rspec/matchers/built_in.rb,
        lib/rspec/matchers/composable.rb,
        lib/rspec/matchers/built_in/be.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/matchers/built_in/all.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/built_in/output.rb,
        lib/rspec/matchers/aliased_matcher.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/matcher_protocol.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/built_in/compound.rb,
        lib/rspec/matchers/matcher_delegator.rb,
        lib/rspec/matchers/built_in/operators.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/be_between.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/generated_descriptions.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/matchers/built_in/have_attributes.rb,
        lib/rspec/matchers/built_in/contain_exactly.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        RSpec::Matchers provides a number of useful matchers we use to define +expectations. Any object that implements the matcher protocol +can be used as a matcher.

        + +

        Predicates

        + +

        In addition to matchers that are defined explicitly, RSpec will create +custom matchers on the fly for any arbitrary predicate, giving your specs a +much more natural language feel.

        + +

        A Ruby predicate is a method that ends with a "?" and returns true or false. +Common examples are empty?, nil?, and instance_of?.

        + +

        All you need to do is write expect(..).to be_ followed by the predicate +without the question mark, and RSpec will figure it out from there. +For example:

        + +
        expect([]).to be_empty     # => [].empty?() | passes
        +expect([]).not_to be_empty # => [].empty?() | fails
        +
        + +

        In addtion to prefixing the predicate matchers with "be", you can also use "be_a" +and "bean", making your specs read much more naturally:

        + +
        expect("a string").to be_an_instance_of(String) # =>"a string".instance_of?(String) # passes
        +
        +expect(3).to be_a_kind_of(Fixnum)        # => 3.kind_of?(Numeric)     | passes
        +expect(3).to be_a_kind_of(Numeric)       # => 3.kind_of?(Numeric)     | passes
        +expect(3).to be_an_instance_of(Fixnum)   # => 3.instance_of?(Fixnum)  | passes
        +expect(3).not_to be_an_instance_of(Numeric) # => 3.instance_of?(Numeric) | fails
        +
        + +

        RSpec will also create custom matchers for predicates like has_key?. To +use this feature, just state that the object should have_key(:key) and RSpec will +call has_key?(:key) on the target. For example:

        + +
        expect(:a => "A").to have_key(:a)
        +expect(:a => "A").to have_key(:b) # fails
        +
        + +

        You can use this feature to invoke any predicate that begins with "has_", whether it is +part of the Ruby libraries (like Hash#has_key?) or a method you wrote on your own class.

        + +

        Note that RSpec does not provide composable aliases for these dynamic predicate +matchers. You can easily define your own aliases, though:

        + +
        RSpec::Matchers.alias_matcher :a_user_who_is_an_admin, :be_an_admin
        +expect(user_list).to include(a_user_who_is_an_admin)
        +
        + +

        Custom Matchers

        + +

        When you find that none of the stock matchers provide a natural feeling +expectation, you can very easily write your own using RSpec's matcher DSL +or writing one from scratch.

        + +

        Matcher DSL

        + +

        Imagine that you are writing a game in which players can be in various +zones on a virtual board. To specify that bob should be in zone 4, you +could say:

        + +
        expect(bob.current_zone).to eql(Zone.new("4"))
        +
        + +

        But you might find it more expressive to say:

        + +
        expect(bob).to be_in_zone("4")
        +
        + +

        and/or

        + +
        expect(bob).not_to be_in_zone("3")
        +
        + +

        You can create such a matcher like so:

        + +
        RSpec::Matchers.define :be_in_zone do |zone|
        +  match do |player|
        +    player.in_zone?(zone)
        +  end
        +end
        +
        + +

        This will generate a be_in_zone method that returns a matcher +with logical default messages for failures. You can override the failure +messages and the generated description as follows:

        + +
        RSpec::Matchers.define :be_in_zone do |zone|
        +  match do |player|
        +    player.in_zone?(zone)
        +  end
        +
        +  failure_message do |player|
        +    # generate and return the appropriate string.
        +  end
        +
        +  failure_message_when_negated do |player|
        +    # generate and return the appropriate string.
        +  end
        +
        +  description do
        +    # generate and return the appropriate string.
        +  end
        +end
        +
        + +

        Each of the message-generation methods has access to the block arguments +passed to the create method (in this case, zone). The +failure message methods (failure_message and +failure_message_when_negated) are passed the actual value (the +receiver of expect(..) or expect(..).not_to).

        + +

        Custom Matcher from scratch

        + +

        You could also write a custom matcher from scratch, as follows:

        + +
        class BeInZone
        +  def initialize(expected)
        +    @expected = expected
        +  end
        +
        +  def matches?(target)
        +    @target = target
        +    @target.current_zone.eql?(Zone.new(@expected))
        +  end
        +
        +  def failure_message
        +    "expected #{@target.inspect} to be in Zone #{@expected}"
        +  end
        +
        +  def failure_message_when_negated
        +    "expected #{@target.inspect} not to be in Zone #{@expected}"
        +  end
        +end
        +
        + +

        ... and a method like this:

        + +
        def be_in_zone(expected)
        +  BeInZone.new(expected)
        +end
        +
        + +

        And then expose the method to your specs. This is normally done +by including the method and the class in a module, which is then +included in your spec:

        + +
        module CustomGameMatchers
        +  class BeInZone
        +    # ...
        +  end
        +
        +  def be_in_zone(expected)
        +    # ...
        +  end
        +end
        +
        +describe "Player behaviour" do
        +  include CustomGameMatchers
        +  # ...
        +end
        +
        + +

        or you can include in globally in a spec_helper.rb file required +from your spec file(s):

        + +
        RSpec::configure do |config|
        +  config.include(CustomGameMatchers)
        +end
        +
        + +

        Making custom matchers composable

        + +

        RSpec's built-in matchers are designed to be composed, in expressions like:

        + +
        expect(["barn", 2.45]).to contain_exactly(
        +  a_value_within(0.1).of(2.5),
        +  a_string_starting_with("bar")
        +)
        +
        + +

        Custom matchers can easily participate in composed matcher expressions like these. +Include Composable in your custom matcher to make it support +being composed (matchers defined using the DSL have this included automatically). +Within your matcher's matches? method (or the match block, if using the DSL), +use values_match?(expected, actual) rather than expected == actual. +Under the covers, values_match? is able to match arbitrary +nested data structures containing a mix of both matchers and non-matcher objects. +It uses === and == to perform the matching, considering the values to +match if either returns true. The Composable mixin also provides some helper +methods for surfacing the matcher descriptions within your matcher's description +or failure messages.

        + +

        RSpec's built-in matchers each have a number of aliases that rephrase the matcher +from a verb phrase (such as be_within) to a noun phrase (such as a_value_within), +which reads better when the matcher is passed as an argument in a composed matcher +expressions, and also uses the noun-phrase wording in the matcher's description, +for readable failure messages. You can alias your custom matchers in similar fashion +using Matchers.alias_matcher.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: BuiltIn, Composable, DSL, Pretty + + + + Classes: AliasedMatcher, MatcherProtocol + + +

        + +

        Constant Summary

        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) all(expected) + + + + + + + + + + + + + +

          Passes if the provided matcher passes when checked against all elements of the collection.

          +
          + +
        • + + +
        • + + + - (Object) be(*args) + + + + (also: #a_value) + + + + + + + + + + + +

          Given true, false, or nil, will pass if actual value is true, false or nil (respectively).

          +
          + +
        • + + +
        • + + + - (Object) be_a(klass) + + + + (also: #be_an) + + + + + + + + + + + +

          passes if target.kind_of?(klass).

          +
          + +
        • + + +
        • + + + - (Object) be_a_kind_of(expected) + + + + (also: #be_kind_of, #a_kind_of) + + + + + + + + + + + +

          Passes if actual.kind_of?(expected).

          +
          + +
        • + + +
        • + + + - (Object) be_an_instance_of(expected) + + + + (also: #be_instance_of, #an_instance_of) + + + + + + + + + + + +

          Passes if actual.instance_of?(expected).

          +
          + +
        • + + +
        • + + + - (Object) be_between(min, max) + + + + (also: #a_value_between) + + + + + + + + + + + +

          Passes if actual.between?(min, max).

          +
          + +
        • + + +
        • + + + - (Object) be_falsey + + + + (also: #be_falsy, #a_falsey_value, #a_falsy_value) + + + + + + + + + + + +

          Passes if actual is falsey (false or nil).

          +
          + +
        • + + +
        • + + + - (Object) be_nil + + + + (also: #a_nil_value) + + + + + + + + + + + +

          Passes if actual is nil.

          +
          + +
        • + + +
        • + + + - (Object) be_truthy + + + + (also: #a_truthy_value) + + + + + + + + + + + +

          Passes if actual is truthy (anything but false or nil).

          +
          + +
        • + + +
        • + + + - (Object) be_within(delta) + + + + (also: #a_value_within, #within) + + + + + + + + + + + +

          Passes if actual == expected +/- delta.

          +
          + +
        • + + +
        • + + + - (Object) change(receiver = nil, message = nil, &block) + + + + (also: #a_block_changing, #changing) + + + + + + + + + + + +

          Applied to a proc, specifies that its execution will cause some value to change.

          +
          + +
        • + + +
        • + + + - (Object) contain_exactly(*items) + + + + (also: #a_collection_containing_exactly, #containing_exactly) + + + + + + + + + + + +

          Passes if actual contains all of the expected regardless of order.

          +
          + +
        • + + +
        • + + + - (Object) cover(*values) + + + + (also: #a_range_covering, #covering) + + + + + + + + + + + +

          Passes if actual covers expected.

          +
          + +
        • + + +
        • + + + - (Object) end_with(*expected) + + + + (also: #a_collection_ending_with, #a_string_ending_with, #ending_with) + + + + + + + + + + + +

          Matches if the actual value ends with the expected value(s).

          +
          + +
        • + + +
        • + + + - (Object) eq(expected) + + + + (also: #an_object_eq_to, #eq_to) + + + + + + + + + + + +

          Passes if actual == expected.

          +
          + +
        • + + +
        • + + + - (Object) eql(expected) + + + + (also: #an_object_eql_to, #eql_to) + + + + + + + + + + + +

          Passes if actual.eql?(expected).

          +
          + +
        • + + +
        • + + + - (Object) equal(expected) + + + + (also: #an_object_equal_to, #equal_to) + + + + + + + + + + + +

          Passes if actual.equal?(expected) (object identity).

          +
          + +
        • + + +
        • + + + - (Object) exist(*args) + + + + (also: #an_object_existing, #existing) + + + + + + + + + + + +

          Passes if actual.exist? or actual.exists?.

          +
          + +
        • + + +
        • + + + - (ExpectationTarget) expect + + + + + + + + + + + + + +

          Supports expect(actual).to matcher syntax by wrapping actual in an ExpectationTarget.

          +
          + +
        • + + +
        • + + + - (Object) have_attributes(expected) + + + + (also: #an_object_having_attributes) + + + + + + + + + + + +

          Passes if actual's attribute values match the expected attributes hash.

          +
          + +
        • + + +
        • + + + - (Object) include(*expected) + + + + (also: #a_collection_including, #a_string_including, #a_hash_including, #including) + + + + + + + + + + + +

          Passes if actual includes expected.

          +
          + +
        • + + +
        • + + + - (Object) match(expected) + + + + (also: #match_regex, #an_object_matching, #a_string_matching, #matching) + + + + + + + + + + + +

          Given a Regexp or String, passes if actual.match(pattern) Given an arbitrary nested data structure (e.g. arrays and hashes), matches if expected === actual || actual == expected for each pair of elements.

          +
          + +
        • + + +
        • + + + - (Object) match_array(items) + + + + + + + + + + + + + +

          An alternate form of contain_exactly that accepts the expected contents as a single array arg rather that splatted out as individual items.

          +
          + +
        • + + +
        • + + + - (Object) output(expected = nil) + + + + (also: #a_block_outputting) + + + + + + + + + + + +

          With no arg, passes if the block outputs to_stdout or to_stderr.

          +
          + +
        • + + +
        • + + + - (Object) raise_error(error = Exception, message = nil, &block) + + + + (also: #raise_exception, #a_block_raising, #raising) + + + + + + + + + + + +

          With no args, matches if any error is raised.

          +
          + +
        • + + +
        • + + + - (Object) respond_to(*names) + + + + (also: #an_object_responding_to, #responding_to) + + + + + + + + + + + +

          Matches if the target object responds to all of the names provided.

          +
          + +
        • + + +
        • + + + - (Object) satisfy(&block) + + + + (also: #an_object_satisfying, #satisfying) + + + + + + + + + + + +

          Passes if the submitted block returns true.

          +
          + +
        • + + +
        • + + + - (Object) start_with(*expected) + + + + (also: #a_collection_starting_with, #a_string_starting_with, #starting_with) + + + + + + + + + + + +

          Matches if the actual value starts with the expected value(s).

          +
          + +
        • + + +
        • + + + - (Object) throw_symbol(expected_symbol = nil, expected_arg = nil) + + + + (also: #a_block_throwing, #throwing) + + + + + + + + + + + +

          Given no argument, matches if a proc throws any Symbol.

          +
          + +
        • + + +
        • + + + - (Object) yield_control + + + + (also: #a_block_yielding_control, #yielding_control) + + + + + + + + + + + +

          Passes if the method called in the expect block yields, regardless of whether or not arguments are yielded.

          +
          + +
        • + + +
        • + + + - (Object) yield_successive_args(*args) + + + + (also: #a_block_yielding_successive_args, #yielding_successive_args) + + + + + + + + + + + +

          Designed for use with methods that repeatedly yield (such as iterators).

          +
          + +
        • + + +
        • + + + - (Object) yield_with_args(*args) + + + + (also: #a_block_yielding_with_args, #yielding_with_args) + + + + + + + + + + + +

          Given no arguments, matches if the method called in the expect block yields with arguments (regardless of what they are or how many there are).

          +
          + +
        • + + +
        • + + + - (Object) yield_with_no_args + + + + (also: #a_block_yielding_with_no_args, #yielding_with_no_args) + + + + + + + + + + + +

          Passes if the method called in the expect block yields with no arguments.

          +
          + +
        • + + +
        + + +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(method, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +929
        +930
        +931
        +932
        +933
        +934
        +935
        +936
        +937
        +938
        +
        +
        # File 'lib/rspec/matchers.rb', line 929
        +
        +def method_missing(method, *args, &block)
        +  case method.to_s
        +  when BE_PREDICATE_REGEX
        +    BuiltIn::BePredicate.new(method, *args, &block)
        +  when HAS_REGEX
        +    BuiltIn::Has.new(method, *args, &block)
        +  else
        +    super
        +  end
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) alias_matcher(new_name, old_name, options = {}) {|String| ... } + + + + + +

        +
        +

        Defines a matcher alias. The returned matcher's description will be overriden +to reflect the phrasing of the new name, which will be used in failure messages +when passed as an argument to another matcher in a composed matcher expression.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.alias_matcher :a_list_that_sums_to, :sum_to
        +sum_to(3).description # => "sum to 3"
        +a_list_that_sums_to(3).description # => "a list that sums to 3"
        + + +
        
        +RSpec::Matchers.alias_matcher :a_list_sorted_by, :be_sorted_by do |description|
        +  description.sub("be sorted by", "a list sorted by")
        +end
        +
        +be_sorted_by(:age).description # => "be sorted by age"
        +a_list_sorted_by(:age).description # => "a list sorted by age"
        + +
        +

        Parameters:

        +
          + +
        • + + new_name + + + (Symbol) + + + + — +

          the new name for the matcher

          +
          + +
        • + +
        • + + old_name + + + (Symbol) + + + + — +

          the original name for the matcher

          +
          + +
        • + +
        • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

          options for the aliased matcher

          +
          + +
        • + +
        + + + + + + + + +

        Options Hash (options):

        +
          + +
        • + :klass + (Class) + + + + + —

          the ruby class to use as the decorator. (Not normally used).

          +
          + +
        • + +
        + + +

        Yields:

        +
          + +
        • + + + (String) + + + + — +

          optional block that, when given is used to define the overriden +description. The yielded arg is the original description. If no block is +provided, a default description override is used based on the old and +new names.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +246
        +247
        +248
        +249
        +250
        +251
        +252
        +253
        +254
        +255
        +256
        +
        +
        # File 'lib/rspec/matchers.rb', line 246
        +
        +def self.alias_matcher(new_name, old_name, options={}, &description_override)
        +  description_override ||= lambda do |old_desc|
        +    old_desc.gsub(Pretty.split_words(old_name), Pretty.split_words(new_name))
        +  end
        +  klass = options.fetch(:klass) { AliasedMatcher }
        +
        +  define_method(new_name) do |*args, &block|
        +    matcher = __send__(old_name, *args, &block)
        +    klass.new(matcher, description_override)
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) clear_generated_description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used by rspec-core to clear the state used to generate +descriptions after an example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 11
        +
        +def self.clear_generated_description
        +  self.last_matcher = nil
        +  self.last_expectation_handler = nil
        +end
        +
        +
        + +
        +

        + + + (RSpec::Expectations::Configuration) configuration + + + + + +

        +
        +

        Delegates to Expectations.configuration. +This is here because rspec-core's expect_with option +looks for a configuration method on the mixin +(RSpec::Matchers) to yield to a block.

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +920
        +921
        +922
        +
        +
        # File 'lib/rspec/matchers.rb', line 920
        +
        +def self.configuration
        +  Expectations.configuration
        +end
        +
        +
        + +
        +

        + + + (Object) define_negated_matcher(negated_name, base_name) {|String| ... } + + + + + +

        +
        +

        Defines a negated matcher. The returned matcher's description and failure_message +will be overriden to reflect the phrasing of the new name, and the match logic will +be based on the original matcher but negated.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define_negated_matcher :a_value_not_between, :a_value_between
        +a_value_between(3, 5).description # => "a value between 3 and 5"
        +a_value_not_between(3, 5).description # => "a value not between 3 and 5"
        + +
        +

        Parameters:

        +
          + +
        • + + negated_name + + + (Symbol) + + + + — +

          the name for the negated matcher

          +
          + +
        • + +
        • + + base_name + + + (Symbol) + + + + — +

          the name of the original matcher that will be negated

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + (String) + + + + — +

          optional block that, when given is used to define the overriden +description. The yielded arg is the original description. If no block is +provided, a default description override is used based on the old and +new names.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +274
        +275
        +276
        +
        +
        # File 'lib/rspec/matchers.rb', line 274
        +
        +def self.define_negated_matcher(negated_name, base_name, &description_override)
        +  alias_matcher(negated_name, base_name, :klass => AliasedNegatedMatcher, &description_override)
        +end
        +
        +
        + +
        +

        + + + (Object) generated_description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Generates an an example description based on the last expectation. +Used by rspec-core's one-liner syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 19
        +
        +def self.generated_description
        +  return nil if last_expectation_handler.nil?
        +  "#{last_expectation_handler.verb} #{last_description}"
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) all(expected) + + + + + +

        +
        + +
        + Note: +

        The negative form not_to all is not supported. Instead +use not_to include or pass a negative form of a matcher +as the argument (e.g. all exclude(:foo)).

        +
        +
        + +
        + Note: +

        You can also use this with compound matchers as well.

        +
        +
        + +

        Passes if the provided matcher passes when checked against all +elements of the collection.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect([1, 3, 5]).to all be_odd
        +expect([1, 3, 6]).to all be_odd # fails
        + + +
        expect([1, 3, 5]).to all( be_odd.and be_an(Integer) )
        + +
        + + +
        + + + + +
        +
        +
        +
        +635
        +636
        +637
        +
        +
        # File 'lib/rspec/matchers.rb', line 635
        +
        +def all(expected)
        +  BuiltIn::All.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be(*args) + + + + Also known as: + a_value + + + + +

        +
        +

        Given true, false, or nil, will pass if actual value is true, false or +nil (respectively). Given no args means the caller should satisfy an if +condition (to be or not to be).

        + +

        Predicates are any Ruby method that ends in a "?" and returns true or +false. Given be_ followed by arbitrary_predicate (without the "?"), +RSpec will match convert that into a query against the target object.

        + +

        The arbitrarypredicate feature will handle any predicate prefixed with +"be_an" (e.g. bean_instance_of), "be_a" (e.g. bea_kind_of) or "be" +(e.g. be_empty), letting you choose the prefix that best suits the +predicate.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(actual).to     be_truthy
        +expect(actual).to     be_falsey
        +expect(actual).to     be_nil
        +expect(actual).to     be_[arbitrary_predicate](*args)
        +expect(actual).not_to be_nil
        +expect(actual).not_to be_[arbitrary_predicate](*args)
        + +
        + + +
        + + + + +
        +
        +
        +
        +318
        +319
        +320
        +
        +
        # File 'lib/rspec/matchers.rb', line 318
        +
        +def be(*args)
        +  args.empty? ? Matchers::BuiltIn::Be.new : equal(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) be_a(klass) + + + + Also known as: + be_an + + + + +

        +
        +

        passes if target.kind_of?(klass)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +324
        +325
        +326
        +
        +
        # File 'lib/rspec/matchers.rb', line 324
        +
        +def be_a(klass)
        +  be_a_kind_of(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) be_a_kind_of(expected) + + + + Also known as: + be_kind_of, a_kind_of + + + + +

        +
        +

        Passes if actual.kind_of?(expected)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     be_a_kind_of(Fixnum)
        +expect(5).to     be_a_kind_of(Numeric)
        +expect(5).not_to be_a_kind_of(Float)
        + +
        + + +
        + + + + +
        +
        +
        +
        +349
        +350
        +351
        +
        +
        # File 'lib/rspec/matchers.rb', line 349
        +
        +def be_a_kind_of(expected)
        +  BuiltIn::BeAKindOf.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be_an_instance_of(expected) + + + + Also known as: + be_instance_of, an_instance_of + + + + +

        +
        +

        Passes if actual.instance_of?(expected)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     be_an_instance_of(Fixnum)
        +expect(5).not_to be_an_instance_of(Numeric)
        +expect(5).not_to be_an_instance_of(Float)
        + +
        + + +
        + + + + +
        +
        +
        +
        +336
        +337
        +338
        +
        +
        # File 'lib/rspec/matchers.rb', line 336
        +
        +def be_an_instance_of(expected)
        +  BuiltIn::BeAnInstanceOf.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be_between(min, max) + + + + Also known as: + a_value_between + + + + +

        +
        +

        Passes if actual.between?(min, max). Works with any Comparable object, +including String, Symbol, Time, or Numeric (Fixnum, Bignum, Integer, +Float, Complex, and Rational).

        + +

        By default, be_between is inclusive (i.e. passes when given either the max or min value), +but you can make it exclusive by chaining that off the matcher.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to      be_between(1, 10)
        +expect(11).not_to be_between(1, 10)
        +expect(10).not_to be_between(1, 10).exclusive
        + +
        + + +
        + + + + +
        +
        +
        +
        +367
        +368
        +369
        +
        +
        # File 'lib/rspec/matchers.rb', line 367
        +
        +def be_between(min, max)
        +  BuiltIn::BeBetween.new(min, max)
        +end
        +
        +
        + +
        +

        + + - (Object) be_falsey + + + + Also known as: + be_falsy, a_falsey_value, a_falsy_value + + + + +

        +
        +

        Passes if actual is falsey (false or nil)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +285
        +286
        +287
        +
        +
        # File 'lib/rspec/matchers.rb', line 285
        +
        +def be_falsey
        +  BuiltIn::BeFalsey.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_nil + + + + Also known as: + a_nil_value + + + + +

        +
        +

        Passes if actual is nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +293
        +294
        +295
        +
        +
        # File 'lib/rspec/matchers.rb', line 293
        +
        +def be_nil
        +  BuiltIn::BeNil.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_truthy + + + + Also known as: + a_truthy_value + + + + +

        +
        +

        Passes if actual is truthy (anything but false or nil)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +279
        +280
        +281
        +
        +
        # File 'lib/rspec/matchers.rb', line 279
        +
        +def be_truthy
        +  BuiltIn::BeTruthy.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_within(delta) + + + + Also known as: + a_value_within, within + + + + +

        +
        +

        Passes if actual == expected +/- delta

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(result).to     be_within(0.5).of(3.0)
        +expect(result).not_to be_within(0.5).of(3.0)
        + +
        + + +
        + + + + +
        +
        +
        +
        +378
        +379
        +380
        +
        +
        # File 'lib/rspec/matchers.rb', line 378
        +
        +def be_within(delta)
        +  BuiltIn::BeWithin.new(delta)
        +end
        +
        +
        + +
        +

        + + - (Object) change(receiver = nil, message = nil, &block) + + + + Also known as: + a_block_changing, changing + + + + +

        +
        +

        Applied to a proc, specifies that its execution will cause some value to +change.

        + +

        You can either pass receiver and message, or a block, +but not both.

        + +

        When passing a block, it must use the { ... } format, not +do/end, as { ... } binds to the change method, whereas do/end +would errantly bind to the expect(..).to or expect(...).not_to method.

        + +

        You can chain any of the following off of the end to specify details +about the change:

        + +
          +
        • from
        • +
        • to
        • +
        + +

        or any one of:

        + +
          +
        • by
        • +
        • by_at_least
        • +
        • by_at_most
        • +
        + +

        == Notes

        + +

        Evaluates receiver.message or block before and after it +evaluates the block passed to expect.

        + +

        expect( ... ).not_to change supports the form that specifies from +(which specifies what you expect the starting, unchanged value to be) +but does not support forms with subsequent calls to by, by_at_least, +by_at_most or to.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by(1)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by_at_least(1)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by_at_most(1)
        +
        +string = "string"
        +expect {
        +  string.reverse!
        +}.to change { string }.from("string").to("gnirts")
        +
        +string = "string"
        +expect {
        +  string
        +}.not_to change { string }.from("string")
        +
        +expect {
        +  person.happy_birthday
        +}.to change(person, :birthday).from(32).to(33)
        +
        +expect {
        +  employee.develop_great_new_social_networking_app
        +}.to change(employee, :title).from("Mail Clerk").to("CEO")
        +
        +expect {
        +  doctor.leave_office
        +}.to change(doctor, :sign).from(/is in/).to(/is out/)
        +
        +user = User.new(:type => "admin")
        +expect {
        +  user.symbolize_type
        +}.to change(user, :type).from(String).to(Symbol)
        + +
        +

        Parameters:

        +
          + +
        • + + receiver + + + (Object) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (Symbol) + + + (defaults to: nil) + + + — +

          the message to send the receiver

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +463
        +464
        +465
        +
        +
        # File 'lib/rspec/matchers.rb', line 463
        +
        +def change(receiver=nil, message=nil, &block)
        +  BuiltIn::Change.new(receiver, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) contain_exactly(*items) + + + + Also known as: + a_collection_containing_exactly, containing_exactly + + + + +

        +
        + +
        + Note: +

        This is also available using the =~ operator with should, +but =~ is not supported with expect.

        +
        +
        + +

        Passes if actual contains all of the expected regardless of order. +This works for collections. Pass in multiple args and it will only +pass if all args are found in collection.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect([1, 2, 3]).to contain_exactly(1, 2, 3)
        +expect([1, 2, 3]).to contain_exactly(1, 3, 2)
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +482
        +483
        +484
        +
        +
        # File 'lib/rspec/matchers.rb', line 482
        +
        +def contain_exactly(*items)
        +  BuiltIn::ContainExactly.new(items)
        +end
        +
        +
        + +
        +

        + + - (Object) cover(*values) + + + + Also known as: + a_range_covering, covering + + + + +

        +
        +

        Passes if actual covers expected. This works for +Ranges. You can also pass in multiple args +and it will only pass if all args are found in Range.

        + +

        Warning:: Ruby >= 1.9 only

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(1..10).to     cover(5)
        +expect(1..10).to     cover(4, 6)
        +expect(1..10).to     cover(4, 6, 11) # fails
        +expect(1..10).not_to cover(11)
        +expect(1..10).not_to cover(5)        # fails
        + +
        + + +
        + + + + +
        +
        +
        +
        +500
        +501
        +502
        +
        +
        # File 'lib/rspec/matchers.rb', line 500
        +
        +def cover(*values)
        +  BuiltIn::Cover.new(*values)
        +end
        +
        +
        + +
        +

        + + - (Object) end_with(*expected) + + + + Also known as: + a_collection_ending_with, a_string_ending_with, ending_with + + + + +

        +
        +

        Matches if the actual value ends with the expected value(s). In the case +of a string, matches against the last expected.length characters of the +actual string. In the case of an array, matches against the last +expected.length elements of the actual array.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect("this string").to   end_with "string"
        +expect([0, 1, 2, 3, 4]).to end_with 4
        +expect([0, 2, 3, 4, 4]).to end_with 3, 4
        + +
        + + +
        + + + + +
        +
        +
        +
        +516
        +517
        +518
        +
        +
        # File 'lib/rspec/matchers.rb', line 516
        +
        +def end_with(*expected)
        +  BuiltIn::EndWith.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) eq(expected) + + + + Also known as: + an_object_eq_to, eq_to + + + + +

        +
        +

        Passes if actual == expected.

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     eq(5)
        +expect(5).not_to eq(3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +532
        +533
        +534
        +
        +
        # File 'lib/rspec/matchers.rb', line 532
        +
        +def eq(expected)
        +  BuiltIn::Eq.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) eql(expected) + + + + Also known as: + an_object_eql_to, eql_to + + + + +

        +
        +

        Passes if actual.eql?(expected)

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     eql(5)
        +expect(5).not_to eql(3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +547
        +548
        +549
        +
        +
        # File 'lib/rspec/matchers.rb', line 547
        +
        +def eql(expected)
        +  BuiltIn::Eql.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) equal(expected) + + + + Also known as: + an_object_equal_to, equal_to + + + + +

        +
        +

        Passes if actual.equal?(expected) (object identity).

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to       equal(5)   # Fixnums are equal
        +expect("5").not_to equal("5") # Strings that look the same are not the same object
        + +
        + + +
        + + + + +
        +
        +
        +
        +562
        +563
        +564
        +
        +
        # File 'lib/rspec/matchers.rb', line 562
        +
        +def equal(expected)
        +  BuiltIn::Equal.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) exist(*args) + + + + Also known as: + an_object_existing, existing + + + + +

        +
        +

        Passes if actual.exist? or actual.exists?

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(File).to exist("path/to/file")
        + +
        + + +
        + + + + +
        +
        +
        +
        +572
        +573
        +574
        +
        +
        # File 'lib/rspec/matchers.rb', line 572
        +
        +def exist(*args)
        +  BuiltIn::Exist.new(*args)
        +end
        +
        +
        + +
        +

        + + - (ExpectationTarget) expect + + + + + +

        +
        +

        Supports expect(actual).to matcher syntax by wrapping actual in an +ExpectationTarget.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(actual).to eq(expected)
        +expect(actual).not_to eq(expected)
        + +
        + +

        Returns:

        +
          + +
        • + + + (ExpectationTarget) + + + +
        • + +
        + +

        See Also:

        +
          + +
        • ExpectationTarget#to
        • + +
        • ExpectationTarget#not_to
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers.rb', line 205
        +
        +
        +
        +
        + +
        +

        + + - (Object) have_attributes(expected) + + + + Also known as: + an_object_having_attributes + + + + +

        +
        + +
        + Note: +

        It will fail if actual doesn't respond to any of the expected attributes.

        +
        +
        + +

        Passes if actual's attribute values match the expected attributes hash. +This works no matter how you define your attribute readers.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +Person = Struct.new(:name, :age)
        +person = Person.new("Bob", 32)
        +
        +expect(person).to have_attributes(:name => "Bob", :age => 32)
        +expect(person).to have_attributes(:name => a_string_starting_with("B"), :age => (a_value > 30) )
        + + +
        
        +expect(person).to have_attributes(:color => "red")
        + +
        + + +
        + + + + +
        +
        +
        +
        +594
        +595
        +596
        +
        +
        # File 'lib/rspec/matchers.rb', line 594
        +
        +def have_attributes(expected)
        +  BuiltIn::HaveAttributes.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) include(*expected) + + + + Also known as: + a_collection_including, a_string_including, a_hash_including, including + + + + +

        +
        +

        Passes if actual includes expected. This works for +collections and Strings. You can also pass in multiple args +and it will only pass if all args are found in collection.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect([1,2,3]).to      include(3)
        +expect([1,2,3]).to      include(2,3)
        +expect([1,2,3]).to      include(2,3,4) # fails
        +expect([1,2,3]).not_to  include(4)
        +expect("spread").to     include("read")
        +expect("spread").not_to include("red")
        + +
        + + +
        + + + + +
        +
        +
        +
        +611
        +612
        +613
        +
        +
        # File 'lib/rspec/matchers.rb', line 611
        +
        +def include(*expected)
        +  BuiltIn::Include.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected) + + + + Also known as: + match_regex, an_object_matching, a_string_matching, matching + + + + +

        +
        + +
        + Note: +

        The match_regex alias is deprecated and is not recommended for use. +It was added in 2.12.1 to facilitate its use from within custom +matchers (due to how the custom matcher DSL was evaluated in 2.x, +match could not be used there), but is no longer needed in 3.x.

        +
        +
        + +

        Given a Regexp or String, passes if actual.match(pattern) +Given an arbitrary nested data structure (e.g. arrays and hashes), +matches if expected === actual || actual == expected for each +pair of elements.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(email).to match(/^([^\s]+)((?:[-a-z0-9]+\.)+[a-z]{2,})$/i)
        +expect(email).to match("@example.com")
        + + +
        
        +hash = {
        +  :a => {
        +    :b => ["foo", 5],
        +    :c => { :d => 2.05 }
        +  }
        +}
        +
        +expect(hash).to match(
        +  :a => {
        +    :b => a_collection_containing_exactly(
        +      a_string_starting_with("f"),
        +      an_instance_of(Fixnum)
        +    ),
        +    :c => { :d => (a_value < 3) }
        +  }
        +)
        + +
        + + +
        + + + + +
        +
        +
        +
        +672
        +673
        +674
        +
        +
        # File 'lib/rspec/matchers.rb', line 672
        +
        +def match(expected)
        +  BuiltIn::Match.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) match_array(items) + + + + + +

        +
        +

        An alternate form of contain_exactly that accepts +the expected contents as a single array arg rather +that splatted out as individual items.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(results).to contain_exactly(1, 2)
        +# is identical to:
        +expect(results).to match_array([1, 2])
        + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +691
        +692
        +693
        +
        +
        # File 'lib/rspec/matchers.rb', line 691
        +
        +def match_array(items)
        +  contain_exactly(*items)
        +end
        +
        +
        + +
        +

        + + - (Object) output(expected = nil) + + + + Also known as: + a_block_outputting + + + + +

        +
        + +
        + Note: +

        This matcher works by temporarily replacing $stdout or $stderr, +so it's not able to intercept stream output that explicitly uses STDOUT/STDERR +or that uses a reference to $stdout/$stderr that was stored before the +matcher is used.

        +
        +
        + +

        With no arg, passes if the block outputs to_stdout or to_stderr. +With a string, passes if the blocks outputs that specific string to_stdout or to_stderr. +With a regexp or matcher, passes if the blocks outputs a string to_stdout or to_stderr that matches.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { print 'foo' }.to output.to_stdout
        +expect { print 'foo' }.to output('foo').to_stdout
        +expect { print 'foo' }.to output(/foo/).to_stdout
        +
        +expect { do_something }.to_not output.to_stdout
        +
        +expect { warn('foo') }.to output.to_stderr
        +expect { warn('foo') }.to output('foo').to_stderr
        +expect { warn('foo') }.to output(/foo/).to_stderr
        +
        +expect { do_something }.to_not output.to_stderr
        + +
        + + +
        + + + + +
        +
        +
        +
        +717
        +718
        +719
        +
        +
        # File 'lib/rspec/matchers.rb', line 717
        +
        +def output(expected=nil)
        +  BuiltIn::Output.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) raise_error(error = Exception, message = nil, &block) + + + + Also known as: + raise_exception, a_block_raising, raising + + + + +

        +
        +

        With no args, matches if any error is raised. +With a named error, matches only if that specific error is raised. +With a named error and messsage specified as a String, matches only if both match. +With a named error and messsage specified as a Regexp, matches only if both match. +Pass an optional block to perform extra verifications on the exception matched

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { do_something_risky }.to raise_error
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError)
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError) { |error| expect(error.data).to eq 42 }
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError, "that was too risky")
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError, /oo ri/)
        +
        +expect { do_something_risky }.not_to raise_error
        + +
        + + +
        + + + + +
        +
        +
        +
        +737
        +738
        +739
        +
        +
        # File 'lib/rspec/matchers.rb', line 737
        +
        +def raise_error(error=Exception, message=nil, &block)
        +  BuiltIn::RaiseError.new(error, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) respond_to(*names) + + + + Also known as: + an_object_responding_to, responding_to + + + + +

        +
        +

        Matches if the target object responds to all of the names +provided. Names can be Strings or Symbols.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect("string").to respond_to(:length)
        + +
        + + +
        + + + + +
        +
        +
        +
        +757
        +758
        +759
        +
        +
        # File 'lib/rspec/matchers.rb', line 757
        +
        +def respond_to(*names)
        +  BuiltIn::RespondTo.new(*names)
        +end
        +
        +
        + +
        +

        + + - (Object) satisfy(&block) + + + + Also known as: + an_object_satisfying, satisfying + + + + +

        +
        +

        Passes if the submitted block returns true. Yields target to the +block.

        + +

        Generally speaking, this should be thought of as a last resort when +you can't find any other way to specify the behaviour you wish to +specify.

        + +

        If you do find yourself in such a situation, you could always write +a custom matcher, which would likely make your specs more expressive.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to satisfy { |n| n > 3 }
        + +
        + + +
        + + + + +
        +
        +
        +
        +776
        +777
        +778
        +
        +
        # File 'lib/rspec/matchers.rb', line 776
        +
        +def satisfy(&block)
        +  BuiltIn::Satisfy.new(&block)
        +end
        +
        +
        + +
        +

        + + - (Object) start_with(*expected) + + + + Also known as: + a_collection_starting_with, a_string_starting_with, starting_with + + + + +

        +
        +

        Matches if the actual value starts with the expected value(s). In the +case of a string, matches against the first expected.length characters +of the actual string. In the case of an array, matches against the first +expected.length elements of the actual array.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect("this string").to   start_with "this s"
        +expect([0, 1, 2, 3, 4]).to start_with 0
        +expect([0, 2, 3, 4, 4]).to start_with 0, 1
        + +
        + + +
        + + + + +
        +
        +
        +
        +792
        +793
        +794
        +
        +
        # File 'lib/rspec/matchers.rb', line 792
        +
        +def start_with(*expected)
        +  BuiltIn::StartWith.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) throw_symbol(expected_symbol = nil, expected_arg = nil) + + + + Also known as: + a_block_throwing, throwing + + + + +

        +
        +

        Given no argument, matches if a proc throws any Symbol.

        + +

        Given a Symbol, matches if the given proc throws the specified Symbol.

        + +

        Given a Symbol and an arg, matches if the given proc throws the +specified Symbol with the specified arg.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { do_something_risky }.to throw_symbol
        +expect { do_something_risky }.to throw_symbol(:that_was_risky)
        +expect { do_something_risky }.to throw_symbol(:that_was_risky, 'culprit')
        +
        +expect { do_something_risky }.not_to throw_symbol
        +expect { do_something_risky }.not_to throw_symbol(:that_was_risky)
        +expect { do_something_risky }.not_to throw_symbol(:that_was_risky, 'culprit')
        + +
        + + +
        + + + + +
        +
        +
        +
        +815
        +816
        +817
        +
        +
        # File 'lib/rspec/matchers.rb', line 815
        +
        +def throw_symbol(expected_symbol=nil, expected_arg=nil)
        +  BuiltIn::ThrowSymbol.new(expected_symbol, expected_arg)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_control + + + + Also known as: + a_block_yielding_control, yielding_control + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +

        Passes if the method called in the expect block yields, regardless +of whether or not arguments are yielded.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| 5.tap(&b) }.to yield_control
        +expect { |b| "a".to_sym(&b) }.not_to yield_control
        + +
        + + +
        + + + + +
        +
        +
        +
        +837
        +838
        +839
        +
        +
        # File 'lib/rspec/matchers.rb', line 837
        +
        +def yield_control
        +  BuiltIn::YieldControl.new
        +end
        +
        +
        + +
        +

        + + - (Object) yield_successive_args(*args) + + + + Also known as: + a_block_yielding_successive_args, yielding_successive_args + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +

        Designed for use with methods that repeatedly yield (such as +iterators). Passes if the method called in the expect block yields +multiple times with arguments matching those given.

        + +

        Argument matching is done using === (the case match operator) +and ==. If the expected and actual arguments match with either +operator, the matcher will pass.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +expect { |b| [1, 2, 3].each(&b) }.not_to yield_successive_args(1, 2)
        + +
        + + +
        + + + + +
        +
        +
        +
        +909
        +910
        +911
        +
        +
        # File 'lib/rspec/matchers.rb', line 909
        +
        +def yield_successive_args(*args)
        +  BuiltIn::YieldSuccessiveArgs.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_with_args(*args) + + + + Also known as: + a_block_yielding_with_args, yielding_with_args + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +
        + Note: +

        This matcher is not designed for use with methods that yield +multiple times.

        +
        +
        + +

        Given no arguments, matches if the method called in the expect +block yields with arguments (regardless of what they are or how +many there are).

        + +

        Given arguments, matches if the method called in the expect block +yields with arguments that match the given arguments.

        + +

        Argument matching is done using === (the case match operator) +and ==. If the expected and actual arguments match with either +operator, the matcher will pass.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| 5.tap(&b) }.to yield_with_args # because #tap yields an arg
        +expect { |b| 5.tap(&b) }.to yield_with_args(5) # because 5 == 5
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum) # because Fixnum === 5
        +expect { |b| File.open("f.txt", &b) }.to yield_with_args(/txt/) # because /txt/ === "f.txt"
        +
        +expect { |b| User.transaction(&b) }.not_to yield_with_args # because it yields no args
        +expect { |b| 5.tap(&b) }.not_to yield_with_args(1, 2, 3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +887
        +888
        +889
        +
        +
        # File 'lib/rspec/matchers.rb', line 887
        +
        +def yield_with_args(*args)
        +  BuiltIn::YieldWithArgs.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_with_no_args + + + + Also known as: + a_block_yielding_with_no_args, yielding_with_no_args + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +
        + Note: +

        This matcher is not designed for use with methods that yield +multiple times.

        +
        +
        + +

        Passes if the method called in the expect block yields with +no arguments. Fails if it does not yield, or yields with arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| User.transaction(&b) }.to yield_with_no_args
        +expect { |b| 5.tap(&b) }.not_to yield_with_no_args # because it yields with `5`
        +expect { |b| "a".to_sym(&b) }.not_to yield_with_no_args # because it does not yield
        + +
        + + +
        + + + + +
        +
        +
        +
        +856
        +857
        +858
        +
        +
        # File 'lib/rspec/matchers.rb', line 856
        +
        +def yield_with_no_args
        +  BuiltIn::YieldWithNoArgs.new
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/AliasedMatcher.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/AliasedMatcher.html new file mode 100644 index 000000000..d2bd032c6 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/AliasedMatcher.html @@ -0,0 +1,545 @@ + + + + + + Class: RSpec::Matchers::AliasedMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::AliasedMatcher + + + Private +

        + +
        + +
        Inherits:
        +
        + MatcherDelegator + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/aliased_matcher.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Decorator that wraps a matcher and overrides description +using the provided block in order to support an alias +of a matcher. This is intended for use when composing +matchers, so that you can use an expression like +include( a_value_within(0.1).of(3) ) rather than +include( be_within(0.1).of(3) ), and have the corresponding +description read naturally.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        +
        +

        Constructor Details

        + +
        +

        + + - (AliasedMatcher) initialize(base_matcher, description_block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of AliasedMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/aliased_matcher.rb', line 13
        +
        +def initialize(base_matcher, description_block)
        +  @description_block = description_block
        +  super(base_matcher)
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Forward messages on to the wrapped matcher. +Since many matchers provide a fluent interface +(e.g. a_value_within(0.1).of(3)), we need to wrap +the returned value if it responds to description, +so that our override can be applied when it is eventually +used.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/matchers/aliased_matcher.rb', line 24
        +
        +def method_missing(*)
        +  return_val = super
        +  return return_val unless RSpec::Matchers.is_a_matcher?(return_val)
        +  self.class.new(return_val, @description_block)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Provides the description of the aliased matcher. Aliased matchers +are designed to behave identically to the original matcher except +for the description and failure messages. The description is different +to reflect the aliased name.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/matchers/aliased_matcher.rb', line 36
        +
        +def description
        +  @description_block.call(super)
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Provides the failure_message of the aliased matcher. Aliased matchers +are designed to behave identically to the original matcher except +for the description and failure messages. The failure_message is different +to reflect the aliased name.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/matchers/aliased_matcher.rb', line 46
        +
        +def failure_message
        +  @description_block.call(super)
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Provides the failure_message_when_negated of the aliased matcher. Aliased matchers +are designed to behave identically to the original matcher except +for the description and failure messages. The failure_message_when_negated is different +to reflect the aliased name.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/aliased_matcher.rb', line 56
        +
        +def failure_message_when_negated
        +  @description_block.call(super)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn.html new file mode 100644 index 000000000..4167b610f --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn.html @@ -0,0 +1,133 @@ + + + + + + Module: RSpec::Matchers::BuiltIn + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::BuiltIn + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in.rb,
        + lib/rspec/matchers/built_in/be.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/matchers/built_in/all.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/built_in/output.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/built_in/compound.rb,
        lib/rspec/matchers/built_in/operators.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/be_between.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/matchers/built_in/have_attributes.rb,
        lib/rspec/matchers/built_in/contain_exactly.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        Container module for all built-in matchers. The matcher classes are here +(rather than directly under RSpec::Matchers) in order to prevent name +collisions, since RSpec::Matchers gets included into the user's namespace.

        + +

        Autoloading is used to delay when the matcher classes get loaded, allowing +rspec-matchers to boot faster, and avoiding loading matchers the user is +not using.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: All, BaseMatcher, Be, BeAKindOf, BeAnInstanceOf, BeBetween, BeComparedTo, BeFalsey, BeNil, BePredicate, BeTruthy, BeWithin, Change, ChangeFromValue, ChangeRelatively, ChangeToValue, Compound, ContainExactly, Cover, EndWith, Eq, Eql, Equal, Exist, Has, HaveAttributes, Include, Match, OperatorMatcher, Output, RaiseError, RespondTo, Satisfy, SpecificValuesChange, StartAndEndWith, StartWith, ThrowSymbol, YieldControl, YieldSuccessiveArgs, YieldWithArgs, YieldWithNoArgs + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/All.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/All.html new file mode 100644 index 000000000..1c85cce3d --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/All.html @@ -0,0 +1,454 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::All + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::All + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/all.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for all. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (All) initialize(matcher) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of All

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/built_in/all.rb', line 11
        +
        +def initialize(matcher)
        +  @matcher = matcher
        +  @failed_objects = {}
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/matchers/built_in/all.rb', line 37
        +
        +def description
        +  improve_hash_formatting "all #{description_of matcher}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/matchers/built_in/all.rb', line 23
        +
        +def failure_message
        +  unless iterable?
        +    return "#{improve_hash_formatting(super)}, but was not iterable"
        +  end
        +
        +  all_messages = [improve_hash_formatting(super)]
        +  failed_objects.each do |index, matcher_failure_message|
        +    all_messages << failure_message_for_item(index, matcher_failure_message)
        +  end
        +  all_messages.join("\n\n")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html new file mode 100644 index 000000000..2e1fcb5d3 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html @@ -0,0 +1,799 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BaseMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BaseMatcher + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        DefaultFailureMessages, Composable, Pretty
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/base_matcher.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Used internally as a base class for matchers that ship with +rspec-expectations and rspec-rails.

        + +

        Warning:

        + +

        This class is for internal use, and subject to change without notice. We +strongly recommend that you do not base your custom matchers on this +class. If/when this changes, we will announce it and remove this warning.

        + + +
        +
        +
        + + +
        +

        Defined Under Namespace

        +

        + + + Modules: DefaultFailureMessages + + + + +

        + +

        Constant Summary

        + +
        + +
        UNDEFINED = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        +

        Used to detect when no arg is passed to initialize. +nil cannot be used because it's a valid value to pass.

        + + +
        +
        +
        + + +
        +
        +
        Object.new.freeze
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (BaseMatcher) initialize(expected = UNDEFINED) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of BaseMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 26
        +
        +def initialize(expected=UNDEFINED)
        +  @expected = expected unless UNDEFINED.equal?(expected)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Generates a "pretty" description using the logic in Pretty.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 58
        +
        +def description
        +  return name_to_sentence unless defined?(@expected)
        +  "#{name_to_sentence}#{to_sentence @expected}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Matchers are not diffable by default. Override this to make your +subclass diffable.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 66
        +
        +def diffable?
        +  false
        +end
        +
        +
        + +
        +

        + + - (Boolean) expects_call_stack_jump? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 79
        +
        +def expects_call_stack_jump?
        +  false
        +end
        +
        +
        + +
        +

        + + - (Object) match_unless_raises(*exceptions) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used to wrap a block of code that will indicate failure by +raising one of the named exceptions.

        + +

        This is used by rspec-rails for some of its matchers that +wrap rails' assertions.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 45
        +
        +def match_unless_raises(*exceptions)
        +  exceptions.unshift Exception if exceptions.empty?
        +  begin
        +    yield
        +    true
        +  rescue *exceptions => @rescued_exception
        +    false
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates if the match is successful. Delegates to match, which +should be defined on a subclass. Takes care of consistently +initializing the actual attribute.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 34
        +
        +def matches?(actual)
        +  @actual = actual
        +  match(expected, actual)
        +end
        +
        +
        + +
        +

        + + - (Boolean) supports_block_expectations? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Most matchers are value matchers (i.e. meant to work with expect(value)) +rather than block matchers (i.e. meant to work with expect { }), so +this defaults to false. Block matchers must override this to return true.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +74
        +75
        +76
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 74
        +
        +def supports_block_expectations?
        +  false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher/DefaultFailureMessages.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher/DefaultFailureMessages.html new file mode 100644 index 000000000..3d6e04d46 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher/DefaultFailureMessages.html @@ -0,0 +1,304 @@ + + + + + + Module: RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages + + + Private +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec::Matchers::BuiltIn::BaseMatcher, DSL::DefaultImplementations
        + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/base_matcher.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Provides default implementations of failure messages, based on the description.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Provides a good generic failure message. Based on description. +When subclassing, if you are not satisfied with this failure message +you often only need to override description.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +106
        +107
        +108
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 106
        +
        +def failure_message
        +  "expected #{actual.inspect} to #{description}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Provides a good generic negative failure message. Based on description. +When subclassing, if you are not satisfied with this failure message +you often only need to override description.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +115
        +116
        +117
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 115
        +
        +def failure_message_when_negated
        +  "expected #{actual.inspect} not to #{description}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html new file mode 100644 index 000000000..3d95c2d33 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html @@ -0,0 +1,437 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Be + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Be + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for be. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (Be) initialize(*args) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Be

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 104
        +
        +def initialize(*args)
        +  @args = args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 110
        +
        +def failure_message
        +  "expected #{@actual.inspect} to evaluate to true"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +116
        +117
        +118
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 116
        +
        +def failure_message_when_negated
        +  "expected #{@actual.inspect} to evaluate to false"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html new file mode 100644 index 000000000..191f029ed --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html @@ -0,0 +1,196 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeAKindOf + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeAKindOf + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_kind_of.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for be_a_kind_of. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html new file mode 100644 index 000000000..745d27623 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html @@ -0,0 +1,291 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeAnInstanceOf + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeAnInstanceOf + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_instance_of.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for be_an_instance_of. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/be_instance_of.rb', line 10
        +
        +def description
        +  "be an instance of #{expected}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeBetween.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeBetween.html new file mode 100644 index 000000000..2ea9e0257 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeBetween.html @@ -0,0 +1,684 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeBetween + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeBetween + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_between.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for be_between. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages

        +

        #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (BeBetween) initialize(min, max) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of BeBetween

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/be_between.rb', line 8
        +
        +def initialize(min, max)
        +  @min, @max = min, max
        +  inclusive
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/matchers/built_in/be_between.rb', line 57
        +
        +def description
        +  "be between #{@min.inspect} and #{@max.inspect} (#{@mode})"
        +end
        +
        +
        + +
        +

        + + - (Object) exclusive + + + + + +

        +
        +

        Makes the between comparison exclusive.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(3).to be_between(2, 4).exclusive
        + +
        + + +
        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/matchers/built_in/be_between.rb', line 33
        +
        +def exclusive
        +  @less_than_operator = :<
        +  @greater_than_operator = :>
        +  @mode = :exclusive
        +  self
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/matchers/built_in/be_between.rb', line 51
        +
        +def failure_message
        +  "#{super}#{not_comparable_clause}"
        +end
        +
        +
        + +
        +

        + + - (Object) inclusive + + + + + +

        +
        + +
        + Note: +

        The matcher is inclusive by default; this simply provides +a way to be more explicit about it.

        +
        +
        + +

        Makes the between comparison inclusive.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(3).to be_between(2, 3).inclusive
        + +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/matchers/built_in/be_between.rb', line 21
        +
        +def inclusive
        +  @less_than_operator = :<=
        +  @greater_than_operator = :>=
        +  @mode = :inclusive
        +  self
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/matchers/built_in/be_between.rb', line 42
        +
        +def matches?(actual)
        +  @actual = actual
        +  comparable? && compare
        +rescue ArgumentError
        +  false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html new file mode 100644 index 000000000..d792e21b4 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html @@ -0,0 +1,607 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeComparedTo + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeComparedTo + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation of be <operator> value. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (BeComparedTo) initialize(operand, operator) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of BeComparedTo

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +142
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 139
        +
        +def initialize(operand, operator)
        +  @expected, @operator = operand, operator
        +  @args = []
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +168
        +169
        +170
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 168
        +
        +def description
        +  "be #{@operator} #{expected_to_sentence}#{args_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +151
        +152
        +153
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 151
        +
        +def failure_message
        +  "expected: #{@operator} #{@expected.inspect}\n     got: #{@operator.to_s.gsub(/./, ' ')} #{@actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 157
        +
        +def failure_message_when_negated
        +  message = "`expect(#{@actual.inspect}).not_to be #{@operator} #{@expected.inspect}`"
        +  if [:<, :>, :<=, :>=].include?(@operator)
        +    message + " not only FAILED, it is a bit confusing."
        +  else
        +    message
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +144
        +145
        +146
        +147
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 144
        +
        +def matches?(actual)
        +  @actual = actual
        +  @actual.__send__ @operator, @expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalsey.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalsey.html new file mode 100644 index 000000000..9aef0d59b --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalsey.html @@ -0,0 +1,364 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeFalsey + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeFalsey + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for be_falsey. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 33
        +
        +def failure_message
        +  "expected: falsey value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 39
        +
        +def failure_message_when_negated
        +  "expected: truthy value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html new file mode 100644 index 000000000..a21ce262c --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html @@ -0,0 +1,364 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeNil + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeNil + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for be_nil. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 56
        +
        +def failure_message
        +  "expected: nil\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 62
        +
        +def failure_message_when_negated
        +  "expected: not nil\n     got: nil"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html new file mode 100644 index 000000000..48b5b01f5 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html @@ -0,0 +1,683 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BePredicate + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BePredicate + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation of be_<predicate>. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (BePredicate) initialize(*args, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of BePredicate

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +179
        +180
        +181
        +182
        +183
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 179
        +
        +def initialize(*args, &block)
        +  @expected = parse_expected(args.shift)
        +  @args = args
        +  @block = block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +211
        +212
        +213
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 211
        +
        +def description
        +  "#{prefix_to_sentence}#{expected_to_sentence}#{args_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +191
        +192
        +193
        +194
        +195
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 191
        +
        +def does_not_match?(actual, &block)
        +  @actual  = actual
        +  @block ||= block
        +  predicate_accessible? && !predicate_matches?
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +199
        +200
        +201
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 199
        +
        +def failure_message
        +  failure_message_expecting(true)
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +205
        +206
        +207
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 205
        +
        +def failure_message_when_negated
        +  failure_message_expecting(false)
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +185
        +186
        +187
        +188
        +189
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 185
        +
        +def matches?(actual, &block)
        +  @actual  = actual
        +  @block ||= block
        +  predicate_accessible? && predicate_matches?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeTruthy.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeTruthy.html new file mode 100644 index 000000000..420b280ef --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeTruthy.html @@ -0,0 +1,364 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeTruthy + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeTruthy + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for be_truthy. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 10
        +
        +def failure_message
        +  "expected: truthy value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 16
        +
        +def failure_message_when_negated
        +  "expected: falsey value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html new file mode 100644 index 000000000..6e204179d --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html @@ -0,0 +1,648 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeWithin + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeWithin + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_within.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for be_within. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (BeWithin) initialize(delta) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of BeWithin

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 8
        +
        +def initialize(delta)
        +  @delta = delta
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +52
        +53
        +54
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 52
        +
        +def description
        +  "be within #{@delta}#{@unit} of #{@expected}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 40
        +
        +def failure_message
        +  "expected #{@actual.inspect} to #{description}#{not_numeric_clause}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 46
        +
        +def failure_message_when_negated
        +  "expected #{@actual.inspect} not to #{description}"
        +end
        +
        +
        + +
        +

        + + - (Object) of(expected) + + + + + +

        +
        +

        Sets the expected value.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 14
        +
        +def of(expected)
        +  @expected  = expected
        +  @tolerance = @delta
        +  @unit      = ''
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) percent_of(expected) + + + + + +

        +
        +

        Sets the expected value, and makes the matcher do +a percent comparison.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 24
        +
        +def percent_of(expected)
        +  @expected  = expected
        +  @tolerance = @delta * @expected.abs / 100.0
        +  @unit      = '%'
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html new file mode 100644 index 000000000..7f7af4d6e --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html @@ -0,0 +1,843 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Change + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Change + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/change.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for change. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) by(expected_delta) + + + + + +

        +
        +

        Specifies the delta of the expected change.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 10
        +
        +def by(expected_delta)
        +  ChangeRelatively.new(@change_details, expected_delta, :by) do |actual_delta|
        +    values_match?(expected_delta, actual_delta)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) by_at_least(minimum) + + + + + +

        +
        +

        Specifies a minimum delta of the expected change.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 18
        +
        +def by_at_least(minimum)
        +  ChangeRelatively.new(@change_details, minimum, :by_at_least) do |actual_delta|
        +    actual_delta >= minimum
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) by_at_most(maximum) + + + + + +

        +
        +

        Specifies a maximum delta of the expected change.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 26
        +
        +def by_at_most(maximum)
        +  ChangeRelatively.new(@change_details, maximum, :by_at_most) do |actual_delta|
        +    actual_delta <= maximum
        +  end
        +end
        +
        +
        + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 72
        +
        +def description
        +  "change #{@change_details.message}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(event_proc) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +56
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 53
        +
        +def does_not_match?(event_proc)
        +  raise_block_syntax_error if block_given?
        +  !matches?(event_proc) && Proc === event_proc
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 60
        +
        +def failure_message
        +  "expected #{@change_details.message} to have changed, but #{positive_failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 66
        +
        +def failure_message_when_negated
        +  "expected #{@change_details.message} not to have changed, but #{negative_failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (Object) from(value) + + + + + +

        +
        +

        Specifies the original value.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 40
        +
        +def from(value)
        +  ChangeFromValue.new(@change_details, value)
        +end
        +
        +
        + +
        +

        + + - (Object) to(value) + + + + + +

        +
        +

        Specifies the new value you expect.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 34
        +
        +def to(value)
        +  ChangeToValue.new(@change_details, value)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeFromValue.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeFromValue.html new file mode 100644 index 000000000..04c22f760 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeFromValue.html @@ -0,0 +1,357 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::ChangeFromValue + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::ChangeFromValue + + + Private +

        + +
        + +
        Inherits:
        +
        + SpecificValuesChange + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/change.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Used to specify a change from a specific value +(and, optionally, to a specific value).

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (ChangeFromValue) initialize(change_details, expected_before) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of ChangeFromValue

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +222
        +223
        +224
        +225
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 222
        +
        +def initialize(change_details, expected_before)
        +  @description_suffix = nil
        +  super(change_details, expected_before, MATCH_ANYTHING)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) to(value) + + + + + +

        +
        +

        Specifies the new value you expect.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +229
        +230
        +231
        +232
        +233
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 229
        +
        +def to(value)
        +  @expected_after     = value
        +  @description_suffix = " to #{description_of value}"
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeRelatively.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeRelatively.html new file mode 100644 index 000000000..0570b82fc --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeRelatively.html @@ -0,0 +1,279 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::ChangeRelatively + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::ChangeRelatively + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/change.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Used to specify a relative change.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (ChangeRelatively) initialize(change_details, expected_delta, relativity, &comparer) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of ChangeRelatively

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +106
        +107
        +108
        +109
        +110
        +111
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 106
        +
        +def initialize(change_details, expected_delta, relativity, &comparer)
        +  @change_details = change_details
        +  @expected_delta = expected_delta
        +  @relativity     = relativity
        +  @comparer       = comparer
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeToValue.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeToValue.html new file mode 100644 index 000000000..5dac423a3 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ChangeToValue.html @@ -0,0 +1,357 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::ChangeToValue + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::ChangeToValue + + + Private +

        + +
        + +
        Inherits:
        +
        + SpecificValuesChange + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/change.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Used to specify a change to a specific value +(and, optionally, from a specific value).

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (ChangeToValue) initialize(change_details, expected_after) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of ChangeToValue

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +265
        +266
        +267
        +268
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 265
        +
        +def initialize(change_details, expected_after)
        +  @description_suffix = nil
        +  super(change_details, MATCH_ANYTHING, expected_after)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) from(value) + + + + + +

        +
        +

        Specifies the original value.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +272
        +273
        +274
        +275
        +276
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 272
        +
        +def from(value)
        +  @expected_before    = value
        +  @description_suffix = " from #{description_of value}"
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound.html new file mode 100644 index 000000000..2e514d108 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound.html @@ -0,0 +1,533 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Compound + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Compound + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/compound.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Base class for and and or compound matchers.

        + + +
        +
        +
        + + +
        +

        Direct Known Subclasses

        +

        And, Or

        +
        +

        Defined Under Namespace

        +

        + + + + + Classes: And, NestedEvaluator, Or, SequentialEvaluator + + +

        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (Compound) initialize(matcher_1, matcher_2) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Compound

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 10
        +
        +def initialize(matcher_1, matcher_2)
        +  @matcher_1 = matcher_1
        +  @matcher_2 = matcher_2
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 25
        +
        +def description
        +  singleline_message(matcher_1.description, matcher_2.description)
        +end
        +
        +
        + +
        +

        + + - (Boolean) expects_call_stack_jump? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 34
        +
        +def expects_call_stack_jump?
        +  NestedEvaluator.matcher_expects_call_stack_jump?(matcher_1) ||
        +  NestedEvaluator.matcher_expects_call_stack_jump?(matcher_2)
        +end
        +
        +
        + +
        +

        + + - (Boolean) supports_block_expectations? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 29
        +
        +def supports_block_expectations?
        +  matcher_supports_block_expectations?(matcher_1) &&
        +  matcher_supports_block_expectations?(matcher_2)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/And.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/And.html new file mode 100644 index 000000000..bf484b17b --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/And.html @@ -0,0 +1,311 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Compound::And + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Compound::And + + + +

        + +
        + +
        Inherits:
        +
        + RSpec::Matchers::BuiltIn::Compound + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/compound.rb
        + +
        +
        + +

        Overview

        +
        +

        Matcher used to represent a compound and expectation.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from RSpec::Matchers::BuiltIn::Compound

        +

        #description, #expects_call_stack_jump?, #initialize, #supports_block_expectations?

        + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::Compound

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +213
        +214
        +215
        +216
        +217
        +218
        +219
        +220
        +221
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 213
        +
        +def failure_message
        +  if matcher_1_matches?
        +    matcher_2.failure_message
        +  elsif matcher_2_matches?
        +    matcher_1.failure_message
        +  else
        +    compound_failure_message
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/NestedEvaluator.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/NestedEvaluator.html new file mode 100644 index 000000000..0660071b0 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/NestedEvaluator.html @@ -0,0 +1,333 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Compound::NestedEvaluator + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Compound::NestedEvaluator + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/compound.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Normally, we evaluate the matching sequentially. For an expression like +expect(x).to foo.and bar, this becomes:

        + +

        expect(x).to foo + expect(x).to bar

        + +

        For block expectations, we need to nest them instead, so that +expect { x }.to foo.and bar becomes:

        + +

        expect { + expect { x }.to foo + }.to bar

        + +

        This is necessary so that the expect block is only executed once.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (NestedEvaluator) initialize(actual, matcher_1, matcher_2) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of NestedEvaluator

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +130
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +138
        +139
        +140
        +141
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 130
        +
        +def initialize(actual, matcher_1, matcher_2)
        +  @actual        = actual
        +  @matcher_1     = matcher_1
        +  @matcher_2     = matcher_2
        +  @match_results = {}
        +
        +  inner, outer = order_block_matchers
        +
        +  @match_results[outer] = outer.matches?(Proc.new do |*args|
        +    @match_results[inner] = inner.matches?(inner_matcher_block(args))
        +  end)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) matcher_matches?(matcher) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +143
        +144
        +145
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 143
        +
        +def matcher_matches?(matcher)
        +  @match_results.fetch(matcher)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/Or.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/Or.html new file mode 100644 index 000000000..699eade47 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/Or.html @@ -0,0 +1,299 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Compound::Or + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Compound::Or + + + +

        + +
        + +
        Inherits:
        +
        + RSpec::Matchers::BuiltIn::Compound + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/compound.rb
        + +
        +
        + +

        Overview

        +
        +

        Matcher used to represent a compound or expectation.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from RSpec::Matchers::BuiltIn::Compound

        +

        #description, #expects_call_stack_jump?, #initialize, #supports_block_expectations?

        + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::Compound

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +240
        +241
        +242
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 240
        +
        +def failure_message
        +  compound_failure_message
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/SequentialEvaluator.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/SequentialEvaluator.html new file mode 100644 index 000000000..3c1bd3ab5 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Compound/SequentialEvaluator.html @@ -0,0 +1,302 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Compound::SequentialEvaluator + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Compound::SequentialEvaluator + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/compound.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        For value expectations, we can evaluate the matchers sequentially.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (SequentialEvaluator) initialize(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of SequentialEvaluator

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +106
        +107
        +108
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 106
        +
        +def initialize(actual, *)
        +  @actual = actual
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) matcher_matches?(matcher) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/matchers/built_in/compound.rb', line 110
        +
        +def matcher_matches?(matcher)
        +  matcher.matches?(@actual)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ContainExactly.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ContainExactly.html new file mode 100644 index 000000000..3a14f85b9 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ContainExactly.html @@ -0,0 +1,460 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::ContainExactly + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::ContainExactly + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/contain_exactly.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for contain_exactly and match_array. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/matchers/built_in/contain_exactly.rb', line 31
        +
        +def description
        +  "contain exactly#{to_sentence(surface_descriptions_in expected)}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/contain_exactly.rb', line 10
        +
        +def failure_message
        +  if Array === actual
        +    message  = "expected collection contained:  #{safe_sort(surface_descriptions_in expected).inspect}\n"
        +    message += "actual collection contained:    #{safe_sort(actual).inspect}\n"
        +    message += "the missing elements were:      #{safe_sort(surface_descriptions_in missing_items).inspect}\n" unless missing_items.empty?
        +    message += "the extra elements were:        #{safe_sort(extra_items).inspect}\n" unless extra_items.empty?
        +    message
        +  else
        +    "expected a collection that can be converted to an array with " \
        +    "`#to_ary` or `#to_a`, but got #{actual.inspect}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/contain_exactly.rb', line 25
        +
        +def failure_message_when_negated
        +  "expected #{actual.inspect} not to contain exactly#{to_sentence(surface_descriptions_in expected)}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html new file mode 100644 index 000000000..6f3124c17 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html @@ -0,0 +1,440 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Cover + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Cover + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/cover.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for cover. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (Cover) initialize(*expected) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Cover

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 8
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) does_not_match?(range) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 17
        +
        +def does_not_match?(range)
        +  @actual = range
        +  expected.none? { |e| range.cover?(e) }
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(range) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 12
        +
        +def matches?(range)
        +  @actual = range
        +  @expected.all? { |e| range.cover?(e) }
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html new file mode 100644 index 000000000..4e8e907cf --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html @@ -0,0 +1,209 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::EndWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::EndWith + + + Private +

        + +
        + +
        Inherits:
        +
        + StartAndEndWith + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for end_with. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from StartAndEndWith

        +

        #description, #failure_message, #initialize

        + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::StartAndEndWith

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html new file mode 100644 index 000000000..b8db27ab3 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html @@ -0,0 +1,520 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Eq + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Eq + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/eq.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for eq. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 22
        +
        +def description
        +  "#{name_to_sentence} #{@expected.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 28
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 10
        +
        +def failure_message
        +  "\nexpected: #{format_object(expected)}\n     got: #{format_object(actual)}\n\n(compared using ==)\n"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 16
        +
        +def failure_message_when_negated
        +  "\nexpected: value != #{format_object(expected)}\n     got: #{format_object(actual)}\n\n(compared using ==)\n"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html new file mode 100644 index 000000000..4d4431fb0 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html @@ -0,0 +1,442 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Eql + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Eql + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/eql.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for eql. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 22
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 10
        +
        +def failure_message
        +  "\nexpected: #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 16
        +
        +def failure_message_when_negated
        +  "\nexpected: value != #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html new file mode 100644 index 000000000..c9469a749 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html @@ -0,0 +1,464 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Equal + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Equal + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/equal.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for equal. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 33
        +
        +def diffable?
        +  !expected_is_a_literal_singleton?
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 10
        +
        +def failure_message
        +  if expected_is_a_literal_singleton?
        +    simple_failure_message
        +  else
        +    detailed_failure_message
        +  end
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 20
        +
        +def failure_message_when_negated
        +  <<-MESSAGE
        +
        +expected not #{inspect_object(actual)}
        + got #{inspect_object(expected)}
        +
        +Compared using equal?, which compares object identity.
        +
        +MESSAGE
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html new file mode 100644 index 000000000..fabbb3759 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html @@ -0,0 +1,605 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Exist + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Exist + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/exist.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for exist. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: ExistenceTest + + +

        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (Exist) initialize(*expected) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Exist

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 8
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 22
        +
        +def does_not_match?(actual)
        +  @actual = actual
        +  @test = ExistenceTest.new @actual, @expected
        +  @test.valid_test? && !@test.actual_exists?
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 30
        +
        +def failure_message
        +  "expected #{@actual.inspect} to exist#{@test.validity_message}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 36
        +
        +def failure_message_when_negated
        +  "expected #{@actual.inspect} not to exist#{@test.validity_message}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 14
        +
        +def matches?(actual)
        +  @actual = actual
        +  @test = ExistenceTest.new @actual, @expected
        +  @test.valid_test? && @test.actual_exists?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Exist/ExistenceTest.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Exist/ExistenceTest.html new file mode 100644 index 000000000..99f196d76 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Exist/ExistenceTest.html @@ -0,0 +1,583 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Exist::ExistenceTest + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Exist::ExistenceTest + + + Private +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/exist.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Simple class for memoizing actual/expected for this matcher +and examining the match

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) actual + + + + + + + + + + + + + + + + +

          Returns the value of attribute actual.

          +
          + +
        • + + +
        • + + + - (Object) expected + + + + + + + + + + + + + + + + +

          Returns the value of attribute expected.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) actual + + + + + +

        +
        +

        Returns the value of attribute actual

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of actual

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 43
        +
        +def actual
        +  @actual
        +end
        +
        +
        + + + +
        +

        + + - (Object) expected + + + + + +

        +
        +

        Returns the value of attribute expected

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +

          the current value of expected

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 43
        +
        +def expected
        +  @expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) actual_exists? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +52
        +53
        +54
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 52
        +
        +def actual_exists?
        +  existence_values.first
        +end
        +
        +
        + +
        +

        + + - (Boolean) valid_test? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 46
        +
        +def valid_test?
        +  uniq_truthy_values.size == 1
        +end
        +
        +
        + +
        +

        + + - (String) validity_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 58
        +
        +def validity_message
        +  case uniq_truthy_values.size
        +  when 0
        +    " but it does not respond to either `exist?` or `exists?`"
        +  when 2
        +    " but `exist?` and `exists?` returned different values:\n\n"\
        +    " exist?: #{existence_values.first}\n"\
        +    "exists?: #{existence_values.last}"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html new file mode 100644 index 000000000..be7d076c6 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html @@ -0,0 +1,509 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Has + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Has + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/has.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for has_<predicate>. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (Has) initialize(method_name, *args, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Has

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 8
        +
        +def initialize(method_name, *args, &block)
        +  @method_name, @args, @block = method_name, args, block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 40
        +
        +def description
        +  [method_description, args_description].compact.join(' ')
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 28
        +
        +def failure_message
        +  validity_message || "expected ##{predicate}#{failure_message_args_description} to return true, got false"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 34
        +
        +def failure_message_when_negated
        +  validity_message || "expected ##{predicate}#{failure_message_args_description} to return false, got true"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/HaveAttributes.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/HaveAttributes.html new file mode 100644 index 000000000..ac68ae073 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/HaveAttributes.html @@ -0,0 +1,767 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::HaveAttributes + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::HaveAttributes + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/have_attributes.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for have_attributes. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (HaveAttributes) initialize(expected) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of HaveAttributes

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/built_in/have_attributes.rb', line 11
        +
        +def initialize(expected)
        +  @expected = expected
        +  @values = {}
        +  @respond_to_failed = false
        +  @negated = false
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +46
        +
        +
        # File 'lib/rspec/matchers/built_in/have_attributes.rb', line 43
        +
        +def description
        +  described_items = surface_descriptions_in(expected)
        +  improve_hash_formatting "have attributes #{described_items.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/matchers/built_in/have_attributes.rb', line 50
        +
        +def diffable?
        +  !@respond_to_failed && !@negated
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/matchers/built_in/have_attributes.rb', line 34
        +
        +def does_not_match?(actual)
        +  @actual = actual
        +  @negated = true
        +  return false unless respond_to_attributes?
        +  perform_match(:none?)
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +59
        +60
        +
        +
        # File 'lib/rspec/matchers/built_in/have_attributes.rb', line 56
        +
        +def failure_message
        +  respond_to_failure_message_or do
        +    "expected #{@actual.inspect} to #{description} but had attributes #{ formatted_values }"
        +  end
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/matchers/built_in/have_attributes.rb', line 64
        +
        +def failure_message_when_negated
        +  respond_to_failure_message_or { "expected #{@actual.inspect} not to #{description}" }
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/have_attributes.rb', line 25
        +
        +def matches?(actual)
        +  @actual = actual
        +  @negated = false
        +  return false unless respond_to_attributes?
        +  perform_match(:all?)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html new file mode 100644 index 000000000..8c52b3f7b --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html @@ -0,0 +1,749 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Include + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Include + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/include.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for include. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (Include) initialize(*expected) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Include

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 8
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 28
        +
        +def description
        +  described_items = surface_descriptions_in(expected)
        +  improve_hash_formatting "include#{to_sentence(described_items)}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 47
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 21
        +
        +def does_not_match?(actual)
        +  @actual = actual
        +  perform_match(:none?, :any?)
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 35
        +
        +def failure_message
        +  improve_hash_formatting(super) + invalid_object_message
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 41
        +
        +def failure_message_when_negated
        +  improve_hash_formatting(super) + invalid_object_message
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 14
        +
        +def matches?(actual)
        +  @actual = actual
        +  perform_match(:all?, :all?)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html new file mode 100644 index 000000000..1d9174346 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html @@ -0,0 +1,369 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Match + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Match + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/match.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for match. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/match.rb', line 10
        +
        +def description
        +  "match #{surface_descriptions_in(expected).inspect}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/match.rb', line 16
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/OperatorMatcher.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/OperatorMatcher.html new file mode 100644 index 000000000..cf4391b40 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/OperatorMatcher.html @@ -0,0 +1,304 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::OperatorMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::OperatorMatcher + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/operators.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for operator matchers. +Not intended to be instantiated directly. +Only available for use with should.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (OperatorMatcher) initialize(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of OperatorMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/matchers/built_in/operators.rb', line 41
        +
        +def initialize(actual)
        +  @actual = actual
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/matchers/built_in/operators.rb', line 76
        +
        +def description
        +  "#{@operator} #{@expected.inspect}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Output.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Output.html new file mode 100644 index 000000000..5f0ea25ec --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Output.html @@ -0,0 +1,973 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Output + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Output + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/output.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for output. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #expects_call_stack_jump?, #match_unless_raises

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (Output) initialize(expected) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Output

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 10
        +
        +def initialize(expected)
        +  @expected        = expected
        +  @actual          = ""
        +  @block           = nil
        +  @stream_capturer = NullCapture
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 56
        +
        +def description
        +  if @expected
        +    "output #{description_of @expected} to #{@stream_capturer.name}"
        +  else
        +    "output to #{@stream_capturer.name}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 66
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 24
        +
        +def does_not_match?(block)
        +  !matches?(block) && Proc === block
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +44
        +45
        +46
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 44
        +
        +def failure_message
        +  "expected block to #{description}, but #{positive_failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 50
        +
        +def failure_message_when_negated
        +  "expected block to not #{description}, but #{negative_failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 17
        +
        +def matches?(block)
        +  @block = block
        +  return false unless Proc === block
        +  @actual = @stream_capturer.capture(block)
        +  @expected ? values_match?(@expected, @actual) : captured?
        +end
        +
        +
        + +
        +

        + + - (True) supports_block_expectations? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates this matcher matches against a block.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (True) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 73
        +
        +def supports_block_expectations?
        +  true
        +end
        +
        +
        + +
        +

        + + - (Object) to_stderr + + + + + +

        +
        +

        Tells the matcher to match against stderr.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 37
        +
        +def to_stderr
        +  @stream_capturer = CaptureStderr
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) to_stdout + + + + + +

        +
        +

        Tells the matcher to match against stdout.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/matchers/built_in/output.rb', line 30
        +
        +def to_stdout
        +  @stream_capturer = CaptureStdout
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html new file mode 100644 index 000000000..68ecabc65 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html @@ -0,0 +1,634 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::RaiseError + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::RaiseError + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Composable
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/raise_error.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for raise_error. +Not intended to be instantiated directly. +rubocop:disable ClassLength

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        +
        +

        Constructor Details

        + +
        +

        + + - (RaiseError) initialize(expected_error_or_message = Exception, expected_message = nil, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of RaiseError

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 11
        +
        +def initialize(expected_error_or_message=Exception, expected_message=nil, &block)
        +  @block = block
        +  @actual_error = nil
        +  case expected_error_or_message
        +  when String, Regexp
        +    @expected_error, @expected_message = Exception, expected_error_or_message
        +  else
        +    @expected_error, @expected_message = expected_error_or_message, expected_message
        +  end
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +88
        +89
        +90
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 88
        +
        +def description
        +  "raise #{expected_error}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) expects_call_stack_jump? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 70
        +
        +def expects_call_stack_jump?
        +  true
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 76
        +
        +def failure_message
        +  @eval_block ? @actual_error.message : "expected #{expected_error}#{given_error}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 82
        +
        +def failure_message_when_negated
        +  "expected no #{expected_error}#{given_error}"
        +end
        +
        +
        + +
        +

        + + - (Object) with_message(expected_message) + + + + + +

        +
        +

        Specifies the expected error message.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 24
        +
        +def with_message(expected_message)
        +  raise_message_already_set if @expected_message
        +  @expected_message = expected_message
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html new file mode 100644 index 000000000..166421e81 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html @@ -0,0 +1,661 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::RespondTo + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::RespondTo + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/respond_to.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for respond_to. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (RespondTo) initialize(*names) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of RespondTo

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 10
        +
        +def initialize(*names)
        +  @names = names
        +  @expected_arity = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) argument + + + + Also known as: + arguments + + + + +

        +
        +

        No-op. Intended to be used as syntactic sugar when using with.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(obj).to respond_to(:message).with(3).arguments
        + +
        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 30
        +
        +def argument
        +  self
        +end
        +
        +
        + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 59
        +
        +def description
        +  "respond to #{pp_names}#{with_arity}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 47
        +
        +def failure_message
        +  "expected #{@actual.inspect} to respond to #{@failing_method_names.map { |name| name.inspect }.join(', ')}#{with_arity}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 53
        +
        +def failure_message_when_negated
        +  failure_message.sub(/to respond to/, 'not to respond to')
        +end
        +
        +
        + +
        +

        + + - (Object) with(n) + + + + + +

        +
        +

        Specifies the number of expected arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(obj).to respond_to(:message).with(3).arguments
        + +
        + + +
        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 20
        +
        +def with(n)
        +  @expected_arity = n
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html new file mode 100644 index 000000000..3c5b41b90 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html @@ -0,0 +1,509 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Satisfy + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Satisfy + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/satisfy.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for satisfy. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (Satisfy) initialize(&block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Satisfy

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 8
        +
        +def initialize(&block)
        +  @block = block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 33
        +
        +def description
        +  "satisfy block"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 21
        +
        +def failure_message
        +  "expected #{@actual} to satisfy block"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 27
        +
        +def failure_message_when_negated
        +  "expected #{@actual} not to satisfy block"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/SpecificValuesChange.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/SpecificValuesChange.html new file mode 100644 index 000000000..0e6587407 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/SpecificValuesChange.html @@ -0,0 +1,281 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::SpecificValuesChange + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::SpecificValuesChange + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/change.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Base class for specifying a change from and/or to specific values.

        + + +
        +
        +
        + + +
        +

        Direct Known Subclasses

        +

        ChangeFromValue, ChangeToValue

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (SpecificValuesChange) initialize(change_details, from, to) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of SpecificValuesChange

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +155
        +156
        +157
        +158
        +159
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 155
        +
        +def initialize(change_details, from, to)
        +  @change_details  = change_details
        +  @expected_before = from
        +  @expected_after  = to
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html new file mode 100644 index 000000000..b4444e770 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html @@ -0,0 +1,456 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::StartAndEndWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::StartAndEndWith + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Base class for the end_with and start_with matchers. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Direct Known Subclasses

        +

        EndWith, StartWith

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (StartAndEndWith) initialize(*expected) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of StartAndEndWith

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 8
        +
        +def initialize(*expected)
        +  @actual_does_not_have_ordered_elements = false
        +  @expected = expected.length == 1 ? expected.first : expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 27
        +
        +def description
        +  return super unless Hash === expected
        +  "#{name_to_sentence} #{surface_descriptions_in(expected).inspect}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 15
        +
        +def failure_message
        +  super.tap do |msg|
        +    if @actual_does_not_have_ordered_elements
        +      msg << ", but it does not have ordered elements"
        +    elsif !actual.respond_to?(:[])
        +      msg << ", but it cannot be indexed using #[]"
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html new file mode 100644 index 000000000..142485b20 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html @@ -0,0 +1,209 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::StartWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::StartWith + + + Private +

        + +
        + +
        Inherits:
        +
        + StartAndEndWith + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for start_with. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from StartAndEndWith

        +

        #description, #failure_message, #initialize

        + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::StartAndEndWith

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html new file mode 100644 index 000000000..970dcae9d --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html @@ -0,0 +1,716 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::ThrowSymbol + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::ThrowSymbol + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Composable
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/throw_symbol.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for throw_symbol. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        +
        +

        Constructor Details

        + +
        +

        + + - (ThrowSymbol) initialize(expected_symbol = nil, expected_arg = nil) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of ThrowSymbol

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 10
        +
        +def initialize(expected_symbol=nil, expected_arg=nil)
        +  @expected_symbol = expected_symbol
        +  @expected_arg = expected_arg
        +  @caught_symbol = @caught_arg = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 86
        +
        +def description
        +  "throw #{expected}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(given_proc) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        rubocop:enable MethodLength

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 68
        +
        +def does_not_match?(given_proc)
        +  !matches?(given_proc) && Proc === given_proc
        +end
        +
        +
        + +
        +

        + + - (Boolean) expects_call_stack_jump? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 97
        +
        +def expects_call_stack_jump?
        +  true
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +74
        +75
        +76
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 74
        +
        +def failure_message
        +  "expected #{expected} to be thrown, #{actual_result}"
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 80
        +
        +def failure_message_when_negated
        +  "expected #{expected('no Symbol')}#{' not' if @expected_symbol} to be thrown, #{actual_result}"
        +end
        +
        +
        + +
        +

        + + - (True) supports_block_expectations? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates this matcher matches against a block.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (True) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +93
        +94
        +95
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 93
        +
        +def supports_block_expectations?
        +  true
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html new file mode 100644 index 000000000..c5e34d2ee --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html @@ -0,0 +1,884 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldControl + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldControl + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for yield_control. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #match_unless_raises

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (YieldControl) initialize + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of YieldControl

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +96
        +97
        +98
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 96
        +
        +def initialize
        +  at_least(:once)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) at_least(number) + + + + + +

        +
        +

        Specifies the minimum number of times the method is expected to yield

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +137
        +138
        +139
        +140
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 137
        +
        +def at_least(number)
        +  set_expected_yields_count(:>=, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) at_most(number) + + + + + +

        +
        +

        Specifies the maximum number of times the method is expected to yield

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +130
        +131
        +132
        +133
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 130
        +
        +def at_most(number)
        +  set_expected_yields_count(:<=, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) exactly(number) + + + + + +

        +
        +

        Specifies that the method is expected to yield the given number of times.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 123
        +
        +def exactly(number)
        +  set_expected_yields_count(:==, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +163
        +164
        +165
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 163
        +
        +def failure_message
        +  'expected given block to yield control' + failure_reason
        +end
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 169
        +
        +def failure_message_when_negated
        +  'expected given block not to yield control' + failure_reason
        +end
        +
        +
        + +
        +

        + + - (Object) once + + + + + +

        +
        +

        Specifies that the method is expected to yield once.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +102
        +103
        +104
        +105
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 102
        +
        +def once
        +  exactly(1)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) thrice + + + + + +

        +
        +

        Specifies that the method is expected to yield thrice.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +116
        +117
        +118
        +119
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 116
        +
        +def thrice
        +  exactly(3)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) times + + + + + +

        +
        +

        No-op. Provides syntactic sugar.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +144
        +145
        +146
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 144
        +
        +def times
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) twice + + + + + +

        +
        +

        Specifies that the method is expected to yield twice.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +109
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 109
        +
        +def twice
        +  exactly(2)
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html new file mode 100644 index 000000000..002d451a3 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html @@ -0,0 +1,353 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for yield_successive_args. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (YieldSuccessiveArgs) initialize(*args) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of YieldSuccessiveArgs

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +350
        +351
        +352
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 350
        +
        +def initialize(*args)
        +  @expected = args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) does_not_match?(block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +362
        +363
        +364
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 362
        +
        +def does_not_match?(block)
        +  !matches?(block) && @probe.has_block?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html new file mode 100644 index 000000000..e1581256d --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html @@ -0,0 +1,269 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldWithArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldWithArgs + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for yield_with_args. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #expects_call_stack_jump?, #match_unless_raises

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +
        +

        + + - (YieldWithArgs) initialize(*args) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of YieldWithArgs

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +263
        +264
        +265
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 263
        +
        +def initialize(*args)
        +  @expected = args
        +end
        +
        +
        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html new file mode 100644 index 000000000..d72e23a38 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html @@ -0,0 +1,191 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldWithNoArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldWithNoArgs + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Provides the implementation for yield_with_no_args. +Not intended to be instantiated directly.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises

        + + + + + + + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Composable.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Composable.html new file mode 100644 index 000000000..e328619ba --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Composable.html @@ -0,0 +1,779 @@ + + + + + + Module: RSpec::Matchers::Composable + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::Composable + + + +

        + +
        + + + + + + + +
        Included in:
        +
        BuiltIn::BaseMatcher, BuiltIn::RaiseError, BuiltIn::ThrowSymbol, DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/composable.rb
        + +
        +
        + +

        Overview

        +
        +

        Mixin designed to support the composable matcher features +of RSpec 3+. Mix it into your custom matcher classes to +allow them to be used in a composable fashion.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: DescribableItem + + +

        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (Boolean) enumerable?(item) + + + + + + + + + + + private + + +
          + +
        • + + +
        • + + + + (Object) surface_descriptions_in(item) + + + + + + + + + + + + + +

          Transforms the given data structue (typically a hash or array) into a new data structure that, when #inspect is called on it, will provide descriptions of any contained matchers rather than the normal #inspect output.

          +
          + +
        • + + +
        + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Boolean) enumerable?(item) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +164
        +165
        +166
        +167
        +
        +
        # File 'lib/rspec/matchers/composable.rb', line 164
        +
        +def enumerable?(item)
        +  return false if String === item
        +  Enumerable === item
        +end
        +
        +
        + +
        +

        + + + (Object) surface_descriptions_in(item) + + + + + +

        +
        +

        Transforms the given data structue (typically a hash or array) +into a new data structure that, when #inspect is called on it, +will provide descriptions of any contained matchers rather than +the normal #inspect output.

        + +

        You are encouraged to use this in your custom matcher's +description, failure_message or +failure_message_when_negated implementation if you are +supporting any arguments which may be a data structure +containing matchers.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/matchers/composable.rb', line 99
        +
        +def surface_descriptions_in(item)
        +  if Matchers.is_a_describable_matcher?(item)
        +    DescribableItem.new(item)
        +  elsif Hash === item
        +    Hash[surface_descriptions_in(item.to_a)]
        +  elsif Struct === item
        +    item.inspect
        +  elsif enumerable?(item)
        +    begin
        +      item.map { |subitem| surface_descriptions_in(subitem) }
        +    rescue IOError # STDOUT is enumerable but `map` raises an error
        +      item.inspect
        +    end
        +  else
        +    item
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ===(value) + + + + + +

        +
        +

        Delegates to #matches?. Allows matchers to be used in composable +fashion and also supports using matchers in case statements.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/matchers/composable.rb', line 45
        +
        +def ===(value)
        +  matches?(value)
        +end
        +
        +
        + +
        +

        + + - (Object) and(matcher) + + + + Also known as: + & + + + + +

        +
        + +
        + Note: +

        The negative form (expect(...).not_to matcher.and other) +is not supported at this time.

        +
        +
        + +

        Creates a compound and expectation. The matcher will +only pass if both sub-matchers pass. +This can be chained together to form an arbitrarily long +chain of matchers.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(alphabet).to start_with("a").and end_with("z")
        +expect(alphabet).to start_with("a") & end_with("z")
        + +
        + + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/matchers/composable.rb', line 22
        +
        +def and(matcher)
        +  BuiltIn::Compound::And.new self, matcher
        +end
        +
        +
        + +
        +

        + + - (Object) description_of(object) + + + + + +

        +
        +

        Returns the description of the given object in a way that is +aware of composed matchers. If the object is a matcher with +a description method, returns the description; otherwise +returns object.inspect.

        + +

        You are encouraged to use this in your custom matcher's +description, failure_message or +failure_message_when_negated implementation if you are +supporting matcher arguments.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +82
        +83
        +84
        +85
        +
        +
        # File 'lib/rspec/matchers/composable.rb', line 82
        +
        +def description_of(object)
        +  return object.description if Matchers.is_a_describable_matcher?(object)
        +  object.inspect
        +end
        +
        +
        + +
        +

        + + - (Object) or(matcher) + + + + Also known as: + | + + + + +

        +
        + +
        + Note: +

        The negative form (expect(...).not_to matcher.or other) +is not supported at this time.

        +
        +
        + +

        Creates a compound or expectation. The matcher will +pass if either sub-matcher passes. +This can be chained together to form an arbitrarily long +chain of matchers.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(stoplight.color).to eq("red").or eq("green").or eq("yellow")
        +expect(stoplight.color).to eq("red") | eq("green") | eq("yellow")
        + +
        + + +
        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/matchers/composable.rb', line 38
        +
        +def or(matcher)
        +  BuiltIn::Compound::Or.new self, matcher
        +end
        +
        +
        + +
        +

        + + - (Boolean) values_match?(expected, actual) + + + + + +

        +
        +

        This provides a generic way to fuzzy-match an expected value against +an actual value. It understands nested data structures (e.g. hashes +and arrays) and is able to match against a matcher being used as +the expected value or within the expected value at any level of +nesting.

        + +

        Within a custom matcher you are encouraged to use this whenever your +matcher needs to match two values, unless it needs more precise semantics. +For example, the eq matcher does not use this as it is meant to +use == (and only ==) for matching.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + expected + + + (Object) + + + + — +

          what is expected

          +
          + +
        • + +
        • + + actual + + + (Object) + + + + — +

          the actual value

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +
        +
        # File 'lib/rspec/matchers/composable.rb', line 66
        +
        +def values_match?(expected, actual)
        +  expected = with_matchers_cloned(expected)
        +  Support::FuzzyMatcher.values_match?(expected, actual)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Composable/DescribableItem.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Composable/DescribableItem.html new file mode 100644 index 000000000..3ce4be5a1 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Composable/DescribableItem.html @@ -0,0 +1,137 @@ + + + + + + Class: RSpec::Matchers::Composable::DescribableItem + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::Composable::DescribableItem + + + Private +

        + +
        + +
        Inherits:
        +
        + Struct + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/composable.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Wraps an item in order to surface its description via inspect.

        + + +
        +
        +
        + + +
        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL.html new file mode 100644 index 000000000..2adf80ac5 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL.html @@ -0,0 +1,226 @@ + + + + + + Module: RSpec::Matchers::DSL + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::DSL + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/dsl.rb
        + +
        +
        + +

        Overview

        +
        +

        Defines the custom matcher DSL.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: DefaultImplementations, Macros + + + + Classes: Matcher + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) define(name, &declarations) + + + + Also known as: + matcher + + + + +

        +
        +

        Defines a custom matcher.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 7
        +
        +def define(name, &declarations)
        +  warn_about_block_args(name, declarations)
        +  define_method name do |*expected, &block_arg|
        +    RSpec::Matchers::DSL::Matcher.new(name, declarations, self, *expected, &block_arg)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/DefaultImplementations.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/DefaultImplementations.html new file mode 100644 index 000000000..ddb279087 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/DefaultImplementations.html @@ -0,0 +1,450 @@ + + + + + + Module: RSpec::Matchers::DSL::DefaultImplementations + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::DSL::DefaultImplementations + + + +

        + +
        + + + + + +
        Includes:
        +
        BuiltIn::BaseMatcher::DefaultFailureMessages
        + + + + +
        Included in:
        +
        Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/dsl.rb
        + +
        +
        + +

        Overview

        +
        +

        Defines default implementations of the matcher +protocol methods for custom matchers. You can +override any of these using the Macros methods +from within an RSpec::Matchers.define block.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from BuiltIn::BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        +
        +

        The default description.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +302
        +303
        +304
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 302
        +
        +def description
        +  "#{name_to_sentence}#{to_sentence expected}#{chained_method_clause_sentences}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used internally by objects returns by should and should_not.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +297
        +298
        +299
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 297
        +
        +def diffable?
        +  false
        +end
        +
        +
        + +
        +

        + + - (Boolean) expects_call_stack_jump? + + + + + +

        +
        +

        Most matchers do not expect call stack jumps.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +313
        +314
        +315
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 313
        +
        +def expects_call_stack_jump?
        +  false
        +end
        +
        +
        + +
        +

        + + - (Boolean) supports_block_expectations? + + + + + +

        +
        +

        Matchers do not support block expectations by default. You +must opt-in.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +308
        +309
        +310
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 308
        +
        +def supports_block_expectations?
        +  false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Macros.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Macros.html new file mode 100644 index 000000000..07b35f64f --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Macros.html @@ -0,0 +1,1000 @@ + + + + + + Module: RSpec::Matchers::DSL::Macros + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::DSL::Macros + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/dsl.rb
        + +
        +
        + +

        Overview

        +
        +

        Contains the methods that are available from within the +RSpec::Matchers.define DSL for creating custom matchers.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: Deprecated + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) chain(method_name, *attr_names, &definition) + + + + + +

        +
        +

        Convenience for defining methods on this matcher to create a fluent +interface. The trick about fluent interfaces is that each method must +return self in order to chain methods together. chain handles that +for you. If the method is invoked and the +include_chain_clauses_in_custom_matcher_descriptions config option +hash been enabled, the chained method name and args will be added to the +default description and failure message.

        + +

        In the common case where you just want the chained method to store some +value(s) for later use (e.g. in match), you can provide one or more +attribute names instead of a block; the chained method will store its +arguments in instance variables with those names, and the values will +be exposed via getters.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_errors_on do |key|
        +  chain :with do |message|
        +    @message = message
        +  end
        +
        +  match do |actual|
        +    actual.errors[key] == @message
        +  end
        +end
        +
        +expect(minor).to have_errors_on(:age).with("Not old enough to participate")
        + +
        + + +
        + + + + +
        +
        +
        +
        +205
        +206
        +207
        +208
        +209
        +210
        +211
        +212
        +213
        +214
        +215
        +216
        +217
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 205
        +
        +def chain(method_name, *attr_names, &definition)
        +  unless block_given? ^ attr_names.any?
        +    raise ArgumentError, "You must pass either a block or some attribute names (but not both) to `chain`."
        +  end
        +
        +  definition = assign_attributes(attr_names) if attr_names.any?
        +
        +  define_user_override(method_name, definition) do |*args, &block|
        +    super(*args, &block)
        +    @chained_method_clauses.push([method_name, args])
        +    self
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) description {|Object| ... } + + + + + +

        +
        +

        Customize the description to use for one-liners. Only use this when +the description generated by default doesn't suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :qualify_for do |expected|
        +  match { your_match_logic }
        +
        +  description do
        +    "qualify for #{expected}"
        +  end
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual object (i.e. the value wrapped by expect)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +160
        +161
        +162
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 160
        +
        +def description(&definition)
        +  define_user_override(__method__, definition)
        +end
        +
        +
        + +
        +

        + + - (Object) diffable + + + + + +

        +
        +

        Tells the matcher to diff the actual and expected values in the failure +message.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +166
        +167
        +168
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 166
        +
        +def diffable
        +  define_method(:diffable?) { true }
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message {|Object| ... } + + + + + +

        +
        +

        Customizes the failure messsage to use when this matcher is +asked to positively match. Only use this when the message +generated by default doesn't suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_strength do |expected|
        +  match { your_match_logic }
        +
        +  failure_message do |actual|
        +    "Expected strength of #{expected}, but had #{actual.strength}"
        +  end
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual object (i.e. the value wrapped by expect)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 123
        +
        +def failure_message(&definition)
        +  define_user_override(__method__, definition)
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_when_negated {|Object| ... } + + + + + +

        +
        +

        Customize the failure messsage to use when this matcher is asked +to negatively match. Only use this when the message generated by +default doesn't suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_strength do |expected|
        +  match { your_match_logic }
        +
        +  failure_message_when_negated do |actual|
        +    "Expected not to have strength of #{expected}, but did"
        +  end
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual object (i.e. the value wrapped by expect)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +142
        +143
        +144
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 142
        +
        +def failure_message_when_negated(&definition)
        +  define_user_override(__method__, definition)
        +end
        +
        +
        + +
        +

        + + - (Object) match {|Object| ... } + + + + + +

        +
        +

        Stores the block that is used to determine whether this matcher passes +or fails. The block should return a boolean value. When the matcher is +passed to expect(...).to and the block returns true, then the expectation +passes. Similarly, when the matcher is passed to expect(...).not_to and the +block returns false, then the expectation passes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :be_even do
        +  match do |actual|
        +    actual.even?
        +  end
        +end
        +
        +expect(4).to be_even     # passes
        +expect(3).not_to be_even # passes
        +expect(3).to be_even     # fails
        +expect(4).not_to be_even # fails
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual value (i.e. the value wrapped by expect)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 57
        +
        +def match(&match_block)
        +  define_user_override(:matches?, match_block) do |actual|
        +    begin
        +      @actual = actual
        +      super(*actual_arg_for(match_block))
        +    rescue RSpec::Expectations::ExpectationNotMetError
        +      false
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) match_unless_raises(expected_exception = Exception) {|Object| ... } + + + + + +

        +
        +

        Use this instead of match when the block will raise an exception +rather than returning false to indicate a failure.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :accept_as_valid do |candidate_address|
        +  match_unless_raises ValidationException do |validator|
        +    validator.validate(candidate_address)
        +  end
        +end
        +
        +expect(email_validator).to accept_as_valid("person@company.com")
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual object (i.e. the value wrapped by expect)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 95
        +
        +def match_unless_raises(expected_exception=Exception, &match_block)
        +  define_user_override(:matches?, match_block) do |actual|
        +    @actual = actual
        +    begin
        +      super(*actual_arg_for(match_block))
        +    rescue expected_exception => @rescued_exception
        +      false
        +    else
        +      true
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) match_when_negated {|Object| ... } + + + + + +

        +
        +

        Use this to define the block for a negative expectation (expect(...).not_to) +when the positive and negative forms require different handling. This +is rarely necessary, but can be helpful, for example, when specifying +asynchronous processes that require different timeouts.

        + + +
        +
        +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual value (i.e. the value wrapped by expect)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +74
        +75
        +76
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 74
        +
        +def match_when_negated(&match_block)
        +  define_user_override(:does_not_match?, match_block) do |actual|
        +    @actual = actual
        +    super(*actual_arg_for(match_block))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) supports_block_expectations + + + + + +

        +
        +

        Declares that the matcher can be used in a block expectation. +Users will not be able to use your matcher in a block +expectation without declaring this. +(e.g. expect { do_something }.to matcher).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +174
        +175
        +176
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 174
        +
        +def supports_block_expectations
        +  define_method(:supports_block_expectations?) { true }
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Macros/Deprecated.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Macros/Deprecated.html new file mode 100644 index 000000000..f1e6373ee --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Macros/Deprecated.html @@ -0,0 +1,402 @@ + + + + + + Module: RSpec::Matchers::DSL::Macros::Deprecated + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::DSL::Macros::Deprecated + + Deprecated + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec::Matchers::DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/dsl.rb
        + +
        +
        + +

        Overview

        +
        +
        Deprecated.

        Use the methods from RSpec::Matchers::DSL::Macros instead.

        +
        +

        Defines deprecated macro methods from RSpec 2 for backwards compatibility.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should(&definition) + + + + + +

        +
        + + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +275
        +276
        +277
        +278
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 275
        +
        +def failure_message_for_should(&definition)
        +  RSpec.deprecate("`failure_message_for_should`", :replacement => "`failure_message`")
        +  failure_message(&definition)
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not(&definition) + + + + + +

        + +
        +
        + + +
        + + + + +
        +
        +
        +
        +281
        +282
        +283
        +284
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 281
        +
        +def failure_message_for_should_not(&definition)
        +  RSpec.deprecate("`failure_message_for_should_not`", :replacement => "`failure_message_when_negated`")
        +  failure_message_when_negated(&definition)
        +end
        +
        +
        + +
        +

        + + - (Object) match_for_should(&definition) + + + + + +

        +
        +
        Deprecated.
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +263
        +264
        +265
        +266
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 263
        +
        +def match_for_should(&definition)
        +  RSpec.deprecate("`match_for_should`", :replacement => "`match`")
        +  match(&definition)
        +end
        +
        +
        + +
        +

        + + - (Object) match_for_should_not(&definition) + + + + + +

        +
        + + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +269
        +270
        +271
        +272
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 269
        +
        +def match_for_should_not(&definition)
        +  RSpec.deprecate("`match_for_should_not`", :replacement => "`match_when_negated`")
        +  match_when_negated(&definition)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Matcher.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Matcher.html new file mode 100644 index 000000000..ddb340151 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/DSL/Matcher.html @@ -0,0 +1,995 @@ + + + + + + Class: RSpec::Matchers::DSL::Matcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::DSL::Matcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        Macros, RSpec::Matchers::DSL::Macros::Deprecated
        + + + + +
        Includes:
        +
        RSpec::Matchers, Composable, DefaultImplementations, Pretty
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/dsl.rb
        + +
        +
        + +

        Overview

        +
        +

        The class used for custom matchers. The block passed to +RSpec::Matchers.define will be evaluated in the context +of the singleton class of an instance, and will have the +Macros methods available.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) actual + + + + + + + + + readonly + + + + + + + + + +

          Exposes the value being matched against -- generally the object object wrapped by expect.

          +
          + +
        • + + +
        • + + + - (Object) block_arg + + + + + + + + + readonly + + + + + + + + + +

          The block parameter used in the expectation.

          +
          + +
        • + + +
        • + + + - (Object) expected_as_array + + + + + + + + + readonly + + + + + + + + + +

          Returns the expected value as an an array.

          +
          + +
        • + + +
        • + + + - (Object) rescued_exception + + + + + + + + + readonly + + + + + + + + + +

          Exposes the exception raised during the matching by match_unless_raises.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from RSpec::Matchers::DSL::Macros::Deprecated

        +

        failure_message_for_should, failure_message_for_should_not, match_for_should, match_for_should_not

        + + + + + + + + + +

        Methods included from Macros

        +

        chain, description, diffable, failure_message, failure_message_when_negated, match, match_unless_raises, match_when_negated, supports_block_expectations

        + + + + + + + + + +

        Methods included from Composable

        +

        #===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #name, split_words, #to_sentence, #to_word

        + + + + + + + + + +

        Methods included from RSpec::Matchers

        +

        alias_matcher, #all, #be, #be_a, #be_a_kind_of, #be_an_instance_of, #be_between, #be_falsey, #be_nil, #be_truthy, #be_within, #change, clear_generated_description, configuration, #contain_exactly, #cover, define_negated_matcher, #end_with, #eq, #eql, #equal, #exist, #expect, generated_description, #have_attributes, #include, #match, #match_array, #output, #raise_error, #respond_to, #satisfy, #start_with, #throw_symbol, #yield_control, #yield_successive_args, #yield_with_args, #yield_with_no_args

        + + + + + + + + + +

        Methods included from DefaultImplementations

        +

        #description, #diffable?, #expects_call_stack_jump?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from BuiltIn::BaseMatcher::DefaultFailureMessages

        +

        #failure_message, #failure_message_when_negated

        +
        +

        Constructor Details

        + +
        +

        + + - (Matcher) initialize(name, declarations, matcher_execution_context, *expected, &block_arg) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Matcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +361
        +362
        +363
        +364
        +365
        +366
        +367
        +368
        +369
        +370
        +371
        +372
        +373
        +374
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 361
        +
        +def initialize(name, declarations, matcher_execution_context, *expected, &block_arg)
        +  @name     = name
        +  @actual   = nil
        +  @expected_as_array = expected
        +  @matcher_execution_context = matcher_execution_context
        +  @chained_method_clauses = []
        +  @block_arg = block_arg
        +
        +  class << self
        +    # See `Macros#define_user_override` above, for an explanation.
        +    include(@user_method_defs = Module.new)
        +    self
        +  end.class_exec(*expected, &declarations)
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(method, *args, &block) (private) + + + + + +

        +
        +

        Takes care of forwarding unhandled messages to the +@matcher_execution_context (typically the current +running RSpec::Core::Example). This is needed by +rspec-rails so that it can define matchers that wrap +Rails' test helper methods, but it's also a useful +feature in its own right.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +428
        +429
        +430
        +431
        +432
        +433
        +434
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 428
        +
        +def method_missing(method, *args, &block)
        +  if @matcher_execution_context.respond_to?(method)
        +    @matcher_execution_context.__send__ method, *args, &block
        +  else
        +    super(method, *args, &block)
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) actual (readonly) + + + + + +

        +
        +

        Exposes the value being matched against -- generally the object +object wrapped by expect.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +351
        +352
        +353
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 351
        +
        +def actual
        +  @actual
        +end
        +
        +
        + + + +
        +

        + + - (Object) block_arg (readonly) + + + + + +

        +
        +

        The block parameter used in the expectation

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +358
        +359
        +360
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 358
        +
        +def block_arg
        +  @block_arg
        +end
        +
        +
        + + + +
        +

        + + - (Object) expected_as_array (readonly) + + + + + +

        +
        +

        Returns the expected value as an an array. This exists primarily +to aid in upgrading from RSpec 2.x, since in RSpec 2, expected +always returned an array.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +392
        +393
        +394
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 392
        +
        +def expected_as_array
        +  @expected_as_array
        +end
        +
        +
        + + + +
        +

        + + - (Object) rescued_exception (readonly) + + + + + +

        +
        +

        Exposes the exception raised during the matching by match_unless_raises. +Could be useful to extract details for a failure message.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +355
        +356
        +357
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 355
        +
        +def rescued_exception
        +  @rescued_exception
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) expected + + + + + +

        +
        +

        Provides the expected value. This will return an array if +multiple arguments were passed to the matcher; otherwise it +will return a single value.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +380
        +381
        +382
        +383
        +384
        +385
        +386
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 380
        +
        +def expected
        +  if expected_as_array.size == 1
        +    expected_as_array[0]
        +  else
        +    expected_as_array
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) inspect + + + + + +

        +
        +

        Adds the name (rather than a cryptic hex number) +so we can identify an instance of +the matcher in error messages (e.g. for NoMethodError)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +397
        +398
        +399
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 397
        +
        +def inspect
        +  "#<#{self.class.name} #{name}>"
        +end
        +
        +
        + +
        +

        + + - (Boolean) respond_to?(method, include_private = false) + + + + + +

        +
        +

        Indicates that this matcher responds to messages +from the @matcher_execution_context as well.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +411
        +412
        +413
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 411
        +
        +def respond_to?(method, include_private=false)
        +  super || @matcher_execution_context.respond_to?(method, include_private)
        +end
        +
        +
        + +
        +

        + + - (Boolean) respond_to_missing?(method, include_private = false) + + + + + +

        +
        +

        Indicates that this matcher responds to messages +from the @matcher_execution_context as well. +Also, supports getting a method object for such methods.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +405
        +406
        +407
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 405
        +
        +def respond_to_missing?(method, include_private=false)
        +  super || @matcher_execution_context.respond_to?(method, include_private)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/MatcherProtocol.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/MatcherProtocol.html new file mode 100644 index 000000000..ec930cf6f --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/MatcherProtocol.html @@ -0,0 +1,1068 @@ + + + + + + Class: RSpec::Matchers::MatcherProtocol + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::MatcherProtocol + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/matcher_protocol.rb
        + +
        +
        + +

        Overview

        +
        + +
        + Note: +

        This class is not loaded at runtime by rspec-expectations. It exists +purely to provide documentation for the matcher protocol.

        +
        +
        + +

        rspec-expectations can work with any matcher object that implements this protocol.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Required Methods + (collapse) +

        + + + +

        + Optional Methods + (collapse) +

        + +
          + +
        • + + + - (String, Object) actual + + + + + + + + + + + + + +

          The actual value for the purposes of a diff.

          +
          + +
        • + + +
        • + + + - (String) description + + + + + + + + + + + + + +

          The description is used for two things:.

          +
          + +
        • + + +
        • + + + - (Boolean) diffable? + + + + + + + + + + + + + +

          Indicates that this matcher provides actual and expected attributes, and that the values returned by these can be usefully diffed, which can be included in the output.

          +
          + +
        • + + +
        • + + + - (Boolean) does_not_match?(actual) { ... } + + + + + + + + + + + + + +

          In a negative expectation such as expect(x).not_to foo, RSpec will call foo.does_not_match?(x) if this method is defined.

          +
          + +
        • + + +
        • + + + - (String, Object) expected + + + + + + + + + + + + + +

          The expected value for the purposes of a diff.

          +
          + +
        • + + +
        • + + + - (Boolean) expects_call_stack_jump? + + + + + + + + + + + + + +

          Indicates that when this matcher is used in a block expectation expression, it expects the block to use a ruby construct that causes a call stack jump (such as raising an error or throwing a symbol).

          +
          + +
        • + + +
        • + + + - (String) failure_message_when_negated + + + + + + + + + + + + + +

          This will only be called when a negative match fails.

          +
          + +
        • + + +
        • + + + - (Boolean) supports_block_expectations? + + + + + + + + + + + + + +

          Indicates that this matcher can be used in a block expectation expression, such as expect { foo }.to raise_error.

          +
          + +
        • + + +
        + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (String, Object) actual + + + + + +

        +
        + +
        + Note: +

        This method is required if diffable? returns true.

        +
        +
        + +

        The actual value for the purposes of a diff.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String, Object) + + + + — +

          If an object (rather than a string) is provided, +RSpec will use the pp library to convert it to multi-line output in +order to diff.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 82
        +
        +
        +
        +
        + +
        +

        + + - (String) description + + + + + +

        +
        +

        The description is used for two things:

        + +
          +
        • When using RSpec's one-liner syntax +(e.g. it { is_expected.to matcher }), the description +is used to generate the example's doc string since you +have not provided one.
        • +
        • In a composed matcher expression, the description is used +as part of the failure message (and description) of the outer +matcher.
        • +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          Description of the matcher.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 42
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        Indicates that this matcher provides actual and expected attributes, +and that the values returned by these can be usefully diffed, which can +be included in the output.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if actual and expected can be diffed.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 76
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) { ... } + + + + + +

        +
        +

        In a negative expectation such as expect(x).not_to foo, RSpec will +call foo.does_not_match?(x) if this method is defined. If it's not +defined it will fall back to using !foo.matches?(x). This allows you +to provide custom logic for the negative case.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + actual + + + (Object) + + + + — +

          The object being matched against.

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + + + + + +

          For an expression like expect(x).not_to matcher do...end, the do/end +block binds to not_to. It passes that block, if there is one, on to this method.

          +
          + +
        • + +
        +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if this matcher does not match the provided object.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 24
        +
        +
        +
        +
        + +
        +

        + + - (String, Object) expected + + + + + +

        +
        + +
        + Note: +

        This method is required if diffable? returns true.

        +
        +
        + +

        The expected value for the purposes of a diff.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String, Object) + + + + — +

          If an object (rather than a string) is provided, +RSpec will use the pp library to convert it to multi-line output in +order to diff.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 89
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) expects_call_stack_jump? + + + + + +

        +
        + +
        + Note: +

        This method is very rarely used or needed.

        +
        +
        + +
        + Note: +

        If not defined, RSpec assumes a value of false for this method.

        +
        +
        + +

        Indicates that when this matcher is used in a block expectation +expression, it expects the block to use a ruby construct that causes +a call stack jump (such as raising an error or throwing a symbol).

        + +

        This is used internally for compound block expressions, as matchers +which expect call stack jumps must be treated with care to work properly.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if the matcher expects a call stack jump

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 63
        +
        +
        +
        +
        + +
        +

        + + - (String) failure_message + + + + + +

        +
        +

        This will only be called if #matches? returns false.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          Explanation for the failure.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 16
        +
        +
        +
        +
        + +
        +

        + + - (String) failure_message_when_negated + + + + + +

        +
        + +
        + Note: +

        This method is listed as optional because matchers do not have to +support negation. But if your matcher does support negation, this is a +required method -- otherwise, you'll get a NoMethodError.

        +
        +
        + +

        This will only be called when a negative match fails.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +

          Explanation for the failure.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 35
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) { ... } + + + + + +

        +
        +

        Returns true if this matcher matches the provided object.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + actual + + + (Object) + + + + — +

          The object being matched against.

          +
          + +
        • + +
        + +

        Yields:

        +
          + +
        • + + + + + + + +

          For an expression like expect(x).to matcher do...end, the do/end +block binds to to. It passes that block, if there is one, on to this method.

          +
          + +
        • + +
        +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if this matcher matches the provided object.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 10
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) supports_block_expectations? + + + + + +

        +
        + +
        + Note: +

        If not defined, RSpec assumes a value of false for this method.

        +
        +
        + +

        Indicates that this matcher can be used in a block expectation expression, +such as expect { foo }.to raise_error. Generally speaking, this is +only needed for matchers which operate on a side effect of a block, rather +than on a particular object.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if this matcher can be used in block expressions.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/matchers/matcher_protocol.rb', line 55
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Pretty.html b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Pretty.html new file mode 100644 index 000000000..c63f8e648 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/RSpec/Matchers/Pretty.html @@ -0,0 +1,446 @@ + + + + + + Module: RSpec::Matchers::Pretty + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::Pretty + + + Private +

        + +
        + + + + + + + +
        Included in:
        +
        BuiltIn::BaseMatcher, DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/pretty.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Contains logic to facilitate converting ruby symbols and +objects to english phrases.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) name + + + + + + + + + + + private + + +

          Provides a name for the matcher.

          +
          + +
        • + + +
        • + + + - (Object) to_sentence(words) + + + + + + + + + + + private + + +

          Converts a collection of objects into an english expression.

          +
          + +
        • + + +
        • + + + - (Object) to_word(item) + + + + + + + + + + + private + + +

          Converts the given item to string suitable for use in a list expression.

          +
          + +
        • + + +
        + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) split_words(sym) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Converts a symbol into an english expression.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 9
        +
        +def split_words(sym)
        +  sym.to_s.gsub(/_/, ' ')
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) name + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Provides a name for the matcher.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 45
        +
        +def name
        +  defined?(@name) ? @name : underscore(self.class.name.split("::").last)
        +end
        +
        +
        + +
        +

        + + - (Object) to_sentence(words) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Converts a collection of objects into an english expression.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 16
        +
        +def to_sentence(words)
        +  return " #{words.inspect}" if !words || Struct === words
        +  words = Array(words).map { |w| to_word(w) }
        +  case words.length
        +  when 0
        +    ""
        +  when 1
        +    " #{words[0]}"
        +  when 2
        +    " #{words[0]} and #{words[1]}"
        +  else
        +    " #{words[0...-1].join(', ')}, and #{words[-1]}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) to_word(item) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Converts the given item to string suitable for use in a list expression.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 33
        +
        +def to_word(item)
        +  is_matcher_with_description?(item) ? item.description : item.inspect
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/_index.html b/source/documentation/3.2/rspec-expectations/_index.html new file mode 100644 index 000000000..467f1e871 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/_index.html @@ -0,0 +1,677 @@ + + + + + + Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.4

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + +
          +
        • A
        • +
            + +
          • + AliasedMatcher + + (RSpec::Matchers) + +
          • + +
          • + All + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + And + + (RSpec::Matchers::BuiltIn::Compound) + +
          • + +
          +
        + + +
          +
        • B
        • +
            + +
          • + BaseMatcher + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BasicObject + +
          • + +
          • + Be + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeAKindOf + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeAnInstanceOf + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeBetween + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeComparedTo + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeFalsey + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeNil + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BePredicate + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeTruthy + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeWithin + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BuiltIn + + (RSpec::Matchers) + +
          • + +
          +
        + + + + + + + + +
          +
        • E
        • +
            + +
          • + EndWith + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Eq + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Eql + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Equal + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Exist + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + ExistenceTest + + (RSpec::Matchers::BuiltIn::Exist) + +
          • + +
          • + ExpectationTarget + + (RSpec::Expectations) + +
          • + +
          • + Expectations + + (RSpec) + +
          • + +
          +
        + + +
          +
        • H
        • +
            + +
          • + Has + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + HaveAttributes + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + +
          +
        • I
        • +
            + +
          • + Include + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + +
        + + +
          +
        • M
        • +
            + +
          • + Macros + + (RSpec::Matchers::DSL) + +
          • + +
          • + Match + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Matcher + + (RSpec::Matchers::DSL) + +
          • + +
          • + MatcherProtocol + + (RSpec::Matchers) + +
          • + +
          • + Matchers + + (RSpec) + +
          • + +
          +
        + + +
          +
        • N
        • + +
        + + +
          +
        • O
        • +
            + +
          • + OperatorMatcher + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Or + + (RSpec::Matchers::BuiltIn::Compound) + +
          • + +
          • + Output + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + +
          +
        • P
        • +
            + +
          • + Pretty + + (RSpec::Matchers) + +
          • + +
          +
        + + +
          +
        • R
        • +
            + +
          • + RSpec + +
          • + +
          • + RaiseError + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + RespondTo + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + + +
          +
        • T
        • +
            + +
          • + ThrowSymbol + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/class_list.html b/source/documentation/3.2/rspec-expectations/class_list.html new file mode 100644 index 000000000..523eaf381 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/class_list.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-expectations/file.Changelog.html b/source/documentation/3.2/rspec-expectations/file.Changelog.html new file mode 100644 index 000000000..1f074b007 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/file.Changelog.html @@ -0,0 +1,1135 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        3.2.0 Development

        + +

        Full Changelog

        + +

        Enhancements:

        + +
          +
        • Add block_arg method to custom matcher API, which allows you to +access the block passed to a custom matcher, if there is one. +(Mike Dalton, #645)
        • +
        • Provide more detail in failure message of yield_control matcher. +(Jon Rowe, #650)
        • +
        • Add a shorthand syntax for chain in the matcher DSL which assigns values +for use elsewhere, for example chain :and_smaller_than, :small_value +creates an attr_reader for small_value (Tom Stuart, #644)
        • +
        • Provide a more helpful deprecation message when using the should syntax. +(Elia Schito, #663)
        • +
        • Provide more detail in the have_attributes matcher failure message. +(Jon Rowe, #668)
        • +
        • Make the have_attributes matcher diffable. +(Jon Rowe, Alexey Fedorov, #668)
        • +
        + +

        Bug Fixes:

        + +
          +
        • Avoid calling private_methods from the be predicate matcher on +the target object if the object publicly responds to the predicate +method. This avoids a possible error that can occur if the object +raises errors from private_methods (which can happen with celluloid +objects). (@chapmajs, #670)
        • +
        • Make yield_control (with no modifier) default to +at_least(:once) rather than raising a confusing error +when multiple yields are encountered. +(Myron Marston, #675)
        • +
        • Fix "instance variable @color not initialized" warning when using +rspec-expectations outside of an rspec-core context. (Myron Marston, #689)
        • +
        • Fix start_with and end_with to work properly when checking a +string against an array of strings. (Myron Marston, #690)
        • +
        • Don't use internally delegated matchers when generating descriptions +for examples without doc strings. (Myron Marston, #692)
        • +
        + +

        3.1.2 / 2014-09-26

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix define_negated_matcher so that matchers that support fluent +interfaces continue to be negated after you use the chained method. +(Myron Marston, #656)
        • +
        • Fix define_negated_matcher so that the matchers fail with an +appropriate failure message. (Myron Marston, #659)
        • +
        + +

        3.1.1 / 2014-09-15

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix regression in all matcher in 3.1.0 that prevented it from +working on objects that are not Enumerable but do implement +each_with_index (such as an ActiveRecord proxy). (Jori Hardman, #647)
        • +
        + +

        3.1.0 / 2014-09-04

        + +

        Full Changelog

        + +

        Enhancements:

        + +
          +
        • Add have_attributes matcher, that passes if actual's attribute +values match the expected attributes hash: +Person = Struct.new(:name, :age) +person = Person.new("Bob", 32) +expect(person).to have_attributes(:name => "Bob", :age => 32). +(Adam Farhi, #571)
        • +
        • Extended compound matcher support to block matchers, for cases like: +expect { ... }.to change { x }.to(3).and change { y }.to(4). (Myron +Marston, #567)
        • +
        • Include chained methods in custom matcher description and failure message +when new include_chain_clauses_in_custom_matcher_descriptions config +option is enabled. (Dan Oved, #600)
        • +
        • Add thrice modifier to yield_control matcher as a synonym for +exactly(3).times. (Dennis Taylor, #615)
        • +
        • Add RSpec::Matchers.define_negated_matcher, which defines a negated +version of the named matcher. (Adam Farhi, Myron Marston, #618)
        • +
        • Document and support negation of contain_exactly/match_array. +(Jon Rowe, #626).
        • +
        + +

        Bug Fixes:

        + +
          +
        • Rename private LegacyMacherAdapter constant to LegacyMatcherAdapter +to fix typo. (Abdelkader Boudih, #563)
        • +
        • Fix all matcher so that it fails properly (rather than raising a +NoMethodError) when matched against a non-enumerable. (Hao Su, #622)
        • +
        + +

        3.0.4 / 2014-08-14

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix start_with and end_with so that they work properly with +structs. (Myron Marston, #620)
        • +
        • Fix failure message generation so that structs are printed properly +in failures. Previously failure messages would represent them as +an array. (Myron Marston, #620)
        • +
        • Fix composable matcher support so that it does not wrongly treat +structs as arrays. (Myron Marston, #620)
        • +
        + +

        3.0.3 / 2014-07-21

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix issue with detection of generic operator matchers so they work +correctly when undefined. (Myron Marston, #597)
        • +
        • Don't inadvertently define BasicObject in 1.8.7. (Chris Griego, #603)
        • +
        • Fix include matcher so that it fails gracefully when matched against +an object that does not respond to include?. (Myron Marston, #607)
        • +
        + +

        3.0.2 / 2014-06-19

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix regression in contain_exactly (AKA match_array) that caused it +to wrongly pass when the expected array was empty. (Myron Marston, #581)
        • +
        • Provide a better error message when you use the change(obj, :msg) +form of the change matcher but forget the message argument. (Alex +Sunderland, #585)
        • +
        • Make the contain_exactly matcher work with arrays that contain hashes in +arbitrary ordering. (Sam Phippen, #578)
        • +
        + +

        3.0.1 / 2014-06-12

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Add a missing require that would cause the respond_to matcher to +fail when used in a project where the rest of RSpec (e.g. core and +expecatations) weren't being used. (Myron Marston, #566)
        • +
        • Structs are no longer treated as arrays when diffed. (Jon Rowe, #576)
        • +
        + +

        3.0.0 / 2014-06-01

        + +

        Full Changelog

        + +

        No code changes. Just taking it out of pre-release.

        + +

        3.0.0.rc1 / 2014-05-18

        + +

        Full Changelog

        + +

        Breaking Changes for 3.0.0:

        + +
          +
        • Remove matcher_execution_context attribute from DSL-defined +custom matchers. (Myron Marston)
        • +
        • Remove RSpec::Matchers::Pretty#_pretty_print. (Myron Marston)
        • +
        • Remove RSpec::Matchers::Pretty#expected_to_sentence. (Myron Marston)
        • +
        • Rename RSpec::Matchers::Configuration constant to +RSpec::Expectations::Configuration. (Myron Marston)
        • +
        • Prevent have_xyz predicate matchers using private methods. +(Adrian Gonzalez)
        • +
        • Block matchers must now implement supports_block_expectations?. +(Myron Marston)
        • +
        • Stop supporting require 'rspec-expectations'. +Use require 'rspec/expectations' instead. (Myron Marston)
        • +
        + +

        Bug Fixes:

        + +
          +
        • Fix NoMethodError triggered by beta2 when YARD was loaded in +the test environment. (Myron Marston)
        • +
        • Fix be_xyz matcher to accept a do...end block. (Myron Marston)
        • +
        • Fix composable matcher failure message generation logic +so that it does not blow up when given $stdout or $stderr. +(Myron Marston)
        • +
        • Fix change matcher to work properly with IO objects. +(Myron Marston)
        • +
        • Fix exist matcher so that it can be used in composed matcher +expressions involving objects that do not implement exist? or +exists?. (Daniel Fone)
        • +
        • Fix composable matcher match logic so that it clones matchers +before using them in order to work properly with matchers +that use internal memoization based on a given actual value. +(Myron Marston)
        • +
        • Fix be_xyz and has_xyz predicate matchers so that they can +be used in composed matcher expressions involving objects that +do not implement the predicate method. (Daniel Fone)
        • +
        + +

        Enhancements:

        + +
          +
        • Document the remaining public APIs. rspec-expectations now has 100% of +the public API documented and will remain that way (as new undocumented +methods will fail the build). (Myron Marston)
        • +
        • Improve the formatting of BigDecimal objects in eq matcher failure +messages. (Daniel Fone)
        • +
        • Improve the failure message for be_xyz predicate matchers so +that it includes the inspect output of the receiver. +(Erik Michaels-Ober, Sam Phippen)
        • +
        • Add all matcher, to allow you to specify that a given matcher +matches all elements in a collection: +expect([1, 3, 5]).to all( be_odd ). (Adam Farhi)
        • +
        • Add boolean aliases (&/|) for compound operators (and/or). (Adam Farhi)
        • +
        • Give users a clear error when they wrongly use a value matcher +in a block expectation expression (e.g. expect { 3 }.to eq(3)) +or vice versa. (Myron Marston)
        • +
        + +

        3.0.0.beta2 / 2014-02-17

        + +

        Full Changelog

        + +

        Breaking Changes for 3.0.0:

        + +
          +
        • Remove deprecated support for accessing the RSpec constant using +Rspec or Spec. (Myron Marston)
        • +
        • Remove deprecated RSpec::Expectations.differ=. (Myron Marston)
        • +
        • Remove support for deprecated expect(...).should. (Myron Marston)
        • +
        • Explicitly disallow expect { }.not_to change { } with by, +by_at_least, by_at_most or to. These have never been supported +but did not raise explicit errors. (Myron Marston)
        • +
        • Provide === rather than == as an alias of matches? for +all matchers. The semantics of === are closer to an RSpec +matcher than ==. (Myron Marston)
        • +
        • Remove deprecated RSpec::Matchers::OperatorMatcher constant. +(Myron Marston)
        • +
        • Make RSpec::Expectations::ExpectationNotMetError subclass +Exception rather than StandardError so they can bypass +a bare rescue in end-user code (e.g. when an expectation is +set from within a rspec-mocks stub implementation). (Myron Marston)
        • +
        • Remove Test::Unit and Minitest 4.x integration. (Myron Marston)
        • +
        + +

        Enhancements:

        + +
          +
        • Simplify the failure message of the be matcher when matching against: +true, false and nil. (Sam Phippen)
        • +
        • Update matcher protocol and custom matcher DSL to better align +with the newer expect syntax. If you want your matchers to +maintain compatibility with multiple versions of RSpec, you can +alias the new names to the old. (Myron Marston) + +
            +
          • failure_message_for_should => failure_message
          • +
          • failure_message_for_should_not => failure_message_when_negated
          • +
          • match_for_should => match
          • +
          • match_for_should_not => match_when_negated
          • +
        • +
        • Improve generated descriptions from change matcher. (Myron Marston)
        • +
        • Add support for compound matcher expressions using and and or. +Simply chain them off of any existing matcher to create an expression +like expect(alphabet).to start_with("a").and end_with("z"). +(Eloy Espinaco)
        • +
        • Add contain_exactly as a less ambiguous version of match_array. +Note that it expects the expected array to be splatted as +individual args: expect(array).to contain_exactly(1, 2) is +the same as expect(array).to match_array([1, 2]). (Myron Marston)
        • +
        • Update contain_exactly/match_array so that it can match against +other non-array collections (such as a Set). (Myron Marston)
        • +
        • Update built-in matchers so that they can accept matchers as arguments +to allow you to compose matchers in arbitrary ways. (Myron Marston)
        • +
        • Add RSpec::Matchers::Composable mixin that can be used to make +a custom matcher composable as well. Note that custom matchers +defined via RSpec::Matchers.define already have this. (Myron +Marston)
        • +
        • Define noun-phrase aliases for built-in matchers, which can be +used when creating composed matcher expressions that read better +and provide better failure messages. (Myron Marston)
        • +
        • Add RSpec::Matchers.alias_matcher so users can define their own +matcher aliases. The description of the matcher will reflect the +alternate matcher name. (Myron Marston)
        • +
        • Add explicit be_between matcher. be_between has worked for a +long time as a dynamic predicate matcher, but the failure message +was suboptimal. The new matcher provides a much better failure +message. (Erik Michaels-Ober)
        • +
        • Enhance the be_between matcher to allow for inclusive or exclusive +comparison (e.g. inclusive of min/max or exclusive of min/max). +(Pedro Gimenez)
        • +
        • Make failure message for not_to be #{operator} less confusing by +only saying it's confusing when comparison operators are used. +(Prathamesh Sonpatki)
        • +
        • Improve failure message of eq matcher when Time or DateTime +objects are used so that the full sub-second precision is included. +(Thomas Holmes, Jeff Wallace)
        • +
        • Add output matcher for expecting that a block outputs to_stdout +or to_stderr. (Luca Pette, Matthias Günther)
        • +
        • Forward a provided block on to the has_xyz? method call when +the have_xyz matcher is used. (Damian Galarza)
        • +
        • Provide integration with Minitest 5.x. Require +rspec/expectations/minitest_integration after loading minitest +to use rspec-expectations with minitest. (Myron Marston)
        • +
        + +

        Bug Fixes:

        + +
          +
        • Fix wrong matcher descriptions with falsey expected value (yujinakayama)
        • +
        • Fix expect { }.not_to change { }.from(x) so that the matcher only +passes if the starting value is x. (Tyler Rick, Myron Marston)
        • +
        • Fix hash diffing, so that it colorizes properly and doesn't consider trailing +commas when performing the diff. (Jared Norman)
        • +
        • Fix built-in matchers to fail normally rather than raising +ArgumentError when given an object of the wrong type to match +against, so that they work well in composite matcher expressions like +expect([1.51, "foo"]).to include(a_string_matching(/foo/), a_value_within(0.1).of(1.5)). +(Myron Marston)
        • +
        + +

        Deprecations:

        + +
          +
        • Retain support for RSpec 2 matcher protocol (e.g. for matchers +in 3rd party extension gems like shoulda), but it will print +a deprecation warning. (Myron Marston)
        • +
        + +

        3.0.0.beta1 / 2013-11-07

        + +

        Full Changelog

        + +

        Breaking Changes for 3.0.0:

        + +
          +
        • Remove explicit support for 1.8.6. (Jon Rowe)
        • +
        • Remove the deprecated be_close matcher, preferring be_within instead. +(Sam Phippen)
        • +
        • Remove the deprecated have, have_at_least and have_at_most matchers. +You can continue using those matchers through https://github.com/rspec/rspec-collection_matchers, +or you can rewrite your expectations with something like +expect(your_object.size).to eq(num). (Hugo Baraúna)
        • +
        • Rename be_true and be_false to be_truthy and be_falsey. (Sam Phippen)
        • +
        • Make expect { }.to_not raise_error(SomeSpecificClass, message), + expect { }.to_not raise_error(SomeSpecificClass) and + expect { }.to_not raise_error(message) invalid, since they are prone +to hiding failures. Instead, use expect { }.to_not raise_error (with no +args). (Sam Phippen)
        • +
        • Within RSpec::Matchers.define blocks, helper methods made available +either via def self.helper or extend HelperModule are no longer +available to the match block (or any of the others). Instead +include your helper module and define the helper method as an +instance method. (Myron Marston)
        • +
        • Force upgrading Diff::LCS for encoding compatability with diffs. (Jon Rowe)
        • +
        + +

        Enhancements:

        + +
          +
        • Support do..end style block with raise_error matcher. (Yuji Nakayama)
        • +
        • Rewrote custom matcher DSL to simplify its implementation and solve a +few issues. (Myron Marston)
        • +
        • Allow early return from within custom matcher DSL blocks. (Myron +Marston)
        • +
        • The custom matcher DSL's chain can now accept a block. (Myron +Marston)
        • +
        • Support setting an expectation on a raise_error matcher via a chained +with_message method call. (Sam Phippen)
        • +
        + +

        Bug Fixes:

        + +
          +
        • Allow include and match matchers to be used from within a +DSL-defined custom matcher's match block. (Myron Marston)
        • +
        • Correct encoding error message on diff failure (Jon Rowe)
        • +
        + +

        Deprecations:

        + +
          +
        • Using the old :should syntax without explicitly configuring it is deprecated. +It will continue to work but will emit a deprecation warning in RSpec 3 if +you do not explicitly enable it. (Sam Phippen)
        • +
        + +

        2.99.2 / 2014-07-21

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix regression in Expectations#method_handle_for where proxy objects +with method delegated would wrongly not return a method handle. +(Jon Rowe, #594)
        • +
        • Fix issue with detection of generic operator matchers so they work +correctly when undefined. (Myron Marston, #597)
        • +
        + +

        2.99.1 / 2014-06-19

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix typo in custom matcher expected deprecation warning -- it's +expected_as_array, not expected_array. (Frederick Cheung, #562)
        • +
        + +

        2.99.0 / 2014-06-01

        + +

        Full Changelog

        + +

        Enhancements:

        + +
          +
        • Special case deprecation message for errors_on with rspec-rails to be more useful. +(Aaron Kromer)
        • +
        + +

        2.99.0.rc1 / 2014-05-18

        + +

        Full Changelog

        + +

        Deprecations:

        + +
          +
        • Deprecate matcher_execution_context attribute on DSL-defined +custom matchers. (Myron Marston)
        • +
        • Deprecate RSpec::Matchers::Pretty#_pretty_print. (Myron Marston)
        • +
        • Deprecate RSpec::Matchers::Pretty#expected_to_sentence. (Myron Marston)
        • +
        • Deprecate RSpec::Matchers::Configuration in favor of +RSpec::Expectations::Configuration. (Myron Marston)
        • +
        • Deprecate be_xyz predicate matcher on an object that doesn't respond to +xyz? or xyzs?. (Daniel Fone)
        • +
        • Deprecate have_xyz matcher on an object that doesn't respond to has_xyz?. +(Daniel Fone)
        • +
        • Deprecate have_xyz matcher on an object that has a private method has_xyz?. +(Jon Rowe)
        • +
        • Issue a deprecation warning when a block expectation expression is +used with a matcher that doesn't explicitly support block expectations +via supports_block_expectations?. (Myron Marston)
        • +
        • Deprecate require 'rspec-expectations'. Use +require 'rspec/expectations' instead. (Myron Marston)
        • +
        + +

        2.99.0.beta2 / 2014-02-17

        + +

        Full Changelog

        + +

        Deprecations:

        + +
          +
        • Deprecate chaining by, by_at_least, by_at_most or to off of +expect { }.not_to change { }. The docs have always said these are +not supported for the negative form but now they explicitly raise +errors in RSpec 3. (Myron Marston)
        • +
        • Change the semantics of expect { }.not_to change { x }.from(y). +In RSpec 2.x, this expectation would only fail if x started with +the value of y and changed. If it started with a different value +and changed, it would pass. In RSpec 3, it will pass only if the +value starts at y and it does not change. (Myron Marston)
        • +
        • Deprecate matcher == value as an alias for matcher.matches?(value), +in favor of matcher === value. (Myron Marston)
        • +
        • Deprecate RSpec::Matchers::OperatorMatcher in favor of +RSpec::Matchers::BuiltIn::OperatorMatcher. (Myron Marston)
        • +
        • Deprecate auto-integration with Test::Unit and minitest. +Instead, include RSpec::Matchers in the appropriate test case +base class yourself. (Myron Marston)
        • +
        • Deprecate treating #expected on a DSL-generated custom matcher +as an array when only 1 argument is passed to the matcher method. +In RSpec 3 it will be the single value in order to make diffs +work properly. (Jon Rowe)
        • +
        + +

        2.99.0.beta1 / 2013-11-07

        + +

        Full Changelog

        + +

        Deprecations

        + +
          +
        • Deprecate have, have_at_least and have_at_most. You can continue using those +matchers through https://github.com/rspec/rspec-collection_matchers, or +you can rewrite your expectations with something like +expect(your_object.size).to eq(num). (Hugo Baraúna)
        • +
        • Deprecate be_xyz predicate matcher when xyz? is a private method. +(Jon Rowe)
        • +
        • Deprecate be_true/be_false in favour of be_truthy/be_falsey +(for Ruby's conditional semantics) or be true/be false +(for exact equality). (Sam Phippen)
        • +
        • Deprecate calling helper methods from a custom matcher with the wrong +scope. (Myron Marston) + +
            +
          • def self.foo / extend Helper can be used to add macro methods +(e.g. methods that call the custom matcher DSL methods), but should +not be used to define helper methods called from within the DSL +blocks.
          • +
          • def foo / include Helper is the opposite: it's for helper methods +callable from within a DSL block, but not for defining macros.
          • +
          • RSpec 2.x allowed helper methods defined either way to be used for +either purpose, but RSpec 3.0 will not.
          • +
        • +
        + +

        2.14.5 / 2014-02-01

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix wrong matcher descriptions with falsey expected value +(yujinakayama)
        • +
        + +

        2.14.4 / 2013-11-06

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Make the match matcher produce a diff output. (Jon Rowe, Ben Moss)
        • +
        • Choose encoding for diff's more intelligently, and when all else fails fall +back to default internal encoding with replacing characters. (Jon Rowe)
        • +
        + +

        2.14.3 / 2013-09-22

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix operator matchers (should syntax) when method is redefined on target. +(Brandon Turner)
        • +
        • Fix diffing of hashes with object based keys. (Jon Rowe)
        • +
        • Fix operator matchers (should syntax) when operator is defined via +method_missing (Jon Rowe)
        • +
        + +

        2.14.2 / 2013-08-14

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix be_<predicate> matcher to not support operator chaining like the +be matcher does (e.g. be == 5). This led to some odd behaviors +since be_<predicate> == anything returned a BeComparedTo matcher +and was thus always truthy. This was a consequence of the implementation +(e.g. subclassing the basic Be matcher) and was not intended behavior. +(Myron Marston).
        • +
        • Fix change matcher to compare using == in addition to ===. This +is important for an expression like: +expect {}.to change { a.class }.from(ClassA).to(ClassB) because +SomeClass === SomeClass returns false. (Myron Marston)
        • +
        + +

        2.14.1 / 2013-08-08

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Ensure diff output uses the same encoding as the encoding of +the string being diff'd to prevent Encoding::UndefinedConversionError +errors (Jon Rowe).
        • +
        + +

        2.14.0 / 2013-07-06

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Values that are not matchers use #inspect, rather than #description for +documentation output (Andy Lindeman, Sam Phippen).
        • +
        • Make expect(a).to be_within(x).percent_of(y) work with negative y +(Katsuhiko Nishimra).
        • +
        • Make the be_predicate matcher work as expected used with expect{...}.to +change... (Sam Phippen).
        • +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Enhance yield_control so that you can specify an exact or relative +number of times: expect { }.to yield_control.exactly(3).times, +expect { }.to yield_control.at_least(2).times, etc (Bartek +Borkowski).
        • +
        • Make the differ that is used when an expectation fails better handle arrays +by splitting each element of the array onto its own line. (Sam Phippen)
        • +
        • Accept duck-typed strings that respond to :to_str as expectation messages. +(Toby Ovod-Everett)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix differ to not raise errors when dealing with differently-encoded +strings (Jon Rowe).
        • +
        • Fix expect(something).to be_within(x).percent_of(y) where x and y are both +integers (Sam Phippen).
        • +
        • Fix have matcher to handle the fact that on ruby 2.0, +Enumerator#size may return nil (Kenta Murata).
        • +
        • Fix expect { raise s }.to raise_error(s) where s is an error instance +on ruby 2.0 (Sam Phippen).
        • +
        • Fix expect(object).to raise_error passing. This now warns the user and +fails the spec (tomykaira).
        • +
        + +

        Deprecations

        + +
          +
        • Deprecate expect { }.not_to raise_error(SpecificErrorClass) or +expect { }.not_to raise_error("some specific message"). Using +these was prone to hiding failures as they would allow any other +error to pass. (Sam Phippen and David Chelimsky)
        • +
        + +

        2.13.0 / 2013-02-23

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Add support for percent deltas to be_within matcher: +expect(value).to be_within(10).percent_of(expected) +(Myron Marston).
        • +
        • Add support to include matcher to allow it to be given a list +of matchers as the expecteds to match against (Luke Redpath).
        • +
        + +

        Bug fixes

        + +
          +
        • Fix change matcher so that it dups strings in order to handle +mutated strings (Myron Marston).
        • +
        • Fix should be =~ /some regex/ / expect(...).to be =~ /some regex/. +Previously, these either failed with a confusing undefined method +matches?' for false:FalseClass error or were no-ops that didn't +actually verify anything (Myron Marston).
        • +
        • Add compatibility for diff-lcs 1.2 and relax the version +constraint (Peter Goldstein).
        • +
        • Fix DSL-generated matchers to allow multiple instances of the +same matcher in the same example to have different description +and failure messages based on the expected value (Myron Marston).
        • +
        • Prevent undefined method #split for Array error when dumping +the diff of an array of multiline strings (Myron Marston).
        • +
        • Don't blow up when comparing strings that are in an encoding +that is not ASCII compatible (Myron Marston).
        • +
        • Remove confusing "Check the implementation of #==" message +printed for empty diffs (Myron Marston).
        • +
        + +

        2.12.1 / 2012-12-15

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Improve the failure message for an expression like +{}.should =~ {}. (Myron Marston and Andy Lindeman)
        • +
        • Provide a match_regex alias so that custom matchers +built using the matcher DSL can use it (since match +is a different method in that context). +(Steven Harman)
        • +
        + +

        2.12.0 / 2012-11-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Colorize diffs if the --color option is configured. (Alex Coplan)
        • +
        • Include backtraces in unexpected errors handled by raise_error +matcher (Myron Marston)
        • +
        • Print a warning when users accidentally pass a non-string argument +as an expectation message (Sam Phippen)
        • +
        • =~ and match_array matchers output a more useful error message when +the actual value is not an array (or an object that responds to #to_ary) +(Sam Phippen)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix include matcher so that expect({}).to include(:a => nil) +fails as it should (Sam Phippen).
        • +
        • Fix be_an_instance_of matcher so that Class#to_s is used in the +description rather than Class#inspect, since some classes (like +ActiveRecord::Base) define a long, verbose #inspect. +(Tom Stuart)
        • +
        + +

        2.11.3 / 2012-09-04

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix (and deprecate) expect { }.should syntax so that it works even +though it was never a documented or intended syntax. It worked as a +consequence of the implementation of expect in RSpec 2.10 and +earlier. (Myron Marston)
        • +
        • Ensure #== is defined on built in matchers so that they can be composed. +For example:

          + +

          expect { + user.emailed! +}.to change { user.last_emailed_at }.to be_within(1.second).of(Time.zone.now)

        • +
        + +

        2.11.2 / 2012-07-25

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Define should and should_not on Object rather than BasicObject +on MacRuby. On MacRuby, BasicObject is defined but is not the root +of the object hierarchy. (Gabriel Gilder)
        • +
        + +

        2.11.1 / 2012-07-08

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Constrain actual in be_within matcher to values that respond to - instead +of requiring a specific type. + +
            +
          • Time, for example, is a legit alternative.
          • +
        • +
        + +

        2.11.0 / 2012-07-07

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Expand expect syntax so that it supports expections on bare values +in addition to blocks (Myron Marston).
        • +
        • Add configuration options to control available expectation syntaxes +(Myron Marston): + +
            +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :expect }
          • +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :should }
          • +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
          • +
          • RSpec.configuration.add_should_and_should_not_to Delegator
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • Allow only Numeric values to be the "actual" in the be_within matcher. +This prevents confusing error messages. (Su Zhang @zhangsu)
        • +
        • Define should and should_not on BasicObject rather than Kernel +on 1.9. This makes should and should_not work properly with +BasicObject-subclassed proxy objects like Delegator. (Myron +Marston)
        • +
        + +

        2.10.0 / 2012-05-03

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Add new start_with and end_with matchers (Jeremy Wadsack)
        • +
        • Add new matchers for specifying yields (Myron Marston): + +
            +
          • expect {...}.to yield_control
          • +
          • expect {...}.to yield_with_args(1, 2, 3)
          • +
          • expect {...}.to yield_with_no_args
          • +
          • expect {...}.to yield_successive_args(1, 2, 3)
          • +
        • +
        • match_unless_raises takes multiple exception args
        • +
        + +

        Bug fixes

        + +
          +
        • Fix be_within matcher to be inclusive of delta.
        • +
        • Fix message-specific specs to pass on Rubinius (John Firebaugh)
        • +
        + +

        2.9.1 / 2012-04-03

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Provide a helpful message if the diff between two objects is empty.
        • +
        • Fix bug diffing single strings with multiline strings.
        • +
        • Fix for error with using custom matchers inside other custom matchers +(mirasrael)
        • +
        • Fix using execution context methods in nested DSL matchers (mirasrael)
        • +
        + +

        2.9.0 / 2012-03-17

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce pollution +of RSpec::Matchers (which is included in every example).
        • +
        • Autoload files with matcher classes to improve load time.
        • +
        + +

        Bug fixes

        + +
          +
        • Align respond_to? and method_missing in DSL-defined matchers.
        • +
        • Clear out user-defined instance variables between invocations of DSL-defined +matchers.
        • +
        • Dup the instance of a DSL generated matcher so its state is not changed by +subsequent invocations.
        • +
        • Treat expected args consistently across positive and negative expectations +(thanks to Ralf Kistner for the heads up)
        • +
        + +

        2.8.0 / 2012-01-04

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Better diff output for Hash (Philippe Creux)
        • +
        • Eliminate Ruby warnings (Olek Janiszewski)
        • +
        + +

        2.8.0.rc2 / 2011-12-19

        + +

        Full Changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc1 / 2011-11-06

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Use classes for the built-in matchers (they're faster).
        • +
        • Eliminate Ruby warnings (Matijs van Zuijlen)
        • +
        + +

        2.7.0 / 2011-10-16

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • HaveMatcher converts argument using to_i (Alex Bepple & Pat Maddox)
        • +
        • Improved failure message for the have_xxx matcher (Myron Marston)
        • +
        • HaveMatcher supports count (Matthew Bellantoni)
        • +
        • Change matcher dups Enumerable before the action, supporting custom +Enumerable types like CollectionProxy in Rails (David Chelimsky)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix typo in have(n).xyz documentation (Jean Boussier)
        • +
        • fix safe_sort for ruby 1.9.2 (Kernel now defines <=> for Object) (Peter +van Hardenberg)
        • +
        + +

        2.6.0 / 2011-05-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • change matcher accepts regexps (Robert Davis)
        • +
        • better descriptions for have_xxx matchers (Magnus Bergmark)
        • +
        • range.should cover(*values) (Anders Furseth)
        • +
        + +

        Bug fixes

        + +
          +
        • Removed non-ascii characters that were choking rcov (Geoffrey Byers)
        • +
        • change matcher dups arrays and hashes so their before/after states can be +compared correctly.
        • +
        • Fix the order of inclusion of RSpec::Matchers in Test::Unit::TestCase and +MiniTest::Unit::TestCase to prevent a SystemStackError (Myron Marston)
        • +
        + +

        2.5.0 / 2011-02-05

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • should exist works with exist? or exists? (Myron Marston)
        • +
        • expect { ... }.not_to do_something (in addition to to_not)
        • +
        + +

        Documentation

        + +
          +
        • improved docs for raise_error matcher (James Almond)
        • +
        + +

        2.4.0 / 2011-01-02

        + +

        Full Changelog

        + +

        No functional changes in this release, which was made to align with the +rspec-core-2.4.0 release.

        + +

        Enhancements

        + +
          +
        • improved RDoc for change matcher (Jo Liss)
        • +
        + +

        2.3.0 / 2010-12-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • diff strings when include matcher fails (Mike Sassak)
        • +
        + +

        2.2.0 / 2010-11-28

        + +

        Full Changelog

        + +

        2.1.0 / 2010-11-07

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • be_within(delta).of(expected) matcher (Myron Marston)
        • +
        • Lots of new Cucumber features (Myron Marston)
        • +
        • Raise error if you try should != expected on Ruby-1.9 (Myron Marston)
        • +
        • Improved failure messages from throw_symbol (Myron Marston)
        • +
        + +

        Bug fixes

        + +
          +
        • Eliminate hard dependency on RSpec::Core (Myron Marston)
        • +
        • have_matcher - use pluralize only when ActiveSupport inflections are indeed +defined (Josep M Bach)
        • +
        • throw_symbol matcher no longer swallows exceptions (Myron Marston)
        • +
        • fix matcher chaining to avoid name collisions (Myron Marston)
        • +
        + +

        2.0.0 / 2010-10-10

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Add match_for_should_not method to matcher DSL (Myron Marston)
        • +
        + +

        Bug fixes

        + +
          +
        • respond_to matcher works correctly with should_not with multiple methods +(Myron Marston)
        • +
        • include matcher works correctly with should_not with multiple values +(Myron Marston)
        • +
        + +

        2.0.0.rc / 2010-10-05

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • require 'rspec/expectations' in a T::U or MiniUnit suite (Josep M. Bach)
        • +
        + +

        Bug fixes

        + +
          +
        • change by 0 passes/fails correctly (Len Smith)
        • +
        • Add description to satisfy matcher
        • +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • diffing improvements + +
            +
          • diff multiline strings
          • +
          • don't diff single line strings
          • +
          • don't diff numbers (silly)
          • +
          • diff regexp + multiline string
          • +
        • +
        + +

        Bug fixes + * should[_not] change now handles boolean values correctly

        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/file.License.html b/source/documentation/3.2/rspec-expectations/file.License.html new file mode 100644 index 000000000..9420aae75 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2012 David Chelimsky, Myron Marston
        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/file.README.html b/source/documentation/3.2/rspec-expectations/file.README.html new file mode 100644 index 000000000..bde8c350b --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/file.README.html @@ -0,0 +1,340 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        RSpec Expectations Build Status Code Climate

        + +

        RSpec::Expectations lets you express expected outcomes on an object in an +example.

        + +
        expect(.balance).to eq(Money.new(37.42, :USD))
        +
        + +

        Install

        + +

        If you want to use rspec-expectations with rspec, just install the rspec gem +and RubyGems will also install rspec-expectations for you (along with +rspec-core and rspec-mocks):

        + +
        gem install rspec
        +
        + +

        If you want to use rspec-expectations with another tool, like Test::Unit, +Minitest, or Cucumber, you can install it directly:

        + +
        gem install rspec-expectations
        +
        + +

        Basic usage

        + +

        Here's an example using rspec-core:

        + +
        RSpec.describe Order do
        +  it "sums the prices of the items in its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        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 +expresses an expected outcome. If order.total == Money.new(5.55, :USD), then +the example passes. If not, it fails with a message like:

        + +
        expected: #<Money @value=5.55 @currency=:USD>
        +     got: #<Money @value=1.11 @currency=:USD>
        +
        + +

        Built-in matchers

        + +

        Equivalence

        + +
        expect(actual).to eq(expected)  # passes if actual == expected
        +expect(actual).to eql(expected) # passes if actual.eql?(expected)
        +expect(actual).not_to eql(not_expected) # passes if not(actual.eql?(expected))
        +
        + +

        Note: The new expect syntax no longer supports the == matcher.

        + +

        Identity

        + +
        expect(actual).to be(expected)    # passes if actual.equal?(expected)
        +expect(actual).to equal(expected) # passes if actual.equal?(expected)
        +
        + +

        Comparisons

        + +
        expect(actual).to be >  expected
        +expect(actual).to be >= expected
        +expect(actual).to be <= expected
        +expect(actual).to be <  expected
        +expect(actual).to be_within(delta).of(expected)
        +
        + +

        Regular expressions

        + +
        expect(actual).to match(/expression/)
        +
        + +

        Note: The new expect syntax no longer supports the =~ matcher.

        + +

        Types/classes

        + +
        expect(actual).to be_an_instance_of(expected) # passes if actual.class == expected
        +expect(actual).to be_a(expected)              # passes if actual.is_a?(expected)
        +expect(actual).to be_an(expected)             # an alias for be_a
        +expect(actual).to be_a_kind_of(expected)      # another alias
        +
        + +

        Truthiness

        + +
        expect(actual).to be_truthy   # passes if actual is truthy (not nil or false)
        +expect(actual).to be true     # passes if actual == true
        +expect(actual).to be_falsy    # passes if actual is falsy (nil or false)
        +expect(actual).to be false    # passes if actual == false
        +expect(actual).to be_nil      # passes if actual is nil
        +expect(actual).to_not be_nil  # passes if actual is not nil
        +
        + +

        Expecting errors

        + +
        expect { ... }.to raise_error
        +expect { ... }.to raise_error(ErrorClass)
        +expect { ... }.to raise_error("message")
        +expect { ... }.to raise_error(ErrorClass, "message")
        +
        + +

        Expecting throws

        + +
        expect { ... }.to throw_symbol
        +expect { ... }.to throw_symbol(:symbol)
        +expect { ... }.to throw_symbol(:symbol, 'value')
        +
        + +

        Yielding

        + +
        expect { |b| 5.tap(&b) }.to yield_control # passes regardless of yielded args
        +
        +expect { |b| yield_if_true(true, &b) }.to yield_with_no_args # passes only if no args are yielded
        +
        +expect { |b| 5.tap(&b) }.to yield_with_args(5)
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum)
        +expect { |b| "a string".tap(&b) }.to yield_with_args(/str/)
        +
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +
        + +

        Predicate matchers

        + +
        expect(actual).to be_xxx         # passes if actual.xxx?
        +expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
        +
        + +

        Ranges (Ruby >= 1.9 only)

        + +
        expect(1..10).to cover(3)
        +
        + +

        Collection membership

        + +
        expect(actual).to include(expected)
        +expect(actual).to start_with(expected)
        +expect(actual).to end_with(expected)
        +
        +expect(actual).to contain_exactly(individual, items)
        +# ...which is the same as:
        +expect(actual).to match_array(expected_array)
        +
        + +

        Examples

        + +
        expect([1, 2, 3]).to include(1)
        +expect([1, 2, 3]).to include(1, 2)
        +expect([1, 2, 3]).to start_with(1)
        +expect([1, 2, 3]).to start_with(1, 2)
        +expect([1, 2, 3]).to end_with(3)
        +expect([1, 2, 3]).to end_with(2, 3)
        +expect({:a => 'b'}).to include(:a => 'b')
        +expect("this string").to include("is str")
        +expect("this string").to start_with("this")
        +expect("this string").to end_with("ring")
        +expect([1, 2, 3]).to contain_exactly(2, 3, 1)
        +expect([1, 2, 3]).to match_array([3, 2, 1])
        +
        + +

        should syntax

        + +

        In addition to the expect syntax, rspec-expectations continues to support the +should syntax:

        + +
        actual.should eq expected
        +actual.should be > 3
        +[1, 2, 3].should_not include 4
        +
        + +

        See detailed information on the should syntax and its usage.

        + +

        Compound Matcher Expressions

        + +

        You can also create compound matcher expressions using and or or:

        + +
        expect(alphabet).to start_with("a").and end_with("z")
        +expect(stoplight.color).to eq("red").or eq("green").or eq("yellow")
        +
        + +

        Composing Matchers

        + +

        Many of the built-in matchers are designed to take matchers as +arguments, to allow you to flexibly specify only the essential +aspects of an object or data structure. In addition, all of the +built-in matchers have one or more aliases that provide better +phrasing for when they are used as arguments to another matcher.

        + +

        Examples

        + +
        expect { k += 1.05 }.to change { k }.by( a_value_within(0.1).of(1.0) )
        +
        +expect { s = "barn" }.to change { s }
        +  .from( a_string_matching(/foo/) )
        +  .to( a_string_matching(/bar/) )
        +
        +expect(["barn", 2.45]).to contain_exactly(
        +  a_value_within(0.1).of(2.5),
        +  a_string_starting_with("bar")
        +)
        +
        +expect(["barn", "food", 2.45]).to end_with(
        +  a_string_matching("foo"),
        +  a_value > 2
        +)
        +
        +expect(["barn", 2.45]).to include( a_string_starting_with("bar") )
        +
        +expect(:a => "food", :b => "good").to include(:a => a_string_matching(/foo/))
        +
        +hash = {
        +  :a => {
        +    :b => ["foo", 5],
        +    :c => { :d => 2.05 }
        +  }
        +}
        +
        +expect(hash).to match(
        +  :a => {
        +    :b => a_collection_containing_exactly(
        +      a_string_starting_with("f"),
        +      an_instance_of(Fixnum)
        +    ),
        +    :c => { :d => (a_value < 3) }
        +  }
        +)
        +
        +expect { |probe|
        +  [1, 2, 3].each(&probe)
        +}.to yield_successive_args( a_value < 2, 2, a_value > 2 )
        +
        + +

        Usage outside rspec-core

        + +

        You always need to load rspec/expectations even if you only want to use one part of the library:

        + +
        require 'rspec/expectations'
        +
        + +

        Then simply include RSpec::Matchers in any class:

        + +
        class MyClass
        +  include RSpec::Matchers
        +
        +  def do_something(arg)
        +    expect(arg).to be > 0
        +    # do other stuff
        +  end
        +end
        +
        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/file_list.html b/source/documentation/3.2/rspec-expectations/file_list.html new file mode 100644 index 000000000..ac9df6c7e --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/file_list.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-expectations/frames.html b/source/documentation/3.2/rspec-expectations/frames.html new file mode 100644 index 000000000..43d89f7b9 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.4 + + + + diff --git a/source/documentation/3.2/rspec-expectations/index.html b/source/documentation/3.2/rspec-expectations/index.html new file mode 100644 index 000000000..bde8c350b --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/index.html @@ -0,0 +1,340 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        RSpec Expectations Build Status Code Climate

        + +

        RSpec::Expectations lets you express expected outcomes on an object in an +example.

        + +
        expect(.balance).to eq(Money.new(37.42, :USD))
        +
        + +

        Install

        + +

        If you want to use rspec-expectations with rspec, just install the rspec gem +and RubyGems will also install rspec-expectations for you (along with +rspec-core and rspec-mocks):

        + +
        gem install rspec
        +
        + +

        If you want to use rspec-expectations with another tool, like Test::Unit, +Minitest, or Cucumber, you can install it directly:

        + +
        gem install rspec-expectations
        +
        + +

        Basic usage

        + +

        Here's an example using rspec-core:

        + +
        RSpec.describe Order do
        +  it "sums the prices of the items in its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        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 +expresses an expected outcome. If order.total == Money.new(5.55, :USD), then +the example passes. If not, it fails with a message like:

        + +
        expected: #<Money @value=5.55 @currency=:USD>
        +     got: #<Money @value=1.11 @currency=:USD>
        +
        + +

        Built-in matchers

        + +

        Equivalence

        + +
        expect(actual).to eq(expected)  # passes if actual == expected
        +expect(actual).to eql(expected) # passes if actual.eql?(expected)
        +expect(actual).not_to eql(not_expected) # passes if not(actual.eql?(expected))
        +
        + +

        Note: The new expect syntax no longer supports the == matcher.

        + +

        Identity

        + +
        expect(actual).to be(expected)    # passes if actual.equal?(expected)
        +expect(actual).to equal(expected) # passes if actual.equal?(expected)
        +
        + +

        Comparisons

        + +
        expect(actual).to be >  expected
        +expect(actual).to be >= expected
        +expect(actual).to be <= expected
        +expect(actual).to be <  expected
        +expect(actual).to be_within(delta).of(expected)
        +
        + +

        Regular expressions

        + +
        expect(actual).to match(/expression/)
        +
        + +

        Note: The new expect syntax no longer supports the =~ matcher.

        + +

        Types/classes

        + +
        expect(actual).to be_an_instance_of(expected) # passes if actual.class == expected
        +expect(actual).to be_a(expected)              # passes if actual.is_a?(expected)
        +expect(actual).to be_an(expected)             # an alias for be_a
        +expect(actual).to be_a_kind_of(expected)      # another alias
        +
        + +

        Truthiness

        + +
        expect(actual).to be_truthy   # passes if actual is truthy (not nil or false)
        +expect(actual).to be true     # passes if actual == true
        +expect(actual).to be_falsy    # passes if actual is falsy (nil or false)
        +expect(actual).to be false    # passes if actual == false
        +expect(actual).to be_nil      # passes if actual is nil
        +expect(actual).to_not be_nil  # passes if actual is not nil
        +
        + +

        Expecting errors

        + +
        expect { ... }.to raise_error
        +expect { ... }.to raise_error(ErrorClass)
        +expect { ... }.to raise_error("message")
        +expect { ... }.to raise_error(ErrorClass, "message")
        +
        + +

        Expecting throws

        + +
        expect { ... }.to throw_symbol
        +expect { ... }.to throw_symbol(:symbol)
        +expect { ... }.to throw_symbol(:symbol, 'value')
        +
        + +

        Yielding

        + +
        expect { |b| 5.tap(&b) }.to yield_control # passes regardless of yielded args
        +
        +expect { |b| yield_if_true(true, &b) }.to yield_with_no_args # passes only if no args are yielded
        +
        +expect { |b| 5.tap(&b) }.to yield_with_args(5)
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum)
        +expect { |b| "a string".tap(&b) }.to yield_with_args(/str/)
        +
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +
        + +

        Predicate matchers

        + +
        expect(actual).to be_xxx         # passes if actual.xxx?
        +expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
        +
        + +

        Ranges (Ruby >= 1.9 only)

        + +
        expect(1..10).to cover(3)
        +
        + +

        Collection membership

        + +
        expect(actual).to include(expected)
        +expect(actual).to start_with(expected)
        +expect(actual).to end_with(expected)
        +
        +expect(actual).to contain_exactly(individual, items)
        +# ...which is the same as:
        +expect(actual).to match_array(expected_array)
        +
        + +

        Examples

        + +
        expect([1, 2, 3]).to include(1)
        +expect([1, 2, 3]).to include(1, 2)
        +expect([1, 2, 3]).to start_with(1)
        +expect([1, 2, 3]).to start_with(1, 2)
        +expect([1, 2, 3]).to end_with(3)
        +expect([1, 2, 3]).to end_with(2, 3)
        +expect({:a => 'b'}).to include(:a => 'b')
        +expect("this string").to include("is str")
        +expect("this string").to start_with("this")
        +expect("this string").to end_with("ring")
        +expect([1, 2, 3]).to contain_exactly(2, 3, 1)
        +expect([1, 2, 3]).to match_array([3, 2, 1])
        +
        + +

        should syntax

        + +

        In addition to the expect syntax, rspec-expectations continues to support the +should syntax:

        + +
        actual.should eq expected
        +actual.should be > 3
        +[1, 2, 3].should_not include 4
        +
        + +

        See detailed information on the should syntax and its usage.

        + +

        Compound Matcher Expressions

        + +

        You can also create compound matcher expressions using and or or:

        + +
        expect(alphabet).to start_with("a").and end_with("z")
        +expect(stoplight.color).to eq("red").or eq("green").or eq("yellow")
        +
        + +

        Composing Matchers

        + +

        Many of the built-in matchers are designed to take matchers as +arguments, to allow you to flexibly specify only the essential +aspects of an object or data structure. In addition, all of the +built-in matchers have one or more aliases that provide better +phrasing for when they are used as arguments to another matcher.

        + +

        Examples

        + +
        expect { k += 1.05 }.to change { k }.by( a_value_within(0.1).of(1.0) )
        +
        +expect { s = "barn" }.to change { s }
        +  .from( a_string_matching(/foo/) )
        +  .to( a_string_matching(/bar/) )
        +
        +expect(["barn", 2.45]).to contain_exactly(
        +  a_value_within(0.1).of(2.5),
        +  a_string_starting_with("bar")
        +)
        +
        +expect(["barn", "food", 2.45]).to end_with(
        +  a_string_matching("foo"),
        +  a_value > 2
        +)
        +
        +expect(["barn", 2.45]).to include( a_string_starting_with("bar") )
        +
        +expect(:a => "food", :b => "good").to include(:a => a_string_matching(/foo/))
        +
        +hash = {
        +  :a => {
        +    :b => ["foo", 5],
        +    :c => { :d => 2.05 }
        +  }
        +}
        +
        +expect(hash).to match(
        +  :a => {
        +    :b => a_collection_containing_exactly(
        +      a_string_starting_with("f"),
        +      an_instance_of(Fixnum)
        +    ),
        +    :c => { :d => (a_value < 3) }
        +  }
        +)
        +
        +expect { |probe|
        +  [1, 2, 3].each(&probe)
        +}.to yield_successive_args( a_value < 2, 2, a_value > 2 )
        +
        + +

        Usage outside rspec-core

        + +

        You always need to load rspec/expectations even if you only want to use one part of the library:

        + +
        require 'rspec/expectations'
        +
        + +

        Then simply include RSpec::Matchers in any class:

        + +
        class MyClass
        +  include RSpec::Matchers
        +
        +  def do_something(arg)
        +    expect(arg).to be > 0
        +    # do other stuff
        +  end
        +end
        +
        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/3.2/rspec-expectations/method_list.html b/source/documentation/3.2/rspec-expectations/method_list.html new file mode 100644 index 000000000..0b868f689 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/method_list.html @@ -0,0 +1,1757 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/3.2/rspec-expectations/top-level-namespace.html b/source/documentation/3.2/rspec-expectations/top-level-namespace.html new file mode 100644 index 000000000..683b4aea1 --- /dev/null +++ b/source/documentation/3.2/rspec-expectations/top-level-namespace.html @@ -0,0 +1,129 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + +
        Extended by:
        +
        RSpec::Matchers::DSL
        + + + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: RSpec + + + + Classes: BasicObject + + +

        + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from RSpec::Matchers::DSL

        +

        define

        + + +
        + + + + + \ No newline at end of file From a3224301122cc2def8c4e09adf52d4853f0265d8 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:29:06 +1100 Subject: [PATCH 11/14] rspec-mocks 2.99 documentation --- .../2.99/rspec-mocks/Backports.html | 212 ++ .../2.99/rspec-mocks/Kernel.html | 234 ++ .../2.99/rspec-mocks/Marshal.html | 232 ++ .../2.99/rspec-mocks/Method.html | 193 ++ .../documentation/2.99/rspec-mocks/Proc.html | 211 ++ .../documentation/2.99/rspec-mocks/RSpec.html | 129 + .../2.99/rspec-mocks/RSpec/CallerFilter.html | 276 ++ .../2.99/rspec-mocks/RSpec/Mocks.html | 1113 ++++++++ .../RSpec/Mocks/AllowanceTarget.html | 151 ++ .../rspec-mocks/RSpec/Mocks/AnyInstance.html | 117 + .../RSpec/Mocks/AnyInstance/Chain.html | 299 +++ .../AnyInstance/Chain/Customizations.html | 1187 +++++++++ .../Mocks/AnyInstance/ExpectationChain.html | 329 +++ .../RSpec/Mocks/AnyInstance/Recorder.html | 831 ++++++ .../Mocks/AnyInstanceAllowanceTarget.html | 151 ++ .../Mocks/AnyInstanceExpectationTarget.html | 151 ++ .../RSpec/Mocks/ArgumentListMatcher.html | 422 ++++ .../RSpec/Mocks/ArgumentMatchers.html | 850 +++++++ .../Mocks/ArgumentMatchers/AnyArgMatcher.html | 258 ++ .../ArgumentMatchers/AnyArgsMatcher.html | 189 ++ .../ArgumentMatchers/BooleanMatcher.html | 258 ++ .../ArgumentMatchers/DuckTypeMatcher.html | 260 ++ .../Mocks/ArgumentMatchers/EqualityProxy.html | 284 +++ .../HashExcludingMatcher.html | 316 +++ .../HashIncludingMatcher.html | 316 +++ .../Mocks/ArgumentMatchers/InstanceOf.html | 260 ++ .../RSpec/Mocks/ArgumentMatchers/KindOf.html | 260 ++ .../ArgumentMatchers/MatcherMatcher.html | 260 ++ .../Mocks/ArgumentMatchers/NoArgsMatcher.html | 189 ++ .../Mocks/ArgumentMatchers/RegexpMatcher.html | 260 ++ .../RSpec/Mocks/Configuration.html | 768 ++++++ .../rspec-mocks/RSpec/Mocks/Constant.html | 1163 +++++++++ .../RSpec/Mocks/ConstantMutator.html | 912 +++++++ .../Mocks/ConstantMutator/BaseMutator.html | 479 ++++ .../Mocks/ConstantMutator/ConstantHider.html | 396 +++ .../DefinedConstantReplacer.html | 594 +++++ .../UndefinedConstantSetter.html | 414 +++ .../rspec-mocks/RSpec/Mocks/Deprecation.html | 109 + .../2.99/rspec-mocks/RSpec/Mocks/Double.html | 145 ++ .../RSpec/Mocks/ExampleMethods.html | 898 +++++++ .../Mocks/ExampleMethods/ExpectHost.html | 117 + .../RSpec/Mocks/ExpectationTarget.html | 151 ++ .../rspec-mocks/RSpec/Mocks/Matchers.html | 117 + .../RSpec/Mocks/Matchers/HaveReceived.html | 548 ++++ .../RSpec/Mocks/Matchers/Receive.html | 556 ++++ .../Mocks/Matchers/Receive/Customization.html | 264 ++ .../RSpec/Mocks/MessageExpectation.html | 2242 +++++++++++++++++ .../RSpec/Mocks/RecursiveConstMethods.html | 590 +++++ .../2.99/rspec-mocks/RSpec/Mocks/Space.html | 1135 +++++++++ .../2.99/rspec-mocks/RSpec/Mocks/Syntax.html | 2059 +++++++++++++++ .../rspec-mocks/RSpec/Mocks/TargetBase.html | 353 +++ .../rspec-mocks/RSpec/Mocks/TestDouble.html | 693 +++++ .../RSpec/Mocks/TestDoubleProxy.html | 199 ++ .../2.99/rspec-mocks/RSpec/Mocks/Version.html | 117 + .../2.99/rspec-mocks/_index.html | 603 +++++ .../2.99/rspec-mocks/class_list.html | 58 + .../2.99/rspec-mocks/file.Changelog.html | 837 ++++++ .../2.99/rspec-mocks/file.License.html | 73 + .../2.99/rspec-mocks/file.README.html | 385 +++ .../2.99/rspec-mocks/file_list.html | 66 + .../2.99/rspec-mocks/frames.html | 26 + .../documentation/2.99/rspec-mocks/index.html | 385 +++ .../2.99/rspec-mocks/method_list.html | 1401 ++++++++++ .../2.99/rspec-mocks/top-level-namespace.html | 114 + 64 files changed, 29165 insertions(+) create mode 100644 source/documentation/2.99/rspec-mocks/Backports.html create mode 100644 source/documentation/2.99/rspec-mocks/Kernel.html create mode 100644 source/documentation/2.99/rspec-mocks/Marshal.html create mode 100644 source/documentation/2.99/rspec-mocks/Method.html create mode 100644 source/documentation/2.99/rspec-mocks/Proc.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/CallerFilter.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/AllowanceTarget.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Chain.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Chain/Customizations.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/ExpectationChain.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstanceAllowanceTarget.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstanceExpectationTarget.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgsMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/BooleanMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/DuckTypeMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/EqualityProxy.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashExcludingMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashIncludingMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/InstanceOf.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/KindOf.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/MatcherMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/NoArgsMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/RegexpMatcher.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Configuration.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Constant.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/BaseMutator.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/ConstantHider.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/DefinedConstantReplacer.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/UndefinedConstantSetter.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Deprecation.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Double.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExampleMethods.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExpectationTarget.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/HaveReceived.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/Receive.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/Receive/Customization.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/MessageExpectation.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/RecursiveConstMethods.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Space.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Syntax.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/TargetBase.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/TestDouble.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/TestDoubleProxy.html create mode 100644 source/documentation/2.99/rspec-mocks/RSpec/Mocks/Version.html create mode 100644 source/documentation/2.99/rspec-mocks/_index.html create mode 100644 source/documentation/2.99/rspec-mocks/class_list.html create mode 100644 source/documentation/2.99/rspec-mocks/file.Changelog.html create mode 100644 source/documentation/2.99/rspec-mocks/file.License.html create mode 100644 source/documentation/2.99/rspec-mocks/file.README.html create mode 100644 source/documentation/2.99/rspec-mocks/file_list.html create mode 100644 source/documentation/2.99/rspec-mocks/frames.html create mode 100644 source/documentation/2.99/rspec-mocks/index.html create mode 100644 source/documentation/2.99/rspec-mocks/method_list.html create mode 100644 source/documentation/2.99/rspec-mocks/top-level-namespace.html diff --git a/source/documentation/2.99/rspec-mocks/Backports.html b/source/documentation/2.99/rspec-mocks/Backports.html new file mode 100644 index 000000000..4c3a49892 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/Backports.html @@ -0,0 +1,212 @@ + + + + + + Module: Backports + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: Backports + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/proc.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) alias_method_chain(mod, target, feature) + + + + + +

        + + + + +
        +
        +
        +
        +3
        +4
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 3
        +
        +def self.alias_method_chain(mod, target, feature)
        +  mod.class_eval do
        +    # Strip out punctuation on predicates or bang methods since
        +    # e.g. target?_without_feature is not a valid method name.
        +    aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
        +    yield(aliased_target, punctuation) if block_given?
        +
        +    with_method, without_method = "#{aliased_target}_with_#{feature}#{punctuation}", "#{aliased_target}_without_#{feature}#{punctuation}"
        +
        +    alias_method without_method, target
        +    alias_method target, with_method
        +
        +    case
        +      when public_method_defined?(without_method)
        +        public target
        +      when protected_method_defined?(without_method)
        +        protected target
        +      when private_method_defined?(without_method)
        +        private target
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/Kernel.html b/source/documentation/2.99/rspec-mocks/Kernel.html new file mode 100644 index 000000000..a77b6f02f --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/Kernel.html @@ -0,0 +1,234 @@ + + + + + + Module: Kernel + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: Kernel + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/proc.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) lambda_with_lambda_tracking(&block) + + + + + +

        + + + + +
        +
        +
        +
        +48
        +49
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 48
        +
        +def lambda_with_lambda_tracking(&block)
        +  l = lambda_without_lambda_tracking(&block)
        +  l.send :__is_lambda__=, true unless block.send(:__is_lambda__) == false
        +  l
        +end
        +
        +
        + +
        +

        + + - (Object) proc_with_lambda_tracking(&block) + + + + + +

        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 54
        +
        +def proc_with_lambda_tracking(&block)
        +  l = proc_without_lambda_tracking(&block)
        +  l.send :__is_lambda__=, block.send(:__is_lambda__) == true
        +  l
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/Marshal.html b/source/documentation/2.99/rspec-mocks/Marshal.html new file mode 100644 index 000000000..8fb6ce787 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/Marshal.html @@ -0,0 +1,232 @@ + + + + + + Module: Marshal + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: Marshal + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/marshal.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) dump_with_mocks(object, *rest) + + + + Also known as: + dump + + + + +

        +
        + +

        Duplicates any mock objects before serialization. Otherwise, serialization +will fail because methods exist on the singleton class.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/mocks/extensions/marshal.rb', line 5
        +
        +def dump_with_mocks(object, *rest)
        +  if ::RSpec::Mocks.space.nil? || !::RSpec::Mocks.space.registered?(object) || NilClass === object
        +    dump_without_mocks(object, *rest)
        +  else
        +    unless ::RSpec::Mocks.configuration.marshal_patched?
        +      RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, ''))
        +        |Using Marshal.dump on stubbed objects relies on a monkey-patch
        +        |that is being made opt-in in RSpec 3. To silence this warning
        +        |please explicitly enable it:
        +        |
        +        |RSpec.configure do |rspec|
        +        |  rspec.mock_with :rspec do |mocks|
        +        |    mocks.patch_marshal_to_support_partial_doubles = true
        +        |  end
        +        |end
        +        |
        +        |Called from #{RSpec::CallerFilter.first_non_rspec_line}."
        +      EOS
        +    end
        +    dump_without_mocks(object.dup, *rest)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/Method.html b/source/documentation/2.99/rspec-mocks/Method.html new file mode 100644 index 000000000..02013fa2c --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/Method.html @@ -0,0 +1,193 @@ + + + + + + Class: Method + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: Method + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/proc.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) to_proc_with_lambda_tracking + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 39
        +
        +def to_proc_with_lambda_tracking
        +  proc = to_proc_without_lambda_tracking
        +  proc.send :__is_lambda__=, true
        +  proc
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/Proc.html b/source/documentation/2.99/rspec-mocks/Proc.html new file mode 100644 index 000000000..069f717c8 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/Proc.html @@ -0,0 +1,211 @@ + + + + + + Class: Proc + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: Proc + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/proc.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) lambda? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 29
        +
        +def lambda?
        +  !!__is_lambda__
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec.html b/source/documentation/2.99/rspec-mocks/RSpec.html new file mode 100644 index 000000000..8c032bc96 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec.html @@ -0,0 +1,129 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec + + + +

        + +
        + + + +
        Extended by:
        +
        Mocks::Deprecation
        + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks.rb,
        + lib/rspec/mocks/mock.rb,
        lib/rspec/mocks/space.rb,
        lib/rspec/mocks/proxy.rb,
        lib/rspec/mocks/syntax.rb,
        lib/rspec/mocks/errors.rb,
        lib/rspec/mocks/version.rb,
        lib/rspec/mocks/targets.rb,
        lib/rspec/mocks/stub_chain.rb,
        lib/rspec/mocks/deprecation.rb,
        lib/rspec/mocks/test_double.rb,
        lib/rspec/mocks/order_group.rb,
        lib/rspec/mocks/mutate_const.rb,
        lib/rspec/mocks/method_double.rb,
        lib/rspec/mocks/proxy_for_nil.rb,
        lib/rspec/mocks/configuration.rb,
        lib/rspec/mocks/caller_filter.rb,
        lib/rspec/mocks/error_generator.rb,
        lib/rspec/mocks/example_methods.rb,
        lib/rspec/mocks/matchers/receive.rb,
        lib/rspec/mocks/argument_matchers.rb,
        lib/rspec/mocks/any_instance/chain.rb,
        lib/rspec/mocks/message_expectation.rb,
        lib/rspec/mocks/any_instance/recorder.rb,
        lib/rspec/mocks/argument_list_matcher.rb,
        lib/rspec/mocks/matchers/have_received.rb,
        lib/rspec/mocks/any_instance/stub_chain.rb,
        lib/rspec/mocks/instance_method_stasher.rb,
        lib/rspec/mocks/extensions/instance_exec.rb,
        lib/rspec/mocks/any_instance/message_chains.rb,
        lib/rspec/mocks/any_instance/stub_chain_chain.rb,
        lib/rspec/mocks/any_instance/expectation_chain.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Mocks + + + + Classes: CallerFilter + + +

        + + + + + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/CallerFilter.html b/source/documentation/2.99/rspec-mocks/RSpec/CallerFilter.html new file mode 100644 index 000000000..b4d0f4de2 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/CallerFilter.html @@ -0,0 +1,276 @@ + + + + + + Class: RSpec::CallerFilter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::CallerFilter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/caller_filter.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        RSPEC_LIBS = + +
        +
        %w[
        +core
        +mocks
        +expectations
        +matchers
        +rails
        + +
        ADDITIONAL_TOP_LEVEL_FILES = + +
        +
        %w[ autorun ]
        + +
        LIB_REGEX = + +
        +
        %r{/lib/rspec/(#{(RSPEC_LIBS + ADDITIONAL_TOP_LEVEL_FILES).join('|')})(\.rb|/)}
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) first_non_rspec_line + + + + + +

        +
        + +

        Earlier rubies do not support the two argument form of caller. +This fallback is logically the same, but slower.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/mocks/caller_filter.rb', line 53
        +
        +def self.first_non_rspec_line
        +  # `caller` is an expensive method that scales linearly with the size of
        +  # the stack. The performance hit for fetching it in chunks is small,
        +  # and since the target line is probably near the top of the stack, the
        +  # overall improvement of a chunked search like this is significant.
        +  #
        +  # See benchmarks/caller.rb for measurements.
        +
        +  # Initial value here is mostly arbitrary, but is chosen to give good
        +  # performance on the common case of creating a double.
        +  increment = 5
        +  i         = 1
        +  line      = nil
        +
        +  while !line
        +    stack = caller(i, increment)
        +    return nil unless stack
        +
        +    line = stack.find { |l| l !~ LIB_REGEX }
        +
        +    i         += increment
        +    increment *= 2 # The choice of two here is arbitrary.
        +  end
        +
        +  line
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks.html new file mode 100644 index 000000000..ba8b3b0cf --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks.html @@ -0,0 +1,1113 @@ + + + + + + Module: RSpec::Mocks + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks.rb,
        + lib/rspec/mocks/mock.rb,
        lib/rspec/mocks/space.rb,
        lib/rspec/mocks/proxy.rb,
        lib/rspec/mocks/syntax.rb,
        lib/rspec/mocks/errors.rb,
        lib/rspec/mocks/version.rb,
        lib/rspec/mocks/targets.rb,
        lib/rspec/mocks/stub_chain.rb,
        lib/rspec/mocks/deprecation.rb,
        lib/rspec/mocks/test_double.rb,
        lib/rspec/mocks/order_group.rb,
        lib/rspec/mocks/mutate_const.rb,
        lib/rspec/mocks/method_double.rb,
        lib/rspec/mocks/proxy_for_nil.rb,
        lib/rspec/mocks/configuration.rb,
        lib/rspec/mocks/error_generator.rb,
        lib/rspec/mocks/example_methods.rb,
        lib/rspec/mocks/matchers/receive.rb,
        lib/rspec/mocks/argument_matchers.rb,
        lib/rspec/mocks/any_instance/chain.rb,
        lib/rspec/mocks/message_expectation.rb,
        lib/rspec/mocks/any_instance/recorder.rb,
        lib/rspec/mocks/argument_list_matcher.rb,
        lib/rspec/mocks/matchers/have_received.rb,
        lib/rspec/mocks/any_instance/stub_chain.rb,
        lib/rspec/mocks/instance_method_stasher.rb,
        lib/rspec/mocks/extensions/instance_exec.rb,
        lib/rspec/mocks/any_instance/message_chains.rb,
        lib/rspec/mocks/any_instance/stub_chain_chain.rb,
        lib/rspec/mocks/any_instance/expectation_chain.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: AnyInstance, ArgumentMatchers, Deprecation, ExampleMethods, Matchers, RecursiveConstMethods, Syntax, TestDouble, Version + + + + Classes: AllowanceTarget, AnyInstanceAllowanceTarget, AnyInstanceExpectationTarget, ArgumentListMatcher, Configuration, Constant, ConstantMutator, Double, ExpectationTarget, MessageExpectation, Space, TargetBase, TestDoubleProxy + + +

        + +

        Constant Summary

        + +
        + +
        KERNEL_METHOD_METHOD = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        +
        +
        ::Kernel.instance_method(:method)
        + +
        DEPRECATED_CONSTANTS = + +
        +
        {
        +  :Mock            => Double,
        +  :ConstantStubber => ConstantMutator,
        +}
        + +
        UnsupportedMatcherError = + +
        +
        Class.new(StandardError)
        + +
        NegationUnsupportedError = + +
        +
        Class.new(StandardError)
        + +
        + + + + + +

        Class Attribute Summary (collapse)

        +
          + +
        • + + + + (Object) space + + + + + + + + + + + + + + + + +
          +

          Returns the value of attribute space.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + +
        +

        Class Attribute Details

        + + + +
        +

        + + + (Object) space + + + + + +

        +
        + +

        Returns the value of attribute space

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/mocks.rb', line 7
        +
        +def space
        +  @space
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) allow_message(subject, message, opts = {}, &block) + + + + + +

        +
        + +

        Adds an allowance (stub) on subject

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        +

        Defines the implementation of foo on bar, using +the passed block

        +

        + +
        x = 0
        +RSpec::Mocks.allow_message(bar, :foo) { x += 1 }
        + +
        +

        Parameters:

        +
          + +
        • + + subject + + + + + + + — +
          +

          the subject to which the message will be added

          +
          + +
        • + +
        • + + message + + + + + + + — +
          +

          a symbol, representing the message that will be added.

          +
          + +
        • + +
        • + + opts + + + + + + (defaults to: {}) + + + — +
          +

          a hash of options, :expected_from is used to set the original call site

          +
          + +
        • + +
        • + + block + + + + + + + — +
          +

          an optional implementation for the allowance

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/mocks.rb', line 59
        +
        +def allow_message(subject, message, opts={}, &block)
        +  orig_caller = opts.fetch(:expected_from) {
        +    CallerFilter.first_non_rspec_line
        +  }
        +  ::RSpec::Mocks.proxy_for(subject).
        +    add_stub(orig_caller, message.to_sym, opts, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) any_instance_recorder_for(klass) + + + + + +

        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/mocks.rb', line 43
        +
        +def any_instance_recorder_for(klass)
        +  space.any_instance_recorder_for(klass)
        +end
        +
        +
        + +
        +

        + + + (Object) configuration + + + + + +

        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 76
        +
        +def self.configuration
        +  @configuration ||= Configuration.new
        +end
        +
        +
        + +
        +

        + + + (Object) const_missing(name) + + + + + +

        + + + + +
        +
        +
        +
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +
        +
        # File 'lib/rspec/mocks.rb', line 117
        +
        +def self.const_missing(name)
        +  if const = DEPRECATED_CONSTANTS[name]
        +    RSpec.deprecate("RSpec::Mocks::#{name}", :replacement => const.name)
        +    const
        +  else
        +    super
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) expect_message(subject, message, opts = {}, &block) + + + + + +

        +
        + +

        Sets a message expectation on subject.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        +

        Expect the message foo to receive bar, then call +it

        +

        + +
        RSpec::Mocks.expect_message(bar, :foo)
        +bar.foo
        + +
        +

        Parameters:

        +
          + +
        • + + subject + + + + + + + — +
          +

          the subject on which the message will be expected

          +
          + +
        • + +
        • + + message + + + + + + + — +
          +

          a symbol, representing the message that will be expected.

          +
          + +
        • + +
        • + + opts + + + + + + (defaults to: {}) + + + — +
          +

          a hash of options, :expected_from is used to set the original call site

          +
          + +
        • + +
        • + + block + + + + + + + — +
          +

          an optional implementation for the expectation

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/mocks.rb', line 78
        +
        +def expect_message(subject, message, opts={}, &block)
        +  orig_caller = opts.fetch(:expected_from) {
        +    CallerFilter.first_non_rspec_line
        +  }
        +  ::RSpec::Mocks.proxy_for(subject).
        +    add_message_expectation(orig_caller, message.to_sym, opts, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) method_handle_for(object, method_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Used internally to get a method handle for a particular object and method +name.

        + +

        Includes handling for a few special cases:

        +
        • +

          Objects that redefine #method (e.g. an HTTPRequest struct)

          +
        • +

          BasicObject subclasses that mixin a Kernel dup (e.g. SimpleDelegator)

          +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/mocks.rb', line 97
        +
        +def method_handle_for(object, method_name)
        +  if ::Kernel === object
        +    KERNEL_METHOD_METHOD.bind(object).call(method_name)
        +  else
        +    object.method(method_name)
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) proxies_of(klass) + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/mocks.rb', line 39
        +
        +def proxies_of(klass)
        +  space.proxies_of(klass)
        +end
        +
        +
        + +
        +

        + + + (Object) proxy_for(object) + + + + + +

        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/mocks.rb', line 35
        +
        +def proxy_for(object)
        +  space.proxy_for(object)
        +end
        +
        +
        + +
        +

        + + + (Object) setup(host = nil) + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/mocks.rb', line 9
        +
        +def setup(host=nil)
        +  host_is_from_rspec_core = defined?(::RSpec::Core::ExampleGroup) && host.is_a?(::RSpec::Core::ExampleGroup)
        +  if host
        +    unless host_is_from_rspec_core
        +      RSpec.deprecate(
        +        "The host argument to `RSpec::Mocks.setup`",
        +        :replacement => "`include RSpec::Mocks::ExampleMethods` in #{host.inspect}"
        +      )
        +    end
        +
        +    (class << host; self; end).class_eval do
        +      include RSpec::Mocks::ExampleMethods
        +    end
        +  end
        +  space.outside_example = false
        +end
        +
        +
        + +
        +

        + + + (Object) teardown + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/mocks.rb', line 30
        +
        +def teardown
        +  space.reset_all
        +  space.outside_example = true
        +end
        +
        +
        + +
        +

        + + + (Object) verify + + + + + +

        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/mocks.rb', line 26
        +
        +def verify
        +  space.verify_all
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AllowanceTarget.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AllowanceTarget.html new file mode 100644 index 000000000..acc72ed95 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AllowanceTarget.html @@ -0,0 +1,151 @@ + + + + + + Class: RSpec::Mocks::AllowanceTarget + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AllowanceTarget + + + +

        + +
        + +
        Inherits:
        +
        + TargetBase + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        EXPRESSION = + +
        +
        :allow
        + +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from TargetBase

        +

        delegate_to, disallow_negation, #initialize

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::TargetBase

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance.html new file mode 100644 index 000000000..1c7c7efdf --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::AnyInstance + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::AnyInstance + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/chain.rb,
        + lib/rspec/mocks/any_instance/recorder.rb,
        lib/rspec/mocks/any_instance/stub_chain.rb,
        lib/rspec/mocks/any_instance/message_chains.rb,
        lib/rspec/mocks/any_instance/stub_chain_chain.rb,
        lib/rspec/mocks/any_instance/expectation_chain.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: Chain, ExpectationChain, Recorder + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Chain.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Chain.html new file mode 100644 index 000000000..f668ba1eb --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Chain.html @@ -0,0 +1,299 @@ + + + + + + Class: RSpec::Mocks::AnyInstance::Chain + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstance::Chain + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Customizations
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/chain.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        ExpectationChain

        +
        +

        Defined Under Namespace

        +

        + + + Modules: Customizations + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Customizations

        +

        #and_call_original, #and_raise, #and_return, #and_throw, #and_yield, #any_number_of_times, #at_least, #at_most, #exactly, #once, record, #times, #twice, #with

        +
        +

        Constructor Details

        + +
        +

        + + - (Chain) initialize(recorder, *args, &block) + + + + + +

        +
        + +

        Returns a new instance of Chain

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 5
        +
        +def initialize(recorder, *args, &block)
        +  @recorder          = recorder
        +  @expectation_args  = args
        +  @expectation_block = block
        +  @source_line       = CallerFilter.first_non_rspec_line
        +  ensure_expectation_block_has_source_location
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) never + + + + + +

        + + + + +
        +
        +
        +
        +69
        +70
        +71
        +72
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 69
        +
        +def never
        +  ErrorGenerator.raise_double_negation_error("expect_any_instance_of(MyClass)") if negated?
        +  super
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Chain/Customizations.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Chain/Customizations.html new file mode 100644 index 000000000..6ee61ee8a --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Chain/Customizations.html @@ -0,0 +1,1187 @@ + + + + + + Module: RSpec::Mocks::AnyInstance::Chain::Customizations + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::AnyInstance::Chain::Customizations + + + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec::Mocks::AnyInstance::Chain
        + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/chain.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) and_call_original(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_call_original message for playback against an +instance that invokes a method stubbed or mocked using +any_instance.

          +
          + +
        • + + +
        • + + + - (Object) and_raise(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_raise message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) and_return(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_return message for playback against an +instance that invokes a method stubbed or mocked using +any_instance.

          +
          + +
        • + + +
        • + + + - (Object) and_throw(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_throw message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) and_yield(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_yield message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) any_number_of_times(*args, &block) + + + + + + + + + + + + + +
          +

          Records the any_number_of_times message for playback against +an instance that invokes a method stubbed or mocked using +any_instance.

          +
          + +
        • + + +
        • + + + - (Object) at_least(*args, &block) + + + + + + + + + + + + + +
          +

          Records the at_least message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) at_most(*args, &block) + + + + + + + + + + + + + +
          +

          Records the at_most message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) exactly(*args, &block) + + + + + + + + + + + + + +
          +

          Records the exactly message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) never(*args, &block) + + + + + + + + + + + + + +
          +

          Records the never message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) once(*args, &block) + + + + + + + + + + + + + +
          +

          Records the once message for playback against an instance that +invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) times(*args, &block) + + + + + + + + + + + + + +
          +

          Records the times message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) twice(*args, &block) + + + + + + + + + + + + + +
          +

          Records the twice message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) with(*args, &block) + + + + + + + + + + + + + +
          +

          Records the with message for playback against an instance that +invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) record(method_name) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 21
        +
        +def self.record(method_name)
        +  class_eval(<<-EOM, __FILE__, __LINE__ + 1)
        +    def #{method_name}(*args, &block)
        +      record(:#{method_name}, *args, &block)
        +    end
        +  EOM
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) and_call_original(*args, &block) + + + + + +

        +
        + +

        Records the and_call_original message for playback against an +instance that invokes a method stubbed or mocked using +any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +33
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 33
        +
        +record :and_call_original
        +
        +
        + +
        +

        + + - (Object) and_raise(*args, &block) + + + + + +

        +
        + +

        Records the and_raise message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +30
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 30
        +
        +record :and_raise
        +
        +
        + +
        +

        + + - (Object) and_return(*args, &block) + + + + + +

        +
        + +

        Records the and_return message for playback against an +instance that invokes a method stubbed or mocked using +any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +29
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 29
        +
        +record :and_return
        +
        +
        + +
        +

        + + - (Object) and_throw(*args, &block) + + + + + +

        +
        + +

        Records the and_throw message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +31
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 31
        +
        +record :and_throw
        +
        +
        + +
        +

        + + - (Object) and_yield(*args, &block) + + + + + +

        +
        + +

        Records the and_yield message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +32
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 32
        +
        +record :and_yield
        +
        +
        + +
        +

        + + - (Object) any_number_of_times(*args, &block) + + + + + +

        +
        + +

        Records the any_number_of_times message for playback against +an instance that invokes a method stubbed or mocked using +any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +37
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 37
        +
        +record :any_number_of_times
        +
        +
        + +
        +

        + + - (Object) at_least(*args, &block) + + + + + +

        +
        + +

        Records the at_least message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +41
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 41
        +
        +record :at_least
        +
        +
        + +
        +

        + + - (Object) at_most(*args, &block) + + + + + +

        +
        + +

        Records the at_most message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +42
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 42
        +
        +record :at_most
        +
        +
        + +
        +

        + + - (Object) exactly(*args, &block) + + + + + +

        +
        + +

        Records the exactly message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +38
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 38
        +
        +record :exactly
        +
        +
        + +
        +

        + + - (Object) never(*args, &block) + + + + + +

        +
        + +

        Records the never message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +40
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 40
        +
        +record :never
        +
        +
        + +
        +

        + + - (Object) once(*args, &block) + + + + + +

        +
        + +

        Records the once message for playback against an instance that +invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +35
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 35
        +
        +record :once
        +
        +
        + +
        +

        + + - (Object) times(*args, &block) + + + + + +

        +
        + +

        Records the times message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +39
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 39
        +
        +record :times
        +
        +
        + +
        +

        + + - (Object) twice(*args, &block) + + + + + +

        +
        + +

        Records the twice message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +36
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 36
        +
        +record :twice
        +
        +
        + +
        +

        + + - (Object) with(*args, &block) + + + + + +

        +
        + +

        Records the with message for playback against an instance that +invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +34
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 34
        +
        +record :with
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/ExpectationChain.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/ExpectationChain.html new file mode 100644 index 000000000..7f80fec1a --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/ExpectationChain.html @@ -0,0 +1,329 @@ + + + + + + Class: RSpec::Mocks::AnyInstance::ExpectationChain + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstance::ExpectationChain + + + Private +

        + +
        + +
        Inherits:
        +
        + Chain + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/expectation_chain.rb
        + +
        +
        + +
        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Chain

        +

        #never

        + + + + + + + + + +

        Methods included from Chain::Customizations

        +

        #and_call_original, #and_raise, #and_return, #and_throw, #and_yield, #any_number_of_times, #at_least, #at_most, #exactly, #never, #once, record, #times, #twice, #with

        +
        +

        Constructor Details

        + +
        +

        + + - (ExpectationChain) initialize(*args, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of ExpectationChain

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/mocks/any_instance/expectation_chain.rb', line 10
        +
        +def initialize(*args, &block)
        +  @expectation_fulfilled = false
        +  super
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) expectation_fulfilled? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/mocks/any_instance/expectation_chain.rb', line 6
        +
        +def expectation_fulfilled?
        +  @expectation_fulfilled || constrained_to_any_of?(:never, :any_number_of_times)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder.html new file mode 100644 index 000000000..2fd1c9f43 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder.html @@ -0,0 +1,831 @@ + + + + + + Class: RSpec::Mocks::AnyInstance::Recorder + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstance::Recorder + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/recorder.rb
        + +
        +
        + +

        Overview

        +
        + +

        Given a class TheClass, TheClass.any_instance +returns a Recorder, which records stubs and message +expectations for later playback on instances of TheClass.

        + +

        Further constraints are stored in instances of Chain.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Recorder) initialize(klass) + + + + + +

        +
        + +

        Returns a new instance of Recorder

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 16
        +
        +def initialize(klass)
        +  @message_chains = MessageChains.new
        +  @stubs = Hash.new { |hash,key| hash[key] = [] }
        +  @observed_methods = []
        +  @played_methods = {}
        +  @klass = klass
        +  @expectation_set = false
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) already_observing?(method_name) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +125
        +126
        +127
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 125
        +
        +def already_observing?(method_name)
        +  @observed_methods.include?(method_name)
        +end
        +
        +
        + +
        +

        + + - (Object) build_alias_method_name(method_name) + + + + + +

        + + + + +
        +
        +
        +
        +121
        +122
        +123
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 121
        +
        +def build_alias_method_name(method_name)
        +  "__#{method_name}_without_any_instance__"
        +end
        +
        +
        + +
        +

        + + - (Object) should_not_receive(method_name, &block) + + + + + +

        + + + + +
        +
        +
        +
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 63
        +
        +def should_not_receive(method_name, &block)
        +  should_receive(method_name, &block).never
        +end
        +
        +
        + +
        +

        + + - (Object) should_receive(method_name, &block) + + + + + +

        +
        + +

        Initializes the recording a message expectation to be played back against +any instance of this object that invokes the submitted method.

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Methods#should_receive
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 57
        +
        +def should_receive(method_name, &block)
        +  @expectation_set = true
        +  observe!(method_name)
        +  message_chains.add(method_name, ExpectationChain.new(self, method_name, &block))
        +end
        +
        +
        + +
        +

        + + - (Object) stub(method_name_or_method_map, &block) + + + + + +

        +
        + +

        Initializes the recording a stub to be played back against any instance of +this object that invokes the submitted method.

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Methods#stub
        • + +
        + +
        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 29
        +
        +def stub(method_name_or_method_map, &block)
        +  if method_name_or_method_map.is_a?(Hash)
        +    method_name_or_method_map.each do |method_name, return_value|
        +      stub(method_name).and_return(return_value)
        +    end
        +  else
        +    observe!(method_name_or_method_map)
        +    message_chains.add(method_name_or_method_map, StubChain.new(self, method_name_or_method_map, &block))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) stub_chain(*method_names_and_optional_return_values, &block) + + + + + +

        +
        + +

        Initializes the recording a stub chain to be played back against any +instance of this object that invokes the method matching the first +argument.

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Methods#stub_chain
        • + +
        + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 45
        +
        +def stub_chain(*method_names_and_optional_return_values, &block)
        +  normalize_chain(*method_names_and_optional_return_values) do |method_name, args|
        +    observe!(method_name)
        +    message_chains.add(method_name, StubChainChain.new(self, *args, &block))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) unstub(method_name) + + + + + +

        +
        + +

        Removes any previously recorded stubs, stub_chains or message expectations +that use method_name.

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Methods#unstub
        • + +
        + +
        + + + + +
        +
        +
        +
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 71
        +
        +def unstub(method_name)
        +  unless @observed_methods.include?(method_name.to_sym)
        +    raise RSpec::Mocks::MockExpectationError, "The method `#{method_name}` was not stubbed or was already unstubbed"
        +  end
        +  message_chains.remove_stub_chains_for!(method_name)
        +  ::RSpec::Mocks.proxies_of(@klass).each do |proxy|
        +    stubs[method_name].each { |stub| proxy.remove_single_stub(method_name, stub) }
        +  end
        +  stubs[method_name].clear
        +  stop_observing!(method_name) unless message_chains.has_expectation?(method_name)
        +end
        +
        +
        + +
        +

        + + - (Object) verify + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Used internally to verify that message expectations have been fulfilled.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 87
        +
        +def verify
        +  if @expectation_set && !message_chains.all_expectations_fulfilled?
        +    raise RSpec::Mocks::MockExpectationError, "Exactly one instance should have received the following message(s) but didn't: #{message_chains.unfulfilled_expectations.sort.join(', ')}"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstanceAllowanceTarget.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstanceAllowanceTarget.html new file mode 100644 index 000000000..444129495 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstanceAllowanceTarget.html @@ -0,0 +1,151 @@ + + + + + + Class: RSpec::Mocks::AnyInstanceAllowanceTarget + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstanceAllowanceTarget + + + +

        + +
        + +
        Inherits:
        +
        + TargetBase + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        EXPRESSION = + +
        +
        :expect_any_instance_of
        + +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from TargetBase

        +

        delegate_to, disallow_negation, #initialize

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::TargetBase

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstanceExpectationTarget.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstanceExpectationTarget.html new file mode 100644 index 000000000..5e62f64fe --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/AnyInstanceExpectationTarget.html @@ -0,0 +1,151 @@ + + + + + + Class: RSpec::Mocks::AnyInstanceExpectationTarget + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstanceExpectationTarget + + + +

        + +
        + +
        Inherits:
        +
        + TargetBase + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        EXPRESSION = + +
        +
        :expect_any_instance_of
        + +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from TargetBase

        +

        delegate_to, disallow_negation, #initialize

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::TargetBase

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html new file mode 100644 index 000000000..aa77d0bb9 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html @@ -0,0 +1,422 @@ + + + + + + Class: RSpec::Mocks::ArgumentListMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentListMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_list_matcher.rb
        + +
        +
        + +

        Overview

        +
        + +

        Wrapper for matching arguments against a list of expected values. Used by +the with method on a MessageExpectation:

        + +
        object.should_receive(:message).with(:a, 'b', 3)
        +object.message(:a, 'b', 3)
        + +

        Values passed to with can be literal values or argument +matchers that match against the real objects .e.g.

        + +
        object.should_receive(:message).with(hash_including(:a => 'b'))
        +
        + +

        Can also be used directly to match the contents of any Array. +This enables 3rd party mocking libs to take advantage of rspec's +argument matching without using the rest of rspec-mocks.

        + +
        require 'rspec/mocks/argument_list_matcher'
        +include RSpec::Mocks::ArgumentMatchers
        +
        +arg_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(123, hash_including(:a => 'b'))
        +arg_list_matcher.args_match?(123, :a => 'b')
        +
        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Boolean) args_match?(*args) + + + + + + + + + + + + + +
          +

          Matches each element in the expected_args against the element +in the same position of the arguments passed to new.

          +
          + +
        • + + +
        • + + + - (ArgumentListMatcher) initialize(*expected_args, &block) + + + + + + + constructor + + + + + + + + +
          +

          Initializes an ArgumentListMatcher with a collection of +literal values and/or argument matchers, or a block that handles the +evaluation for you.

          +
          + +
        • + + +
        + + +
        +

        Constructor Details

        + +
        +

        + + - (ArgumentListMatcher) initialize(*expected_args, &block) + + + + + +

        +
        + +

        Initializes an ArgumentListMatcher with a collection of +literal values and/or argument matchers, or a block that handles the +evaluation for you.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + *expected_args + + + (Array) + + + + — +
          +

          a list of expected literals and/or argument matchers

          +
          + +
        • + +
        • + + block + + + (Block) + + + + — +
          +

          a block with arity matching the expected

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/mocks/argument_list_matcher.rb', line 41
        +
        +def initialize(*expected_args, &block)
        +  @expected_args = expected_args
        +  @block = expected_args.empty? ? block : nil
        +  @match_any_args = false
        +  @matchers = nil
        +
        +  case expected_args.first
        +  when ArgumentMatchers::AnyArgsMatcher
        +    @match_any_args = true
        +  when ArgumentMatchers::NoArgsMatcher
        +    @matchers = []
        +  else
        +    @matchers = expected_args.collect {|arg| matcher_for(arg)}
        +  end
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) args_match?(*args) + + + + + +

        +
        + +

        Matches each element in the expected_args against the element +in the same position of the arguments passed to new.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + *args + + + (Array) + + + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/mocks/argument_list_matcher.rb', line 64
        +
        +def args_match?(*args)
        +  match_any_args? || block_passes?(*args) || matchers_match?(*args)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html new file mode 100644 index 000000000..beb0565b1 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html @@ -0,0 +1,850 @@ + + + + + + Module: RSpec::Mocks::ArgumentMatchers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ArgumentMatchers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleMethods
        + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + +

        Overview

        +
        + +

        ArgumentMatchers are placeholders that you can include in message +expectations to match arguments against a broader check than simple +equality.

        + +

        With the exception of any_args and no_args, they +all match against the arg in same position in the argument list.

        + + +
        +
        +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + + + Classes: AnyArgMatcher, AnyArgsMatcher, BooleanMatcher, DuckTypeMatcher, EqualityProxy, HashExcludingMatcher, HashIncludingMatcher, InstanceOf, KindOf, MatcherMatcher, NoArgsMatcher, RegexpMatcher + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) any_args + + + + + +

        +
        + +

        Matches any args at all. Supports a more explicit variation of +object.should_receive(:message)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(any_args)
        + +
        + + +
        + + + + +
        +
        +
        +
        +154
        +155
        +156
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 154
        +
        +def any_args
        +  AnyArgsMatcher.new
        +end
        +
        +
        + +
        +

        + + - (Object) anything + + + + + +

        +
        + +

        Matches any argument at all.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(anything)
        + +
        + + +
        + + + + +
        +
        +
        +
        +163
        +164
        +165
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 163
        +
        +def anything
        +  AnyArgMatcher.new(nil)
        +end
        +
        +
        + +
        +

        + + - (Object) boolean + + + + + +

        +
        + +

        Matches a boolean value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(boolean())
        + +
        + + +
        + + + + +
        +
        +
        +
        +191
        +192
        +193
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 191
        +
        +def boolean
        +  BooleanMatcher.new(nil)
        +end
        +
        +
        + +
        +

        + + - (Object) duck_type(*args) + + + + + +

        +
        + +

        Matches if the actual argument responds to the specified messages.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(duck_type(:hello))
        +object.should_receive(:message).with(duck_type(:hello, :goodbye))
        + +
        + + +
        + + + + +
        +
        +
        +
        +182
        +183
        +184
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 182
        +
        +def duck_type(*args)
        +  DuckTypeMatcher.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) hash_excluding(*args) + + + + Also known as: + hash_not_including + + + + +

        +
        + +

        Matches a hash that doesn't include the specified key(s) or key/value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(hash_excluding(:key => val))
        +object.should_receive(:message).with(hash_excluding(:key))
        +object.should_receive(:message).with(hash_excluding(:key, :key2 => :val2))
        + +
        + + +
        + + + + +
        +
        +
        +
        +214
        +215
        +216
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 214
        +
        +def hash_excluding(*args)
        +  HashExcludingMatcher.new(anythingize_lonely_keys(*args))
        +end
        +
        +
        + +
        +

        + + - (Object) hash_including(*args) + + + + + +

        +
        + +

        Matches a hash that includes the specified key(s) or key/value pairs. +Ignores any additional keys.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(hash_including(:key => val))
        +object.should_receive(:message).with(hash_including(:key))
        +object.should_receive(:message).with(hash_including(:key, :key2 => val2))
        + +
        + + +
        + + + + +
        +
        +
        +
        +203
        +204
        +205
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 203
        +
        +def hash_including(*args)
        +  HashIncludingMatcher.new(anythingize_lonely_keys(*args))
        +end
        +
        +
        + +
        +

        + + - (Object) instance_of(klass) + + + + Also known as: + an_instance_of + + + + +

        +
        + +

        Matches if arg.instance_of?(klass)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(instance_of(Thing))
        + +
        + + +
        + + + + +
        +
        +
        +
        +225
        +226
        +227
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 225
        +
        +def instance_of(klass)
        +  InstanceOf.new(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) kind_of(klass) + + + + Also known as: + a_kind_of + + + + +

        +
        + +

        Matches if arg.kind_of?(klass)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(kind_of(Thing))
        + +
        + + +
        + + + + +
        +
        +
        +
        +235
        +236
        +237
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 235
        +
        +def kind_of(klass)
        +  KindOf.new(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) no_args + + + + + +

        +
        + +

        Matches no arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(no_args)
        + +
        + + +
        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 172
        +
        +def no_args
        +  NoArgsMatcher.new
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgMatcher.html new file mode 100644 index 000000000..eb3ab16de --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgMatcher.html @@ -0,0 +1,258 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::AnyArgMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::AnyArgMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (AnyArgMatcher) initialize(ignore) + + + + + +

        +
        + +

        Returns a new instance of AnyArgMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 21
        +
        +def initialize(ignore)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(other) + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 24
        +
        +def ==(other)
        +  true
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgsMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgsMatcher.html new file mode 100644 index 000000000..8463aa9d3 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgsMatcher.html @@ -0,0 +1,189 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::AnyArgsMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::AnyArgsMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 15
        +
        +def description
        +  "any args"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/BooleanMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/BooleanMatcher.html new file mode 100644 index 000000000..264bc3139 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/BooleanMatcher.html @@ -0,0 +1,258 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::BooleanMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::BooleanMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (BooleanMatcher) initialize(ignore) + + + + + +

        +
        + +

        Returns a new instance of BooleanMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +46
        +47
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 46
        +
        +def initialize(ignore)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(value) + + + + + +

        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 49
        +
        +def ==(value)
        +  [true,false].include?(value)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/DuckTypeMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/DuckTypeMatcher.html new file mode 100644 index 000000000..733808805 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/DuckTypeMatcher.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::DuckTypeMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::DuckTypeMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (DuckTypeMatcher) initialize(*methods_to_respond_to) + + + + + +

        +
        + +

        Returns a new instance of DuckTypeMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 87
        +
        +def initialize(*methods_to_respond_to)
        +  @methods_to_respond_to = methods_to_respond_to
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(value) + + + + + +

        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 91
        +
        +def ==(value)
        +  @methods_to_respond_to.all? {|message| value.respond_to?(message)}
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/EqualityProxy.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/EqualityProxy.html new file mode 100644 index 000000000..b5f6ddd58 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/EqualityProxy.html @@ -0,0 +1,284 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::EqualityProxy + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::EqualityProxy + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (EqualityProxy) initialize(given) + + + + + +

        +
        + +

        Returns a new instance of EqualityProxy

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 107
        +
        +def initialize(given)
        +  @given = given
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(expected) + + + + + +

        + + + + +
        +
        +
        +
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 111
        +
        +def ==(expected)
        +  if defined?(DateTime) && DateTime === expected
        +    RSpec.warn_deprecation <<-WARN.gsub(/^\s*\|/,'')
        +      |In RSpec 3.0.0 matchers use `#===` (the match operator) to perform
        +      |comparision between expected and actual arguments. Due to strange
        +      |behaviour with `DateTime#===` (which ignores the time of the object
        +      |when performing a comparison) this may result in undesired
        +      |behaviour. We recommend you switch to a `Date` or `Time` object
        +      |instead.
        +      |
        +      |Called from: #{RSpec::CallerFilter.first_non_rspec_line}
        +    WARN
        +  end
        +  @given == expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashExcludingMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashExcludingMatcher.html new file mode 100644 index 000000000..bd65ac163 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashExcludingMatcher.html @@ -0,0 +1,316 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (HashExcludingMatcher) initialize(expected) + + + + + +

        +
        + +

        Returns a new instance of HashExcludingMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +71
        +72
        +73
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 71
        +
        +def initialize(expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(actual) + + + + + +

        + + + + +
        +
        +
        +
        +75
        +76
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 75
        +
        +def ==(actual)
        +  @expected.none? {|k,v| actual.has_key?(k) && v == actual[k]}
        +rescue NoMethodError
        +  false
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 81
        +
        +def description
        +  "hash_not_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashIncludingMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashIncludingMatcher.html new file mode 100644 index 000000000..bbc9e9ba7 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashIncludingMatcher.html @@ -0,0 +1,316 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (HashIncludingMatcher) initialize(expected) + + + + + +

        +
        + +

        Returns a new instance of HashIncludingMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 55
        +
        +def initialize(expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(actual) + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 59
        +
        +def ==(actual)
        +  @expected.all? {|k,v| actual.has_key?(k) && v == actual[k]}
        +rescue NoMethodError
        +  false
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 65
        +
        +def description
        +  "hash_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/InstanceOf.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/InstanceOf.html new file mode 100644 index 000000000..ebcecf1bc --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/InstanceOf.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::InstanceOf + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::InstanceOf + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (InstanceOf) initialize(klass) + + + + + +

        +
        + +

        Returns a new instance of InstanceOf

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +129
        +130
        +131
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 129
        +
        +def initialize(klass)
        +  @klass = klass
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(actual) + + + + + +

        + + + + +
        +
        +
        +
        +133
        +134
        +135
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 133
        +
        +def ==(actual)
        +  actual.instance_of?(@klass)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/KindOf.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/KindOf.html new file mode 100644 index 000000000..eb8ac0a9f --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/KindOf.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::KindOf + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::KindOf + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (KindOf) initialize(klass) + + + + + +

        +
        + +

        Returns a new instance of KindOf

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 139
        +
        +def initialize(klass)
        +  @klass = klass
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(actual) + + + + + +

        + + + + +
        +
        +
        +
        +143
        +144
        +145
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 143
        +
        +def ==(actual)
        +  actual.kind_of?(@klass)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/MatcherMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/MatcherMatcher.html new file mode 100644 index 000000000..c05c6a85b --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/MatcherMatcher.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::MatcherMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::MatcherMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (MatcherMatcher) initialize(matcher) + + + + + +

        +
        + +

        Returns a new instance of MatcherMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 97
        +
        +def initialize(matcher)
        +  @matcher = matcher
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(value) + + + + + +

        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 101
        +
        +def ==(value)
        +  @matcher.matches?(value)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/NoArgsMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/NoArgsMatcher.html new file mode 100644 index 000000000..fb1171717 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/NoArgsMatcher.html @@ -0,0 +1,189 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::NoArgsMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::NoArgsMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 30
        +
        +def description
        +  "no args"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/RegexpMatcher.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/RegexpMatcher.html new file mode 100644 index 000000000..f24762567 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ArgumentMatchers/RegexpMatcher.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::RegexpMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::RegexpMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (RegexpMatcher) initialize(regexp) + + + + + +

        +
        + +

        Returns a new instance of RegexpMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 36
        +
        +def initialize(regexp)
        +  @regexp = regexp
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(value) + + + + + +

        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 40
        +
        +def ==(value)
        +  Regexp === value ? value == @regexp : value =~ @regexp
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Configuration.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Configuration.html new file mode 100644 index 000000000..0f1846e83 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Configuration.html @@ -0,0 +1,768 @@ + + + + + + Class: RSpec::Mocks::Configuration + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/configuration.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides configuration options for rspec-mocks.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Configuration) initialize + + + + + +

        +
        + +

        Returns a new instance of Configuration

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 6
        +
        +def initialize
        +  @yield_receiver_to_any_instance_implementation_blocks = false
        +  @should_warn_about_any_instance_blocks = true
        +  @marshal_patched = false
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_stub_and_should_receive_to(*modules) + + + + + +

        +
        + +

        Adds stub and should_receive to the given modules +or classes. This is usually only necessary if you application uses some +proxy classes that “strip themselves down” to a bare minimum set of methods +and remove stub and should_receive in the +process.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.mock_with :rspec do |mocks|
        +    mocks.add_stub_and_should_receive_to Delegator
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 40
        +
        +def add_stub_and_should_receive_to(*modules)
        +  modules.each do |mod|
        +    Syntax.enable_should(mod)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) marshal_patched? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +71
        +72
        +73
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 71
        +
        +def marshal_patched?
        +  @marshal_patched
        +end
        +
        +
        + +
        +

        + + - (Object) patch_marshal_to_support_partial_doubles=(val) + + + + + +

        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 67
        +
        +def patch_marshal_to_support_partial_doubles=(val)
        +  @marshal_patched = val
        +end
        +
        +
        + +
        +

        + + - (Boolean) should_warn_about_any_instance_blocks? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 21
        +
        +def should_warn_about_any_instance_blocks?
        +  @should_warn_about_any_instance_blocks
        +end
        +
        +
        + +
        +

        + + - (Object) syntax + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 60
        +
        +def syntax
        +  syntaxes = []
        +  syntaxes << :should  if Syntax.should_enabled?
        +  syntaxes << :expect if Syntax.expect_enabled?
        +  syntaxes
        +end
        +
        +
        + +
        +

        + + - (Object) syntax=(values) + + + + + +

        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 46
        +
        +def syntax=(values)
        +  if Array(values).include?(:expect)
        +    Syntax.enable_expect
        +  else
        +    Syntax.disable_expect
        +  end
        +
        +  if Array(values).include?(:should)
        +    Syntax.enable_should
        +  else
        +    Syntax.disable_should
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) yield_receiver_to_any_instance_implementation_blocks=(arg) + + + + + +

        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 16
        +
        +def yield_receiver_to_any_instance_implementation_blocks=(arg)
        +  @should_warn_about_any_instance_blocks = false
        +  @yield_receiver_to_any_instance_implementation_blocks = arg
        +end
        +
        +
        + +
        +

        + + - (Boolean) yield_receiver_to_any_instance_implementation_blocks? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 12
        +
        +def yield_receiver_to_any_instance_implementation_blocks?
        +  @yield_receiver_to_any_instance_implementation_blocks
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Constant.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Constant.html new file mode 100644 index 000000000..0a76aa28a --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Constant.html @@ -0,0 +1,1163 @@ + + + + + + Class: RSpec::Mocks::Constant + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Constant + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        RecursiveConstMethods
        + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides information about constants that may (or may not) have been +mutated by rspec-mocks.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) hidden + + + + + + + + + + writeonly + + + + + + private + + +
          + +
        • + + +
        • + + + - (String) name + + + + + + + + + readonly + + + + + + + + + +
          +

          The fully qualified name of the constant.

          +
          + +
        • + + +
        • + + + - (Object?) original_value + + + + + + + + + + + + + + + + +
          +

          The original value (e.g. before it was mutated by rspec-mocks) of the +constant, or nil if the constant was not previously defined.

          +
          + +
        • + + +
        • + + + - (Object) previously_defined + + + + + + + + + + writeonly + + + + + + private + + +
          + +
        • + + +
        • + + + - (Object) stubbed + + + + + + + + + + writeonly + + + + + + private + + +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (Constant) original(name) + + + + + + + + + + + + + +
          +

          Queries rspec-mocks to find out information about the named constant.

          +
          + +
        • + + +
        + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Boolean) hidden? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has hidden this constant.

          +
          + +
        • + + +
        • + + + - (Constant) initialize(name) + + + + + + + constructor + + + + + + private + + +
          +

          A new instance of Constant.

          +
          + +
        • + + +
        • + + + - (Boolean) mutated? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has mutated (stubbed or hidden) this constant.

          +
          + +
        • + + +
        • + + + - (Boolean) previously_defined? + + + + + + + + + + + + + +
          +

          Whether or not the constant was defined before the current example.

          +
          + +
        • + + +
        • + + + - (Boolean) stubbed? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has stubbed this constant.

          +
          + +
        • + + +
        • + + + - (Object) to_s + + + + (also: #inspect) + + + + + + + + + + + +
          + +
        • + + +
        + + + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        const_defined_on?, constants_defined_on, get_const_defined_on, normalize_const_name, recursive_const_defined?, recursive_const_get

        +
        +

        Constructor Details

        + +
        +

        + + - (Constant) initialize(name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of Constant

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 84
        +
        +def initialize(name)
        +  @name = name
        +  @previously_defined = false
        +  @stubbed = false
        +  @hidden = false
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) hidden=(value) (writeonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 100
        +
        +def hidden=(value)
        +  @hidden = value
        +end
        +
        +
        + + + +
        +

        + + - (String) name (readonly) + + + + + +

        +
        + +

        Returns The fully qualified name of the constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The fully qualified name of the constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 92
        +
        +def name
        +  @name
        +end
        +
        +
        + + + +
        +

        + + - (Object?) original_value + + + + + +

        +
        + +

        Returns The original value (e.g. before it was mutated by rspec-mocks) of +the constant, or nil if the constant was not previously defined.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object, nil) + + + + — +
          +

          The original value (e.g. before it was mutated by rspec-mocks) of the +constant, or nil if the constant was not previously defined.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 97
        +
        +def original_value
        +  @original_value
        +end
        +
        +
        + + + +
        +

        + + - (Object) previously_defined=(value) (writeonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 100
        +
        +def previously_defined=(value)
        +  @previously_defined = value
        +end
        +
        +
        + + + +
        +

        + + - (Object) stubbed=(value) (writeonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 100
        +
        +def stubbed=(value)
        +  @stubbed = value
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Constant) original(name) + + + + + +

        +
        + +

        Queries rspec-mocks to find out information about the named constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + + — +
          +

          the name of the constant

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Constant) + + + + — +
          +

          an object contaning information about the named constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +148
        +149
        +150
        +151
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 148
        +
        +def self.original(name)
        +  mutator = ConstantMutator.find(name)
        +  mutator ? mutator.to_constant : unmutated(name)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) hidden? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has hidden this constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has hidden this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +122
        +123
        +124
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 122
        +
        +def hidden?
        +  @hidden
        +end
        +
        +
        + +
        +

        + + - (Boolean) mutated? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has mutated (stubbed or hidden) this +constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has mutated (stubbed or hidden) this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 110
        +
        +def mutated?
        +  @stubbed || @hidden
        +end
        +
        +
        + +
        +

        + + - (Boolean) previously_defined? + + + + + +

        +
        + +

        Returns Whether or not the constant was defined before the current example.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not the constant was defined before the current example.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 104
        +
        +def previously_defined?
        +  @previously_defined
        +end
        +
        +
        + +
        +

        + + - (Boolean) stubbed? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has stubbed this constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has stubbed this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +116
        +117
        +118
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 116
        +
        +def stubbed?
        +  @stubbed
        +end
        +
        +
        + +
        +

        + + - (Object) to_s + + + + Also known as: + inspect + + + + +

        + + + + +
        +
        +
        +
        +126
        +127
        +128
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 126
        +
        +def to_s
        +  "#<#{self.class.name} #{name}>"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator.html new file mode 100644 index 000000000..4f5c6a9e9 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator.html @@ -0,0 +1,912 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        RecursiveConstMethods
        + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides a means to stub constants.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: BaseMutator, ConstantHider, DefinedConstantReplacer, UndefinedConstantSetter + + +

        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        const_defined_on?, constants_defined_on, get_const_defined_on, normalize_const_name, recursive_const_defined?, recursive_const_get

        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) find(name) + + + + + +

        + + + + +
        +
        +
        +
        +385
        +386
        +387
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 385
        +
        +def self.find(name)
        +  mutators.find { |s| s.full_constant_name == name }
        +end
        +
        +
        + +
        +

        + + + (Object) hide(constant_name) + + + + + +

        +
        + +
        + Note: +
        +

        It's recommended that you use hide_const in your examples. +This is an alternate public API that is provided so you can hide constants +in other contexts (e.g. helper classes).

        +
        +
        + + +

        Hides a constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +192
        +193
        +194
        +195
        +196
        +197
        +198
        +199
        +200
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 192
        +
        +def self.hide(constant_name)
        +  space = RSpec::Mocks.space
        +  space.print_out_of_example_deprecation if space.outside_example
        +
        +  return unless recursive_const_defined?(constant_name)
        +
        +  mutate(ConstantHider.new(constant_name, nil, { }))
        +  nil
        +end
        +
        +
        + +
        +

        + + + (Object) mutate(mutator) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Uses the mutator to mutate (stub or hide) a constant. Ensures that the +mutator is correctly registered so it can be backed out at the end of the +test.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +354
        +355
        +356
        +357
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 354
        +
        +def self.mutate(mutator)
        +  register_mutator(mutator)
        +  mutator.mutate
        +end
        +
        +
        + +
        +

        + + + (Object) mutators + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        The list of constant mutators that have been used for the current example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +376
        +377
        +378
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 376
        +
        +def self.mutators
        +  @mutators ||= []
        +end
        +
        +
        + +
        +

        + + + (Object) raise_on_invalid_const + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Used internally by the constant stubbing to raise a helpful error when a +constant like “A::B::C” is stubbed and A::B is not a module (and thus, +it's impossible to define “A::B::C” since only modules can have nested +constants).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +395
        +396
        +397
        +398
        +399
        +400
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 395
        +
        +def self.raise_on_invalid_const
        +  lambda do |const_name, failed_name|
        +    raise "Cannot stub constant #{failed_name} on #{const_name} " +
        +          "since #{const_name} is not a module."
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) register_mutator(mutator) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +381
        +382
        +383
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 381
        +
        +def self.register_mutator(mutator)
        +  mutators << mutator
        +end
        +
        +
        + +
        +

        + + + (Object) reset_all + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Resets all stubbed constants. This is called automatically by rspec-mocks +when an example finishes.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +363
        +364
        +365
        +366
        +367
        +368
        +369
        +370
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 363
        +
        +def self.reset_all
        +  # We use reverse order so that if the same constant
        +  # was stubbed multiple times, the original value gets
        +  # properly restored.
        +  mutators.reverse.each { |s| s.rspec_reset }
        +
        +  mutators.clear
        +end
        +
        +
        + +
        +

        + + + (Object) stub(constant_name, value, options = {}) + + + + + +

        +
        + +
        + Note: +
        +

        It's recommended that you use stub_const in your examples. +This is an alternate public API that is provided so you can stub constants +in other contexts (e.g. helper classes).

        +
        +
        + + +

        Stubs a constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        • + + value + + + (Object) + + + + — +
          +

          The value to make the constant refer to. When the example completes, the +constant will be restored to its prior state.

          +
          + +
        • + +
        • + + options + + + (Hash) + + + (defaults to: {}) + + + — +
          +

          Stubbing options.

          +
          + +
        • + +
        + + + + + + + + +

        Options Hash (options):

        +
          + +
        • + :transfer_nested_constants + (Boolean, Array<Symbol>) + + + + + —
          +

          Determines what nested constants, if any, will be transferred from the +original value of the constant to the new value of the constant. This only +works if both the original and new values are modules (or classes).

          +
          + +
        • + +
        + + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +
          +

          the stubbed value of the constant

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 169
        +
        +def self.stub(constant_name, value, options = {})
        +  space = RSpec::Mocks.space
        +  space.print_out_of_example_deprecation if space.outside_example
        +
        +  mutator = if recursive_const_defined?(constant_name, &raise_on_invalid_const)
        +    DefinedConstantReplacer
        +  else
        +    UndefinedConstantSetter
        +  end
        +
        +  mutate(mutator.new(constant_name, value, options[:transfer_nested_constants]))
        +  value
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/BaseMutator.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/BaseMutator.html new file mode 100644 index 000000000..8949cbb84 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/BaseMutator.html @@ -0,0 +1,479 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator::BaseMutator + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator::BaseMutator + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        RecursiveConstMethods
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Contains common functionality used by all of the constant mutators.

        + + +
        +
        +
        + + +
        + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        #const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get

        +
        +

        Constructor Details

        + +
        +

        + + - (BaseMutator) initialize(full_constant_name, mutated_value, transfer_nested_constants) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of BaseMutator

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +210
        +211
        +212
        +213
        +214
        +215
        +216
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 210
        +
        +def initialize(full_constant_name, mutated_value, transfer_nested_constants)
        +  @full_constant_name        = normalize_const_name(full_constant_name)
        +  @mutated_value             = mutated_value
        +  @transfer_nested_constants = transfer_nested_constants
        +  @context_parts             = @full_constant_name.split('::')
        +  @const_name                = @context_parts.pop
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) full_constant_name (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +208
        +209
        +210
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 208
        +
        +def full_constant_name
        +  @full_constant_name
        +end
        +
        +
        + + + +
        +

        + + - (Object) original_value (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +208
        +209
        +210
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 208
        +
        +def original_value
        +  @original_value
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) to_constant + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +218
        +219
        +220
        +221
        +222
        +223
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 218
        +
        +def to_constant
        +  const = Constant.new(full_constant_name)
        +  const.original_value = original_value
        +
        +  const
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/ConstantHider.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/ConstantHider.html new file mode 100644 index 000000000..1fdd1fca9 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/ConstantHider.html @@ -0,0 +1,396 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator::ConstantHider + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator::ConstantHider + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMutator + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Hides a defined constant for the duration of an example.

        + + +
        +
        +
        + + +
        + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMutator

        +

        #full_constant_name, #original_value

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMutator

        +

        #initialize

        + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        #const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::ConstantMutator::BaseMutator

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) mutate + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +230
        +231
        +232
        +233
        +234
        +235
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 230
        +
        +def mutate
        +  @context = recursive_const_get(@context_parts.join('::'))
        +  @original_value = get_const_defined_on(@context, @const_name)
        +
        +  @context.__send__(:remove_const, @const_name)
        +end
        +
        +
        + +
        +

        + + - (Object) rspec_reset + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +245
        +246
        +247
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 245
        +
        +def rspec_reset
        +  @context.const_set(@const_name, @original_value)
        +end
        +
        +
        + +
        +

        + + - (Object) to_constant + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +237
        +238
        +239
        +240
        +241
        +242
        +243
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 237
        +
        +def to_constant
        +  const = super
        +  const.hidden = true
        +  const.previously_defined = true
        +
        +  const
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/DefinedConstantReplacer.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/DefinedConstantReplacer.html new file mode 100644 index 000000000..edc87e145 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/DefinedConstantReplacer.html @@ -0,0 +1,594 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator::DefinedConstantReplacer + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator::DefinedConstantReplacer + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMutator + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Replaces a defined constant for the duration of an example.

        + + +
        +
        +
        + + +
        + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMutator

        +

        #full_constant_name, #original_value

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMutator

        +

        #initialize

        + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        #const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::ConstantMutator::BaseMutator

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) mutate + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +254
        +255
        +256
        +257
        +258
        +259
        +260
        +261
        +262
        +263
        +264
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 254
        +
        +def mutate
        +  @context = recursive_const_get(@context_parts.join('::'))
        +  @original_value = get_const_defined_on(@context, @const_name)
        +
        +  constants_to_transfer = verify_constants_to_transfer!
        +
        +  @context.__send__(:remove_const, @const_name)
        +  @context.const_set(@const_name, @mutated_value)
        +
        +  transfer_nested_constants(constants_to_transfer)
        +end
        +
        +
        + +
        +

        + + - (Object) rspec_reset + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +274
        +275
        +276
        +277
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 274
        +
        +def rspec_reset
        +  @context.__send__(:remove_const, @const_name)
        +  @context.const_set(@const_name, @original_value)
        +end
        +
        +
        + +
        +

        + + - (Object) to_constant + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +266
        +267
        +268
        +269
        +270
        +271
        +272
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 266
        +
        +def to_constant
        +  const = super
        +  const.stubbed = true
        +  const.previously_defined = true
        +
        +  const
        +end
        +
        +
        + +
        +

        + + - (Object) transfer_nested_constants(constants) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +279
        +280
        +281
        +282
        +283
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 279
        +
        +def transfer_nested_constants(constants)
        +  constants.each do |const|
        +    @mutated_value.const_set(const, get_const_defined_on(original_value, const))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) verify_constants_to_transfer! + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +285
        +286
        +287
        +288
        +289
        +290
        +291
        +292
        +293
        +294
        +295
        +296
        +297
        +298
        +299
        +300
        +301
        +302
        +303
        +304
        +305
        +306
        +307
        +308
        +309
        +310
        +311
        +312
        +313
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 285
        +
        +def verify_constants_to_transfer!
        +  return [] unless @transfer_nested_constants
        +
        +  { @original_value => "the original value", @mutated_value => "the stubbed value" }.each do |value, description|
        +    unless value.respond_to?(:constants)
        +      raise ArgumentError,
        +        "Cannot transfer nested constants for #{@full_constant_name} " +
        +        "since #{description} is not a class or module and only classes " +
        +        "and modules support nested constants."
        +    end
        +  end
        +
        +  if @transfer_nested_constants.is_a?(Array)
        +    @transfer_nested_constants = @transfer_nested_constants.map(&:to_s) if RUBY_VERSION == '1.8.7'
        +    undefined_constants = @transfer_nested_constants - constants_defined_on(@original_value)
        +
        +    if undefined_constants.any?
        +      available_constants = constants_defined_on(@original_value) - @transfer_nested_constants
        +      raise ArgumentError,
        +        "Cannot transfer nested constant(s) #{undefined_constants.join(' and ')} " +
        +        "for #{@full_constant_name} since they are not defined. Did you mean " +
        +        "#{available_constants.join(' or ')}?"
        +    end
        +
        +    @transfer_nested_constants
        +  else
        +    constants_defined_on(@original_value)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/UndefinedConstantSetter.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/UndefinedConstantSetter.html new file mode 100644 index 000000000..1bc17d09c --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ConstantMutator/UndefinedConstantSetter.html @@ -0,0 +1,414 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator::UndefinedConstantSetter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator::UndefinedConstantSetter + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMutator + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Sets an undefined constant for the duration of an example.

        + + +
        +
        +
        + + +
        + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMutator

        +

        #full_constant_name, #original_value

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMutator

        +

        #initialize

        + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        #const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::ConstantMutator::BaseMutator

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) mutate + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +320
        +321
        +322
        +323
        +324
        +325
        +326
        +327
        +328
        +329
        +330
        +331
        +332
        +333
        +334
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 320
        +
        +def mutate
        +  remaining_parts = @context_parts.dup
        +  @deepest_defined_const = @context_parts.inject(Object) do |klass, name|
        +    break klass unless const_defined_on?(klass, name)
        +    remaining_parts.shift
        +    get_const_defined_on(klass, name)
        +  end
        +
        +  context = remaining_parts.inject(@deepest_defined_const) do |klass, name|
        +    klass.const_set(name, Module.new)
        +  end
        +
        +  @const_to_remove = remaining_parts.first || @const_name
        +  context.const_set(@const_name, @mutated_value)
        +end
        +
        +
        + +
        +

        + + - (Object) rspec_reset + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +344
        +345
        +346
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 344
        +
        +def rspec_reset
        +  @deepest_defined_const.__send__(:remove_const, @const_to_remove)
        +end
        +
        +
        + +
        +

        + + - (Object) to_constant + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +336
        +337
        +338
        +339
        +340
        +341
        +342
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 336
        +
        +def to_constant
        +  const = super
        +  const.stubbed = true
        +  const.previously_defined = false
        +
        +  const
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Deprecation.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Deprecation.html new file mode 100644 index 000000000..bd0010888 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Deprecation.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Mocks::Deprecation + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Deprecation + + + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec
        + + + +
        Defined in:
        +
        lib/rspec/mocks/deprecation.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Double.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Double.html new file mode 100644 index 000000000..618c03ba5 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Double.html @@ -0,0 +1,145 @@ + + + + + + Class: RSpec::Mocks::Double + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Double + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        TestDouble
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mock.rb
        + +
        +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from TestDouble

        +

        #==, #__warn_if_used_further!, #as_null_object, extend_onto, #freeze, #initialize, #null_object?

        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + + in the class RSpec::Mocks::TestDouble + +

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExampleMethods.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExampleMethods.html new file mode 100644 index 000000000..e63debf96 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExampleMethods.html @@ -0,0 +1,898 @@ + + + + + + Module: RSpec::Mocks::ExampleMethods + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ExampleMethods + + + +

        + +
        + + + + + +
        Includes:
        +
        ArgumentMatchers
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/example_methods.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: ExpectHost + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from ArgumentMatchers

        +

        #any_args, #anything, #boolean, #duck_type, #hash_excluding, #hash_including, #instance_of, #kind_of, #no_args

        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) allow_message_expectations_on_nil + + + + + +

        +
        + +

        Disables warning messages about expectations being set on nil.

        + +

        By default warning messages are issued when expectations are set on nil. +This is to prevent false-positives and to catch potential bugs early on.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 51
        +
        +def allow_message_expectations_on_nil
        +  RSpec::Mocks.space.proxy_for(nil).warn_about_expectations = false
        +end
        +
        +
        + +
        +

        + + + - (Mock) double + + - (Mock) double(name) + + - (Mock) double(stubs) + + - (Mock) double(name, stubs) + + + + + + +

        +
        + +

        Constructs an instance of :Mocks::Mock +configured with an optional name, used for reporting in failure messages, +and an optional hash of method/return-value pairs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +book = double("book", :title => "The RSpec Book")
        +book.title #=> "The RSpec Book"
        +
        +card = double("card", :suit => "Spades", :rank => "A")
        +card.suit  #=> "Spades"
        +card.rank  #=> "A"
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (String/Symbol) + + + + — +
          +

          (optional) used in clarify intent

          +
          + +
        • + +
        • + + stubs + + + (Hash) + + + + — +
          +

          (optional) hash of method/return-value pairs

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Mock) + + + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 30
        +
        +def double(*args)
        +  declare_double('Double', *args)
        +end
        +
        +
        + +
        +

        + + - (Object) have_received(method_name) + + + + + +

        +
        + +

        Verifies that the given object received the expected message during the +course of the test. The method must have previously been stubbed in order +for messages to be verified.

        + +

        Stubbing and verifying messages received in this way implements the Test +Spy pattern.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +invitation = double('invitation', accept: true)
        +user.accept_invitation(invitation)
        +expect(invitation).to have_received(:accept)
        +
        +# You can also use most message expectations:
        +expect(invitation).to have_received(:accept).with(mailer).once
        + +
        +

        Parameters:

        +
          + +
        • + + method_name + + + (Symbol) + + + + — +
          +

          name of the method expected to have been called.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +130
        +131
        +132
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 130
        +
        +def have_received(method_name)
        +  Matchers::HaveReceived.new(method_name)
        +end
        +
        +
        + +
        +

        + + - (Object) hide_const(constant_name) + + + + + +

        +
        + +

        Hides the named constant with the given value. The constant will be +undefined for the duration of the test.

        + +

        Like method stubs, the constant will be restored to its original value when +the example completes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +hide_const("MyClass") # => MyClass is now an undefined constant
        + +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 108
        +
        +def hide_const(constant_name)
        +  ConstantMutator.hide(constant_name)
        +end
        +
        +
        + +
        +

        + + - (Object) mock(*args) + + + + + +

        +
        + +

        Deprecated: Use double.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 35
        +
        +def mock(*args)
        +  RSpec.deprecate "mock", :replacement => "double"
        +  declare_double('Mock', *args)
        +end
        +
        +
        + +
        +

        + + - (Object) stub(*args) + + + + + +

        +
        + +

        Deprecated: Use double.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 41
        +
        +def stub(*args)
        +  RSpec.deprecate "stub", :replacement => "double"
        +  declare_double('Stub', *args)
        +end
        +
        +
        + +
        +

        + + - (Object) stub_const(constant_name, value, options = {}) + + + + + +

        +
        + +

        Stubs the named constant with the given value. Like method stubs, the +constant will be restored to its original value (or lack of one, if it was +undefined) when the example completes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +stub_const("MyClass", Class.new) # => Replaces (or defines) MyClass with a new class object.
        +stub_const("SomeModel::PER_PAGE", 5) # => Sets SomeModel::PER_PAGE to 5.
        +
        +class CardDeck
        +  SUITS = [:Spades, :Diamonds, :Clubs, :Hearts]
        +  NUM_CARDS = 52
        +end
        +
        +stub_const("CardDeck", Class.new)
        +CardDeck::SUITS # => uninitialized constant error
        +CardDeck::NUM_CARDS # => uninitialized constant error
        +
        +stub_const("CardDeck", Class.new, :transfer_nested_constants => true)
        +CardDeck::SUITS # => our suits array
        +CardDeck::NUM_CARDS # => 52
        +
        +stub_const("CardDeck", Class.new, :transfer_nested_constants => [:SUITS])
        +CardDeck::SUITS # => our suits array
        +CardDeck::NUM_CARDS # => uninitialized constant error
        + +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        • + + value + + + (Object) + + + + — +
          +

          The value to make the constant refer to. When the example completes, the +constant will be restored to its prior state.

          +
          + +
        • + +
        • + + options + + + (Hash) + + + (defaults to: {}) + + + — +
          +

          Stubbing options.

          +
          + +
        • + +
        + + + + + + + + +

        Options Hash (options):

        +
          + +
        • + :transfer_nested_constants + (Boolean, Array<Symbol>) + + + + + —
          +

          Determines what nested constants, if any, will be transferred from the +original value of the constant to the new value of the constant. This only +works if both the original and new values are modules (or classes).

          +
          + +
        • + +
        + + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +
          +

          the stubbed value of the constant

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 92
        +
        +def stub_const(constant_name, value, options = {})
        +  ConstantMutator.stub(constant_name, value, options)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html new file mode 100644 index 000000000..7e6fdb979 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::ExampleMethods::ExpectHost + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ExampleMethods::ExpectHost + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/example_methods.rb
        + +
        +
        + +

        Overview

        +
        + +

        This module exists to host the expect method for cases where +rspec-mocks is used w/o rspec-expectations.

        + + +
        +
        +
        + + +
        + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExpectationTarget.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExpectationTarget.html new file mode 100644 index 000000000..7bb0fc95b --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/ExpectationTarget.html @@ -0,0 +1,151 @@ + + + + + + Class: RSpec::Mocks::ExpectationTarget + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ExpectationTarget + + + +

        + +
        + +
        Inherits:
        +
        + TargetBase + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        EXPRESSION = + +
        +
        :expect
        + +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from TargetBase

        +

        delegate_to, disallow_negation, #initialize

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::TargetBase

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers.html new file mode 100644 index 000000000..2c2c19fe3 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::Matchers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Matchers + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/matchers/receive.rb,
        + lib/rspec/mocks/matchers/have_received.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: HaveReceived, Receive + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/HaveReceived.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/HaveReceived.html new file mode 100644 index 000000000..1deb646c0 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/HaveReceived.html @@ -0,0 +1,548 @@ + + + + + + Class: RSpec::Mocks::Matchers::HaveReceived + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Matchers::HaveReceived + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/matchers/have_received.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        COUNT_CONSTRAINTS = + +
        +
        %w(exactly at_least at_most times once twice)
        + +
        ARGS_CONSTRAINTS = + +
        +
        %w(with)
        + +
        CONSTRAINTS = + +
        +
        COUNT_CONSTRAINTS + ARGS_CONSTRAINTS
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (HaveReceived) initialize(method_name) + + + + + +

        +
        + +

        Returns a new instance of HaveReceived

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 9
        +
        +def initialize(method_name)
        +  @method_name = method_name
        +  @constraints = []
        +  @subject = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 36
        +
        +def description
        +  expect.description
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(subject) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 21
        +
        +def does_not_match?(subject)
        +  @subject = subject
        +  ensure_count_unconstrained
        +  @expectation = expect.never
        +  expected_messages_received?
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message + + + + + +

        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 28
        +
        +def failure_message
        +  generate_failure_message
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(subject) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 15
        +
        +def matches?(subject)
        +  @subject = subject
        +  @expectation = expect
        +  expected_messages_received?
        +end
        +
        +
        + +
        +

        + + - (Object) negative_failure_message + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 32
        +
        +def negative_failure_message
        +  generate_failure_message
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/Receive.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/Receive.html new file mode 100644 index 000000000..908376921 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/Receive.html @@ -0,0 +1,556 @@ + + + + + + Class: RSpec::Mocks::Matchers::Receive + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Matchers::Receive + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/matchers/receive.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: Customization + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Receive) initialize(message, block) + + + + + +

        +
        + +

        Returns a new instance of Receive

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 5
        +
        +def initialize(message, block)
        +  @message                 = message
        +  @block                   = block
        +  @recorded_customizations = []
        +  @backtrace_line          = CallerFilter.first_non_rspec_line
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) setup_allowance(subject, &block) + + + + + +

        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 26
        +
        +def setup_allowance(subject, &block)
        +  setup_mock_proxy_method_substitute(subject, :add_stub, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_any_instance_allowance(subject, &block) + + + + + +

        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 38
        +
        +def setup_any_instance_allowance(subject, &block)
        +  setup_any_instance_method_substitute(subject, :stub, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_any_instance_expectation(subject, &block) + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 30
        +
        +def setup_any_instance_expectation(subject, &block)
        +  setup_any_instance_method_substitute(subject, :should_receive, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_any_instance_negative_expectation(subject, &block) + + + + + +

        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 34
        +
        +def setup_any_instance_negative_expectation(subject, &block)
        +  setup_any_instance_method_substitute(subject, :should_not_receive, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_expectation(subject, &block) + + + + Also known as: + matches? + + + + +

        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 12
        +
        +def setup_expectation(subject, &block)
        +  setup_mock_proxy_method_substitute(subject, :add_message_expectation, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_negative_expectation(subject, &block) + + + + Also known as: + does_not_match? + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 17
        +
        +def setup_negative_expectation(subject, &block)
        +  # ensure `never` goes first for cases like `never.and_return(5)`,
        +  # where `and_return` is meant to raise an error
        +  @recorded_customizations.unshift Customization.new(:never, [], nil)
        +
        +  setup_expectation(subject, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/Receive/Customization.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/Receive/Customization.html new file mode 100644 index 000000000..cff288ed0 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Matchers/Receive/Customization.html @@ -0,0 +1,264 @@ + + + + + + Class: RSpec::Mocks::Matchers::Receive::Customization + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Matchers::Receive::Customization + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/matchers/receive.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Customization) initialize(method_name, args, block) + + + + + +

        +
        + +

        Returns a new instance of Customization

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +79
        +80
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 76
        +
        +def initialize(method_name, args, block)
        +  @method_name = method_name
        +  @args        = args
        +  @block       = block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) playback_onto(expectation) + + + + + +

        + + + + +
        +
        +
        +
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 82
        +
        +def playback_onto(expectation)
        +  expectation.__send__(@method_name, *@args, &@block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/MessageExpectation.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/MessageExpectation.html new file mode 100644 index 000000000..86928d957 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/MessageExpectation.html @@ -0,0 +1,2242 @@ + + + + + + Class: RSpec::Mocks::MessageExpectation + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::MessageExpectation + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/message_expectation.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) argument_list_matcher=(value) (writeonly) + + + + + +

        +
        + +

        Sets the attribute argument_list_matcher

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + value + + + + + + + — +
          +

          the value to set the attribute argument_list_matcher to.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 10
        +
        +def argument_list_matcher=(value)
        +  @argument_list_matcher = value
        +end
        +
        +
        + + + +
        +

        + + - (Object) message (readonly) + + + + + +

        +
        + +

        Returns the value of attribute message

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 8
        +
        +def message
        +  @message
        +end
        +
        +
        + + + +
        +

        + + - (Object) orig_object (readonly) + + + + + +

        +
        + +

        Returns the value of attribute orig_object

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 9
        +
        +def orig_object
        +  @orig_object
        +end
        +
        +
        + + + +
        +

        + + - (Object) warn_about_yielding_receiver_to_implementation_block + + + + + +

        +
        + +

        Returns the value of attribute +warn_about_yielding_receiver_to_implementation_block

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 7
        +
        +def warn_about_yielding_receiver_to_implementation_block
        +  @warn_about_yielding_receiver_to_implementation_block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) and_call_original + + + + + +

        +
        + +
        + Note: +
        +

        This is only available on partial mock objects.

        +
        +
        + + +

        Tells the object to delegate to the original unmodified method when it +receives the message.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +counter.should_receive(:increment).and_call_original
        +original_count = counter.count
        +counter.increment
        +expect(counter.count).to eq(original_count + 1)
        + +
        + + +
        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 123
        +
        +def and_call_original
        +  if @method_double.object.is_a?(RSpec::Mocks::TestDouble)
        +    @error_generator.raise_only_valid_on_a_partial_mock(:and_call_original)
        +  else
        +    @implementation = AndCallOriginalImplementation.new(@method_double.original_method)
        +    @yield_receiver_to_implementation_block = false
        +  end
        +end
        +
        +
        + +
        +

        + + + - (Object) and_raise + + - (Object) and_raise(ExceptionClass) + + - (Object) and_raise(ExceptionClass, message) + + - (Object) and_raise(exception_instance) + + + + + + +

        +
        + +
        + Note: +
        +

        When you pass an exception class, the MessageExpectation will raise an +instance of it, creating it with exception and passing +message if specified. If the exception class initializer +requires more than one parameters, you must pass in an instance and not the +class, otherwise this method will raise an ArgumentError exception.

        +
        +
        + + +

        Tells the object to raise an exception when the message is received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.stub(:go).and_raise
        +car.stub(:go).and_raise(OutOfGas)
        +car.stub(:go).and_raise(OutOfGas, "At least 2 oz of gas needed to drive")
        +car.stub(:go).and_raise(OutOfGas.new(2, :oz))
        + +
        + + +
        + + + + +
        +
        +
        +
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 153
        +
        +def and_raise(exception = RuntimeError, message = nil)
        +  if exception.respond_to?(:exception)
        +    exception = message ? exception.exception(message) : exception.exception
        +  end
        +
        +  self.terminal_implementation_action = Proc.new { raise exception }
        +  nil
        +end
        +
        +
        + +
        +

        + + + - (Object) and_return(value) + + - (Object) and_return(first_value, second_value) + + - (Object) and_return(&block) + + + + + + +

        +
        + +

        Tells the object to return a value when it receives the message. Given more +than one value, the first value is returned the first time the message is +received, the second value is returned the next time, etc, etc.

        + +

        If the message is received more times than there are values, the last value +is received for every subsequent call.

        + +

        The block format is deprecated in favor of just passing a block to the stub +method.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +counter.stub(:count).and_return(1)
        +counter.count # => 1
        +counter.count # => 1
        +
        +counter.stub(:count).and_return(1,2,3)
        +counter.count # => 1
        +counter.count # => 2
        +counter.count # => 3
        +counter.count # => 3
        +counter.count # => 3
        +# etc
        +
        +# Deprecated ...
        +counter.stub(:count).and_return { 1 }
        +counter.count # => 1
        +
        +# ... use this instead
        +counter.stub(:count) { 1 }
        +counter.count # => 1
        + +
        + + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 79
        +
        +def and_return(*values, &implementation)
        +  if negative?
        +    RSpec.deprecate "`and_return` on a negative message expectation"
        +  end
        +
        +  @expected_received_count = [@expected_received_count, values.size].max unless ignoring_args? || (@expected_received_count == 0 and @at_least)
        +
        +  if implementation
        +    RSpec.deprecate('`and_return { value }`',
        +                    :replacement => '`and_return(value)` or an implementation block without `and_return`')
        +    self.inner_implementation_action = implementation
        +  else
        +    if values.empty?
        +      RSpec.warn_deprecation('`and_return` without arguments is deprecated. ' +
        +                             'Remove the `and_return`. ' +
        +                             "Called from #{CallerFilter.first_non_rspec_line}.")
        +    end
        +
        +    self.terminal_implementation_action = AndReturnImplementation.new(values)
        +  end
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + + - (Object) and_throw(symbol) + + - (Object) and_throw(symbol, object) + + + + + + +

        +
        + +

        Tells the object to throw a symbol (with the object if that form is used) +when the message is received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.stub(:go).and_throw(:out_of_gas)
        +car.stub(:go).and_throw(:out_of_gas, :level => 0.1)
        + +
        + + +
        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +175
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 172
        +
        +def and_throw(*args)
        +  self.terminal_implementation_action = Proc.new { throw(*args) }
        +  nil
        +end
        +
        +
        + +
        +

        + + - (Object) and_yield(*args) {|@eval_context = Object.new.extend(RSpec::Mocks::InstanceExec)| ... } + + + + + +

        +
        + +

        Tells the object to yield one or more args to a block when the message is +received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +stream.stub(:open).and_yield(StringIO.new)
        + +
        + +

        Yields:

        +
          + +
        • + + + (@eval_context = Object.new.extend(RSpec::Mocks::InstanceExec)) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +183
        +184
        +185
        +186
        +187
        +188
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 183
        +
        +def and_yield(*args, &block)
        +  yield @eval_context = Object.new.extend(RSpec::Mocks::InstanceExec) if block
        +  @args_to_yield << args
        +  self.initial_implementation_action = AndYieldImplementation.new(@args_to_yield, @eval_context, @error_generator)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) and_yield_receiver_to_implementation + + + + + +

        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 103
        +
        +def and_yield_receiver_to_implementation
        +  @yield_receiver_to_implementation_block = true
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) any_number_of_times(&block) + + + + + +

        +
        + +

        Allows an expected message to be received any number of times.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +421
        +422
        +423
        +424
        +425
        +426
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 421
        +
        +def any_number_of_times(&block)
        +  RSpec.deprecate "any_number_of_times", :replacement => "stub"
        +  self.inner_implementation_action = block
        +  @expected_received_count = :any
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) at_least(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received at least a specific number +of times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +dealer.should_receive(:deal_card).at_least(9).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +385
        +386
        +387
        +388
        +389
        +390
        +391
        +392
        +393
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 385
        +
        +def at_least(n, &block)
        +  if n == 0
        +    RSpec.deprecate "at_least(0) with should_receive", :replacement => "stub"
        +  end
        +
        +  self.inner_implementation_action = block
        +  set_expected_received_count :at_least, n
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) at_most(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received at most a specific number of +times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +dealer.should_receive(:deal_card).at_most(10).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +401
        +402
        +403
        +404
        +405
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 401
        +
        +def at_most(n, &block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :at_most, n
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) display_any_instance_deprecation_warning(block_source_line) + + + + + +

        + + + + +
        +
        +
        +
        +500
        +501
        +502
        +503
        +504
        +505
        +506
        +507
        +508
        +509
        +510
        +511
        +512
        +513
        +514
        +515
        +516
        +517
        +518
        +519
        +520
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 500
        +
        +def display_any_instance_deprecation_warning(block_source_line)
        +  RSpec.warn_deprecation(<<MSG
        +In RSpec 3, `any_instance` implementation blocks will be yielded the receiving
        +instance as the first block argument to allow the implementation block to use
        +the state of the receiver.  To maintain compatibility with RSpec 3 you need to
        +either set rspec-mocks' `yield_receiver_to_any_instance_implementation_blocks`
        +config option to `false` OR set it to `true` and update your `any_instance`
        +implementation blocks to account for the first block argument being the receiving instance.
        +
        +To set the config option, use a snippet like:
        +
        +RSpec.configure do |rspec|
        +  rspec.mock_with :rspec do |mocks|
        +    mocks.yield_receiver_to_any_instance_implementation_blocks = false
        +  end
        +end
        +
        +Your `any_instance` implementation block is declared at: #{block_source_line}
        +MSG
        +)
        +end
        +
        +
        + +
        +

        + + - (Object) exactly(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received a specific number of times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +dealer.should_receive(:deal_card).exactly(10).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +373
        +374
        +375
        +376
        +377
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 373
        +
        +def exactly(n, &block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, n
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) expectation_count_type + + + + + +

        + + + + +
        +
        +
        +
        +314
        +315
        +316
        +317
        +318
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 314
        +
        +def expectation_count_type
        +  return :at_least if @at_least
        +  return :at_most if @at_most
        +  return nil
        +end
        +
        +
        + +
        +

        + + - (Object) never + + + + + +

        +
        + +

        Expect a message not to be received at all.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.should_receive(:stop).never
        + +
        + + +
        + + + + +
        +
        +
        +
        +433
        +434
        +435
        +436
        +437
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 433
        +
        +def never
        +  ErrorGenerator.raise_double_negation_error("expect(obj)") if negative?
        +  @expected_received_count = 0
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) once(&block) + + + + + +

        +
        + +

        Expect a message to be received exactly one time.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.should_receive(:go).once
        + +
        + + +
        + + + + +
        +
        +
        +
        +444
        +445
        +446
        +447
        +448
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 444
        +
        +def once(&block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, 1
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) ordered(&block) + + + + + +

        +
        + +

        Expect messages to be received in a specific order.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +api.should_receive(:prepare).ordered
        +api.should_receive(:run).ordered
        +api.should_receive(:finish).ordered
        + +
        + + +
        + + + + +
        +
        +
        +
        +468
        +469
        +470
        +471
        +472
        +473
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 468
        +
        +def ordered(&block)
        +  self.inner_implementation_action = block
        +  @order_group.register(self)
        +  @ordered = true
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) raise_out_of_order_error + + + + + +

        + + + + +
        +
        +
        +
        +325
        +326
        +327
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 325
        +
        +def raise_out_of_order_error
        +  @error_generator.raise_out_of_order_error @message
        +end
        +
        +
        + +
        +

        + + - (Object) should_display_any_instance_deprecation_warning + + + + + +

        + + + + +
        +
        +
        +
        +495
        +496
        +497
        +498
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 495
        +
        +def should_display_any_instance_deprecation_warning
        +  warn_about_yielding_receiver_to_implementation_block &&
        +    !@have_warned_about_yielding_receiver
        +end
        +
        +
        + +
        +

        + + - (Object) times(&block) + + + + + +

        +
        + +

        Syntactic sugar for exactly, at_least and +at_most

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +dealer.should_receive(:deal_card).exactly(10).times
        +dealer.should_receive(:deal_card).at_least(10).times
        +dealer.should_receive(:deal_card).at_most(10).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +414
        +415
        +416
        +417
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 414
        +
        +def times(&block)
        +  self.inner_implementation_action = block
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) twice(&block) + + + + + +

        +
        + +

        Expect a message to be received exactly two times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.should_receive(:go).twice
        + +
        + + +
        + + + + +
        +
        +
        +
        +455
        +456
        +457
        +458
        +459
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 455
        +
        +def twice(&block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, 2
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) warn_about_receiver_passing(any_instance_source_line) + + + + + +

        + + + + +
        +
        +
        +
        +490
        +491
        +492
        +493
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 490
        +
        +def warn_about_receiver_passing(any_instance_source_line)
        +  @any_instance_source_line = any_instance_source_line
        +  @warn_about_yielding_receiver_to_implementation_block = true
        +end
        +
        +
        + +
        +

        + + - (Object) with(*args, &block) + + + + + +

        +
        + +

        Constrains a stub or message expectation to invocations with specific +arguments.

        + +

        With a stub, if the message might be received with other args as well, you +should stub a default value first, and then stub or mock the same message +using with to constrain to specific arguments.

        + +

        A message expectation will fail if the message is received with different +arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +cart.stub(:add) { :failure }
        +cart.stub(:add).with(Book.new(:isbn => 1934356379)) { :success }
        +cart.add(Book.new(:isbn => 1234567890))
        +# => :failure
        +cart.add(Book.new(:isbn => 1934356379))
        +# => :success
        +
        +cart.should_receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
        +cart.add(Book.new(:isbn => 1234567890))
        +# => failed expectation
        +cart.add(Book.new(:isbn => 1934356379))
        +# => passes
        + +
        + + +
        + + + + +
        +
        +
        +
        +353
        +354
        +355
        +356
        +357
        +358
        +359
        +360
        +361
        +362
        +363
        +364
        +365
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 353
        +
        +def with(*args, &block)
        +  if block_given?
        +    if args.empty?
        +      RSpec.deprecate "Using the return value of a `with` block to validate passed arguments rather than as an implementation",
        +        :replacement => "the `satisfy` matcher, a custom matcher or validate the arguments in an implementation block"
        +    else
        +      self.inner_implementation_action = block
        +    end
        +  end
        +
        +  @argument_list_matcher = ArgumentListMatcher.new(*args, &block)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Boolean) yield_receiver_to_implementation_block? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 108
        +
        +def yield_receiver_to_implementation_block?
        +  @yield_receiver_to_implementation_block
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/RecursiveConstMethods.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/RecursiveConstMethods.html new file mode 100644 index 000000000..29b6ef3af --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/RecursiveConstMethods.html @@ -0,0 +1,590 @@ + + + + + + Module: RSpec::Mocks::RecursiveConstMethods + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::RecursiveConstMethods + + + Private +

        + +
        + + + + + + + +
        Included in:
        +
        Constant, ConstantMutator, ConstantMutator::BaseMutator
        + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        + +

        Provides recursive constant lookup methods useful for constant stubbing.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) const_defined_on?(mod, const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 30
        +
        +def const_defined_on?(mod, const_name)
        +  mod.const_defined?(const_name)
        +end
        +
        +
        + +
        +

        + + - (Object) constants_defined_on(mod) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 42
        +
        +def constants_defined_on(mod)
        +  mod.constants.select { |c| const_defined_on?(mod, c) }
        +end
        +
        +
        + +
        +

        + + - (Object) get_const_defined_on(mod, const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Raises:

        +
          + +
        • + + + (NameError) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 34
        +
        +def get_const_defined_on(mod, const_name)
        +  if const_defined_on?(mod, const_name)
        +    return mod.const_get(const_name)
        +  end
        +
        +  raise NameError, "uninitialized constant #{mod.name}::#{const_name}"
        +end
        +
        +
        + +
        +

        + + - (Object) normalize_const_name(const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 73
        +
        +def normalize_const_name(const_name)
        +  const_name.sub(/\A::/, '')
        +end
        +
        +
        + +
        +

        + + - (Boolean) recursive_const_defined?(const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 65
        +
        +def recursive_const_defined?(const_name)
        +  normalize_const_name(const_name).split('::').inject([Object, '']) do |(mod, full_name), name|
        +    yield(full_name, name) if block_given? && !mod.is_a?(Module)
        +    return false unless const_defined_on?(mod, name)
        +    [get_const_defined_on(mod, name), [mod, name].join('::')]
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) recursive_const_get(const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 59
        +
        +def recursive_const_get(const_name)
        +  normalize_const_name(const_name).split('::').inject(Object) do |mod, name|
        +    get_const_defined_on(mod, name)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Space.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Space.html new file mode 100644 index 000000000..723c12e06 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Space.html @@ -0,0 +1,1135 @@ + + + + + + Class: RSpec::Mocks::Space + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Space + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/space.rb
        + +
        +
        + +
        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Space) initialize + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of Space

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 8
        +
        +def initialize
        +  @proxies                 = {}
        +  @any_instance_recorders  = {}
        +  self.outside_example     = true
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) any_instance_recorders (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 5
        +
        +def any_instance_recorders
        +  @any_instance_recorders
        +end
        +
        +
        + + + +
        +

        + + - (Object) outside_example + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 6
        +
        +def outside_example
        +  @outside_example
        +end
        +
        +
        + + + +
        +

        + + - (Object) proxies (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 5
        +
        +def proxies
        +  @proxies
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) any_instance_recorder_for(klass) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 45
        +
        +def any_instance_recorder_for(klass)
        +  print_out_of_example_deprecation if outside_example
        +  id = klass.__id__
        +  any_instance_recorders.fetch(id) do
        +    any_instance_recorders[id] = AnyInstance::Recorder.new(klass)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) expectation_ordering + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 41
        +
        +def expectation_ordering
        +  @expectation_ordering ||= OrderGroup.new
        +end
        +
        +
        + +
        +

        + + - (Object) id_for(object) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 83
        +
        +def id_for(object)
        +  id = object.__id__
        +
        +  return id if object.equal?(::ObjectSpace._id2ref(id))
        +  # this suggests that object.__id__ is proxying through to some wrapped object
        +
        +  object.instance_eval do
        +    @__id_for_rspec_mocks_space ||= ::SecureRandom.uuid
        +  end
        +end
        +
        +
        + +
        +
        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 76
        +
        +def print_out_of_example_deprecation
        +  RSpec.deprecate("Using rspec-mocks doubles or partial doubles outside the per-test lifecycle (such as in a `before(:all)` hook)")
        +end
        +
        +
        + +
        +

        + + - (Object) proxies_of(klass) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 53
        +
        +def proxies_of(klass)
        +  proxies.values.select { |proxy| klass === proxy.object }
        +end
        +
        +
        + +
        +

        + + - (Object) proxy_for(object) + + + + Also known as: + ensure_registered + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 57
        +
        +def proxy_for(object)
        +  print_out_of_example_deprecation if outside_example
        +  id = id_for(object)
        +  proxies.fetch(id) do
        +    proxies[id] = case object
        +                  when NilClass   then ProxyForNil.new
        +                  when TestDouble then object.__build_mock_proxy
        +                  else
        +                    Proxy.new(object)
        +                  end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) registered?(object) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 72
        +
        +def registered?(object)
        +  proxies.has_key?(id_for object)
        +end
        +
        +
        + +
        +

        + + - (Object) reset_all + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 24
        +
        +def reset_all
        +  ConstantMutator.reset_all
        +
        +  proxies.each_value do |object|
        +    object.reset
        +  end
        +
        +  proxies.clear
        +
        +  any_instance_recorders.each_value do |recorder|
        +    recorder.stop_all_observation!
        +  end
        +
        +  any_instance_recorders.clear
        +  expectation_ordering.clear
        +end
        +
        +
        + +
        +

        + + - (Object) verify_all + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 14
        +
        +def verify_all
        +  proxies.each_value do |object|
        +    object.verify
        +  end
        +
        +  any_instance_recorders.each_value do |recorder|
        +    recorder.verify
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Syntax.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Syntax.html new file mode 100644 index 000000000..2f63539c0 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Syntax.html @@ -0,0 +1,2059 @@ + + + + + + Module: RSpec::Mocks::Syntax + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Syntax + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        + +

        Provides methods for enabling and disabling the available syntaxes provided +by rspec-mocks.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) allow + + + + + + + + + + + + + +
          +

          Used to wrap an object in preparation for stubbing a method on it.

          +
          + +
        • + + +
        • + + + - (Object) allow_any_instance_of + + + + + + + + + + + + + +
          +

          Used to wrap a class in preparation for stubbing a method on instances of +it.

          +
          + +
        • + + +
        • + + + - (Recorder) any_instance + + + + + + + + + + + + + +
          +

          Used to set stubs and message expectations on any instance of a given +class.

          +
          + +
        • + + +
        • + + + - (Object) as_null_object + + + + + + + + + + + + + +
          +

          Tells the object to respond to all messages.

          +
          + +
        • + + +
        • + + + - (Object) expect + + + + + + + + + + + + + +
          +

          Used to wrap an object in preparation for setting a mock expectation on it.

          +
          + +
        • + + +
        • + + + - (Object) expect_any_instance_of + + + + + + + + + + + + + +
          +

          Used to wrap a class in preparation for setting a mock expectation on +instances of it.

          +
          + +
        • + + +
        • + + + - (Object) null_object? + + + + + + + + + + + + + +
          +

          Returns true if this object has received as_null_object.

          +
          + +
        • + + +
        • + + + - (Object) receive + + + + + + + + + + + + + +
          +

          Used to specify a message that you expect or allow an object to receive.

          +
          + +
        • + + +
        • + + + - (Object) should_not_receive + + + + + + + + + + + + + +
          +

          Sets and expectation that this object should not receive a message +during this example.

          +
          + +
        • + + +
        • + + + - (Object) should_receive + + + + + + + + + + + + + +
          +

          Sets an expectation that this object should receive a message before the +end of the example.

          +
          + +
        • + + +
        • + + + - (Object) stub + + + + + + + + + + + + + +
          +

          Tells the object to respond to the message with the specified value.

          +
          + +
        • + + +
        • + + + - (Object) stub_chain + + + + + + + + + + + + + +
          +

          Stubs a chain of methods.

          +
          + +
        • + + +
        • + + + - (Object) unstub + + + + + + + + + + + + + +
          +

          Removes a stub.

          +
          + +
        • + + +
        + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) default_should_syntax_host + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Determines where the methods like should_receive, and +stub are added.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +168
        +169
        +170
        +171
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +182
        +183
        +184
        +185
        +186
        +187
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 168
        +
        +def self.default_should_syntax_host
        +  # JRuby 1.7.4 introduces a regression whereby `defined?(::BasicObject) => nil`
        +  # yet `BasicObject` still exists and patching onto ::Object breaks things
        +  # e.g. SimpleDelegator expectations won't work
        +  #
        +  # See: https://github.com/jruby/jruby/issues/814
        +  if defined?(JRUBY_VERSION) && JRUBY_VERSION == '1.7.4' && RUBY_VERSION.to_f > 1.8
        +    return ::BasicObject
        +  end
        +
        +  # On 1.8.7, Object.ancestors.last == Kernel but
        +  # things blow up if we include `RSpec::Mocks::Methods`
        +  # into Kernel...not sure why.
        +  return Object unless defined?(::BasicObject)
        +
        +  # MacRuby has BasicObject but it's not the root class.
        +  return Object unless Object.ancestors.last == ::BasicObject
        +
        +  ::BasicObject
        +end
        +
        +
        + +
        +

        + + + (Object) disable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Disables the expect syntax (expect(dbl).to receive, +allow(dbl).to receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 139
        +
        +def self.disable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods)
        +  return unless expect_enabled?(syntax_host)
        +
        +  syntax_host.class_eval do
        +    undef receive
        +    undef allow
        +    undef expect_any_instance_of
        +    undef allow_any_instance_of
        +  end
        +
        +  RSpec::Mocks::ExampleMethods::ExpectHost.class_eval do
        +    undef expect
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) disable_should(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Disables the should syntax (dbl.stub, +dbl.should_receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 86
        +
        +def self.disable_should(syntax_host = default_should_syntax_host)
        +  return unless should_enabled?(syntax_host)
        +
        +  syntax_host.class_eval do
        +    undef should_receive
        +    undef should_not_receive
        +    undef stub
        +    undef unstub
        +    undef stub!
        +    undef unstub!
        +    undef stub_chain
        +    undef as_null_object
        +    undef null_object?
        +    undef received_message?
        +  end
        +
        +  Class.class_eval do
        +    undef any_instance
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) enable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Enables the expect syntax (expect(dbl).to receive, +allow(dbl).to receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 109
        +
        +def self.enable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods)
        +  return if expect_enabled?(syntax_host)
        +
        +  syntax_host.class_eval do
        +    def receive(method_name, &block)
        +      Matchers::Receive.new(method_name, block)
        +    end
        +
        +    def allow(target)
        +      AllowanceTarget.new(target)
        +    end
        +
        +    def expect_any_instance_of(klass)
        +      AnyInstanceExpectationTarget.new(klass)
        +    end
        +
        +    def allow_any_instance_of(klass)
        +      AnyInstanceAllowanceTarget.new(klass)
        +    end
        +  end
        +
        +  RSpec::Mocks::ExampleMethods::ExpectHost.class_eval do
        +    def expect(target)
        +      ExpectationTarget.new(target)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) enable_should(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Enables the should syntax (dbl.stub, +dbl.should_receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 25
        +
        +def self.enable_should(syntax_host = default_should_syntax_host)
        +  return if should_enabled?(syntax_host)
        +
        +  syntax_host.class_eval do
        +    def should_receive(message, opts={}, &block)
        +      opts[:expected_from] ||= CallerFilter.first_non_rspec_line
        +      ::RSpec::Mocks.expect_message(self, message.to_sym, opts, &block)
        +    end
        +
        +    def should_not_receive(message, &block)
        +      opts = { :expected_from => CallerFilter.first_non_rspec_line }
        +      ::RSpec::Mocks.expect_message(self, message.to_sym, opts, &block).never
        +    end
        +
        +    def stub(message_or_hash, opts={}, &block)
        +      ::RSpec::Mocks::Syntax.stub_object(self, message_or_hash, opts, &block)
        +    end
        +
        +    def unstub(message)
        +      ::RSpec::Mocks.space.proxy_for(self).remove_stub(message)
        +    end
        +
        +    def stub!(message_or_hash, opts={}, &block)
        +      ::RSpec.deprecate "stub!", :replacement => "stub"
        +      ::RSpec::Mocks::Syntax.stub_object(self, message_or_hash, opts, &block)
        +    end
        +
        +    def unstub!(message)
        +      ::RSpec.deprecate "unstub!", :replacement => "unstub"
        +      unstub(message)
        +    end
        +
        +    def stub_chain(*chain, &blk)
        +      ::RSpec::Mocks::StubChain.stub_chain_on(self, *chain, &blk)
        +    end
        +
        +    def as_null_object
        +      @_null_object = true
        +      ::RSpec::Mocks.proxy_for(self).as_null_object
        +    end
        +
        +    def null_object?
        +      defined?(@_null_object)
        +    end
        +
        +    def received_message?(message, *args, &block)
        +      ::RSpec::Mocks.proxy_for(self).received_message?(message, *args, &block)
        +    end
        +
        +    unless Class.respond_to? :any_instance
        +      Class.class_eval do
        +        def any_instance
        +          ::RSpec::Mocks.any_instance_recorder_for(self)
        +        end
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Boolean) expect_enabled?(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Indicates whether or not the expect syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +162
        +163
        +164
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 162
        +
        +def self.expect_enabled?(syntax_host = ::RSpec::Mocks::ExampleMethods)
        +  syntax_host.method_defined?(:allow)
        +end
        +
        +
        + +
        +

        + + + (Boolean) should_enabled?(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Indicates whether or not the should syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +156
        +157
        +158
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 156
        +
        +def self.should_enabled?(syntax_host = default_should_syntax_host)
        +  syntax_host.method_defined?(:should_receive)
        +end
        +
        +
        + +
        +

        + + + (Object) stub_object(object, message_or_hash, opts = {}, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Common stubbing logic for both stub and stub!. +This used to live in stub, and stub! delegated to +stub, but we discovered that stub! was delegating +to RSpec::Mocks::ExampleMethods#stub (which declares a test +double) when called with an implicit receiver, which was a regression in +2.14.0.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 14
        +
        +def self.stub_object(object, message_or_hash, opts = {}, &block)
        +  if ::Hash === message_or_hash
        +    message_or_hash.each {|message, value| stub_object(object, message).and_return value }
        +  else
        +    opts[:expected_from] = CallerFilter.first_non_rspec_line
        +    ::RSpec::Mocks.allow_message(object, message_or_hash, opts, &block)
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) allow + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to wrap an object in preparation for stubbing a method on it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +allow(dbl).to receive(:foo).with(5).and_return(:return_value)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 304
        +
        +
        +
        +
        + +
        +

        + + - (Object) allow_any_instance_of + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to wrap a class in preparation for stubbing a method on instances of +it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +allow_any_instance_of(MyClass).to receive(:foo)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 324
        +
        +
        +
        +
        + +
        +

        + + - (Recorder) any_instance + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Used to set stubs and message expectations on any instance of a given +class. Returns a Recorder, which records messages +like stub and should_receive for later playback +on instances of the class.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +Car.any_instance.should_receive(:go)
        +race = Race.new
        +race.cars << Car.new
        +race.go # assuming this delegates to all of its cars
        +        # this example would pass
        +
        +Account.any_instance.stub(:balance) { Money.new(:USD, 25) }
        +Account.new.balance # => Money.new(:USD, 25))
        + +
        + +

        Returns:

        +
          + +
        • + + + (Recorder) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 271
        +
        +
        +
        +
        + +
        +

        + + - (Object) as_null_object + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Tells the object to respond to all messages. If specific stub values are +declared, they'll work as expected. If not, the receiver is returned.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 259
        +
        +
        +
        +
        + +
        +

        + + - (Object) expect + + + + + +

        +
        + +
        + Note: +
        +

        This method is usually provided by rspec-expectations, unless you are using +rspec-mocks w/o rspec-expectations, in which case it is only made available +if you enable the expect syntax.

        +
        +
        + + +

        Used to wrap an object in preparation for setting a mock expectation on it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(obj).to receive(:foo).with(5).and_return(:return_value)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 292
        +
        +
        +
        +
        + +
        +

        + + - (Object) expect_any_instance_of + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to wrap a class in preparation for setting a mock expectation on +instances of it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect_any_instance_of(MyClass).to receive(:foo)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 314
        +
        +
        +
        +
        + +
        +

        + + - (Object) null_object? + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Returns true if this object has received as_null_object

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 266
        +
        +
        +
        +
        + +
        +

        + + - (Object) receive + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to specify a message that you expect or allow an object to receive. +The object returned by receive supports the same fluent +interface that should_receive and stub have +always supported, allowing you to constrain the arguments or number of +times, and configure how the object should respond to the message.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(obj).to receive(:hello).with("world").exactly(3).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 334
        +
        +
        +
        +
        + +
        +

        + + - (Object) should_not_receive + + + + + +

        +
        + +

        Sets and expectation that this object should not receive a message +during this example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 202
        +
        +
        +
        +
        + +
        +

        + + - (Object) should_receive + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Sets an expectation that this object should receive a message before the +end of the example.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +logger = double('logger')
        +thing_that_logs = ThingThatLogs.new(logger)
        +logger.should_receive(:log)
        +thing_that_logs.do_something_that_logs_a_message
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 189
        +
        +
        +
        +
        + +
        +

        + + - (Object) stub + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Tells the object to respond to the message with the specified value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +counter.stub(:count).and_return(37)
        +counter.stub(:count => 37)
        +counter.stub(:count) { 37 }
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 206
        +
        +
        +
        +
        + +
        +

        + + + - (Object) stub_chain(method1, method2) + + - (Object) stub_chain("method1.method2") + + - (Object) stub_chain(method1, method_to_value_hash) + + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Stubs a chain of methods.

        + +

        Warning:

        + +

        Chains can be arbitrarily long, which makes it quite painless to violate +the Law of Demeter in violent ways, so you should consider any use of +stub_chain a code smell. Even though not all code smells +indicate real problems (think fluent interfaces), stub_chain +still results in brittle examples. For example, if you write +foo.stub_chain(:bar, :baz => 37) in a spec and then the +implementation calls foo.baz.bar, the stub will not work.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +double.stub_chain("foo.bar") { :baz }
        +double.stub_chain(:foo, :bar => :baz)
        +double.stub_chain(:foo, :bar) { :baz }
        +
        +# Given any of ^^ these three forms ^^:
        +double.foo.bar # => :baz
        +
        +# Common use in Rails/ActiveRecord:
        +Article.stub_chain("recent.published") { [Article.new] }
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 228
        +
        +
        +
        +
        + +
        +

        + + - (Object) unstub + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Removes a stub. On a double, the object will no longer respond to +message. On a real object, the original method (if it exists) +is restored.

        + +

        This is rarely used, but can be useful when a stub is set up during a +shared before hook for the common case, but you want to +replace it for a special case.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 217
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TargetBase.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TargetBase.html new file mode 100644 index 000000000..9a9b9dc65 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TargetBase.html @@ -0,0 +1,353 @@ + + + + + + Class: RSpec::Mocks::TargetBase + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::TargetBase + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (TargetBase) initialize(target) + + + + + +

        +
        + +

        Returns a new instance of TargetBase

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/mocks/targets.rb', line 7
        +
        +def initialize(target)
        +  @target = target
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) delegate_to(matcher_method, options = {}) + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/targets.rb', line 11
        +
        +def self.delegate_to(matcher_method, options = {})
        +  method_name = options.fetch(:from) { :to }
        +  class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
        +  def #{method_name}(matcher, &block)
        +    unless Matchers::Receive === matcher
        +      raise UnsupportedMatcherError, "only the `receive` matcher is supported " +
        +        "with `\#{expression}(...).\#{#{method_name.inspect}}`, but you have provided: \#{matcher}"
        +    end
        +
        +    matcher.__send__(#{matcher_method.inspect}, @target, &block)
        +  end
        +  RUBY
        +end
        +
        +
        + +
        +

        + + + (Object) disallow_negation(method) + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/mocks/targets.rb', line 25
        +
        +def self.disallow_negation(method)
        +  define_method method do |*args|
        +    raise NegationUnsupportedError,
        +      "`#{expression}(...).#{method} receive` is not supported since it " +
        +      "doesn't really make sense. What would it even mean?"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TestDouble.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TestDouble.html new file mode 100644 index 000000000..09e3665e7 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TestDouble.html @@ -0,0 +1,693 @@ + + + + + + Module: RSpec::Mocks::TestDouble + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::TestDouble + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Double
        + + + +
        Defined in:
        +
        lib/rspec/mocks/test_double.rb
        + +
        +
        + +

        Overview

        +
        + +

        Implements the methods needed for a pure test double. RSpec::Mocks::Mock +includes this module, and it is provided for cases where you want a pure +test double without subclassing RSpec::Mocks::Mock.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(message, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 100
        +
        +def method_missing(message, *args, &block)
        +  if __mock_proxy.null_object?
        +    case message
        +    when :to_int        then return 0
        +    when :to_a, :to_ary then return nil
        +    end
        +  end
        +  __mock_proxy.record_message_received(message, *args, &block)
        +
        +  begin
        +    __mock_proxy.null_object? ? self : super
        +  rescue NameError
        +    # Required wrapping doubles in an Array on Ruby 1.9.2
        +    raise NoMethodError if [:to_a, :to_ary].include? message
        +    __mock_proxy.raise_unexpected_message_error(message, *args)
        +  end
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) extend_onto(object, name = nil, stubs_and_options = {}) + + + + + +

        +
        + +

        Extends the TestDouble module onto the given object and initializes it as a +test double.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module = Module.new
        +RSpec::Mocks::TestDouble.extend_onto(module, "MyMixin", :foo => "bar")
        +module.foo  #=> "bar"
        + +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 15
        +
        +def self.extend_onto(object, name=nil, stubs_and_options={})
        +  RSpec.deprecate("`RSpec::Mocks::TestDouble.extend_onto(...)`")
        +  object.extend self
        +  object.send(:__initialize_as_test_double, name, stubs_and_options)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(other) + + + + + +

        +
        + +

        This allows for comparing the mock to other objects that proxy such as +ActiveRecords belongs_to proxy objects. By making the other object run the +comparison, we're sure the call gets delegated to the proxy target.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 46
        +
        +def ==(other)
        +  other == __mock_proxy
        +end
        +
        +
        + +
        +

        + + - (Object) __warn_if_used_further! + + + + + +

        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 80
        +
        +def __warn_if_used_further!
        +  @__unfrozen_attributes[:expired] = true
        +end
        +
        +
        + +
        +

        + + - (Object) as_null_object + + + + + +

        +
        + +

        Tells the object to respond to all messages. If specific stub values are +declared, they'll work as expected. If not, the receiver is returned.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 30
        +
        +def as_null_object
        +  __mock_proxy.as_null_object
        +  @__null_object = true
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) freeze + + + + + +

        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 67
        +
        +def freeze
        +  RSpec.deprecate 'Freezing a test double'
        +  super
        +end
        +
        +
        + +
        +

        + + - (Object) initialize(name = nil, stubs_and_options = {}) + + + + + +

        +
        + +

        Creates a new test double with a name (that will be used in +error messages only)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 23
        +
        +def initialize(name=nil, stubs_and_options={})
        +  __initialize_as_test_double(name, stubs_and_options)
        +end
        +
        +
        + +
        +

        + + - (Boolean) null_object? + + + + + +

        +
        + +

        Returns true if this object has received as_null_object

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 37
        +
        +def null_object?
        +  __warn_of_expired_use_if_expired
        +  @__null_object
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TestDoubleProxy.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TestDoubleProxy.html new file mode 100644 index 000000000..07e04abbf --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/TestDoubleProxy.html @@ -0,0 +1,199 @@ + + + + + + Class: RSpec::Mocks::TestDoubleProxy + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::TestDoubleProxy + + + +

        + +
        + +
        Inherits:
        +
        + Proxy + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/proxy.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) reset + + + + + +

        + + + + +
        +
        +
        +
        +224
        +225
        +226
        +227
        +
        +
        # File 'lib/rspec/mocks/proxy.rb', line 224
        +
        +def reset
        +  object.__warn_if_used_further!
        +  super
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Version.html b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Version.html new file mode 100644 index 000000000..79deead4e --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/RSpec/Mocks/Version.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::Version + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Version + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/version.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        STRING = + +
        +
        '2.99.2'
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/_index.html b/source/documentation/2.99/rspec-mocks/_index.html new file mode 100644 index 000000000..362fcde83 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/_index.html @@ -0,0 +1,603 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.6

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + + + + + + + + + + + + + + + + + + + +
          +
        • I
        • +
            + +
          • + InstanceOf + + (RSpec::Mocks::ArgumentMatchers) + +
          • + +
          +
        + + +
        + + +
          +
        • K
        • +
            + +
          • + Kernel + +
          • + +
          • + KindOf + + (RSpec::Mocks::ArgumentMatchers) + +
          • + +
          +
        + + + + + +
          +
        • N
        • +
            + +
          • + NoArgsMatcher + + (RSpec::Mocks::ArgumentMatchers) + +
          • + +
          +
        + + +
          +
        • P
        • +
            + +
          • + Proc + +
          • + +
          +
        + + + + + +
          +
        • S
        • +
            + +
          • + Space + + (RSpec::Mocks) + +
          • + +
          • + Syntax + + (RSpec::Mocks) + +
          • + +
          +
        + + + + + + + + +
        + + +
          +
        • V
        • +
            + +
          • + Version + + (RSpec::Mocks) + +
          • + +
          +
        + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/class_list.html b/source/documentation/2.99/rspec-mocks/class_list.html new file mode 100644 index 000000000..0a1c846a9 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/class_list.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-mocks/file.Changelog.html b/source/documentation/2.99/rspec-mocks/file.Changelog.html new file mode 100644 index 000000000..e6f0b73a6 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/file.Changelog.html @@ -0,0 +1,837 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        2.99.3 Development

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix regression that caused an error when a test double was deserialized +from YAML. (Yuji Nakayama, #777)

          +
        + +

        2.99.2 / 2014-07-21

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Warn about upcoming change to #=== matching and +DateTime#=== behaviour. (Jon Rowe, #735)

          +
        + +

        2.99.1 / 2014-06-12

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix bug that caused errors at the end of each example when a +double.as_null_object had been frozen. (Yuji Nakayama, #698)

          +
        + +

        Deprecations:

        +
        • +

          Deprecate freezing a test double. (Yuji Nakayama, #698)

          +
        + +

        2.99.0 / 2014-06-01

        + +

        Full +Changelog

        + +

        No changes. Just taking it out of pre-release.

        + +

        2.99.0.rc1 / 2014-05-18

        + +

        Full +Changelog

        + +

        Deprecations:

        +
        • +

          Deprecate RSpec::Mocks::TestDouble.extend_onto. (Myron +Marston)

          +
        • +

          Deprecate RSpec::Mocks::ConstantStubber. (Jon Rowe)

          +
        • +

          Deprecate Marshal.dump monkey-patch without opt-in. (Xavier +Shay)

          +
        + +

        2.99.0.beta2 / 2014-02-17

        + +

        Full +Changelog

        + +

        Deprecations:

        +
        • +

          Deprecate RSpec::Mocks::Mock in favor of +RSpec::Mocks::Double. (Myron Marston)

          +
        • +

          Deprecate the host argument of +RSpec::Mocks.setup. Instead +RSpec::Mocks::ExampleMethods should be included directly in +the scope where RSpec's mocking capabilities are used. (Sam Phippen)

          +
        • +

          Deprecate using any of rspec-mocks' features outside the per-test +lifecycle (e.g. from a before(:all) hook). (Myron Marston)

          +
        • +

          Deprecate re-using a test double in another example. (Myron Marston)

          +
        • +

          Deprecate and_return { value } and and_return +without arguments. (Yuji Nakayama)

          +
        + +

        2.99.0.beta1 / 2013-11-07

        + +

        Full +Changelog

        + +

        Deprecations:

        +
        • +

          Expecting to use lambdas or other strong arity implementations for stub +methods with mis-matched arity is deprecated and support for them will be +removed in 3.0. Either provide the right amount of arguments or use a weak +arity implementation (methods with splats or procs). (Jon Rowe)

          +
        • +

          Using the same test double instance in multiple examples is deprecated. +Test doubles are only meant to live for one example. The mocks and stubs +have always been reset between examples; however, in 2.x the +as_null_object state was not reset and some users relied on +this to have a null object double that is used for many examples. This +behavior will be removed in 3.0. (Myron Marston)

          +
        • +

          Print a detailed warning when an any_instance implementation +block is used when the new +yield_receiver_to_any_instance_implementation_blocks config +option is not explicitly set, as RSpec 3.0 will default to enabling this +new feature. (Sam Phippen)

          +
        + +

        Enhancements:

        +
        • +

          Add a config option to yield the receiver to any_instance +implementation blocks. (Sam Phippen)

          +
        + +

        2.14.6 / 2014-02-20

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Ensure any_instance method stubs and expectations are torn +down regardless of expectation failures. (Sam Phippen)

          +
        + +

        2.14.5 / 2014-02-01

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix regression that caused block implementations to not receive all args +on 1.8.7 if the block also receives a block, due to Proc#arity reporting +1 no matter how many args the block receives if it receives a +block, too. (Myron Marston)

          +
        + +

        2.14.4 / 2013-10-15

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix issue where unstubing methods on “any instances” would not remove +stubs on existing instances (Jon Rowe)

          +
        • +

          Fix issue with receive(:message) do … end precedence preventing the usage +of modifications (and_return etc) (Jon Rowe)

          +
        + +

        2.14.3 / 2013-08-08

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix stubbing some instance methods for classes whose hierarchy includes a +prepended Module (Bradley Schaefer)

          +
        + +

        2.14.2 / 2013-07-30

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix as_null_object doubles so that they return +nil from to_ary (Jon Rowe).

          +
        • +

          Fix regression in 2.14 that made stub! (with an implicit +receiver) return a test double rather than stub a method (Myron Marston).

          +
        + +

        2.14.1 / 2013-07-07

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Restore double.as_null_object behavior from 2.13 and earlier: +a double's nullness persisted between examples in earlier examples. +While this is not an intended use case (test doubles are meant to live for +only one example), we don't want to break behavior users rely on in a +minor relase. This will be deprecated in 2.99 and removed in 3.0. (Myron +Marston)

          +
        + +

        2.14.0 / 2013-07-06

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Document test spies in the readme. (Adarsh Pandit)

          +
        • +

          Add an array_including matcher. (Sam Phippen)

          +
        • +

          Add a syntax-agnostic API for mocking or stubbing a method. This is +intended for use by libraries such as rspec-rails that need to mock or +stub a method, and work regardless of the syntax the user has configured +(Paul Annesley, Myron Marston and Sam Phippen).

          +
        + +

        Bug Fixes:

        +
        • +

          Fix double so that it sets up passed stubs correctly +regardless of the configured syntax (Paul Annesley).

          +
        • +

          Allow a block implementation to be used in combination with +and_yield, and_raise, and_return or +and_throw. This got fixed in 2.13.1 but failed to get merged +into master for the 2.14.0.rc1 release (Myron Marston).

          +
        • +

          Marshal.dump does not unnecessarily duplicate objects when +rspec-mocks has not been fully initialized. This could cause errors when +using spork or similar preloading gems (Andy Lindeman).

          +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Refactor internals so that the mock proxy methods and state are held +outside of the mocked object rather than inside it. This paves the way for +future syntax enhancements and removes the need for some hacky work +arounds for any_instance dup'ing and YAML +serialization, among other things. Note that the code now relies upon +__id__ returning a unique, consistent value for any object +you want to mock or stub (Myron Marston).

          +
        • +

          Add support for test spies. This allows you to verify a message was +received afterwards using the have_received matcher. Note +that you must first stub the method or use a null double. (Joe Ferris and +Joël Quenneville)

          +
        • +

          Make at_least and at_most style receive +expectations print that they were expecting at least or at most some +number of calls, rather than just the number of calls given in the +expectation (Sam Phippen)

          +
        • +

          Make with style receive expectations print the args they were +expecting, and the args that they got (Sam Phippen)

          +
        • +

          Fix some warnings seen under ruby 2.0.0p0 (Sam Phippen).

          +
        • +

          Add a new :expect syntax for message expectations (Myron +Marston and Sam Phippen).

          +
        + +

        Bug fixes

        +
        • +

          Fix any_instance so that a frozen object can be +dup'd when methods have been stubbed on that type using +any_instance (Jon Rowe).

          +
        • +

          Fix and_call_original so that it properly raises an +ArgumentError when the wrong number of args are passed (Jon +Rowe).

          +
        • +

          Fix double on 1.9.2 so you can wrap them in an Array using +Array(my_double) (Jon Rowe).

          +
        • +

          Fix stub_const and hide_const to handle constants +that redefine send (Sam Phippen).

          +
        • +

          Fix Marshal.dump extension so that it correctly handles nil. +(Luke Imhoff, Jon Rowe)

          +
        • +

          Fix isolation of allow_message_expectations_on_nil (Jon Rowe)

          +
        • +

          Use inspect to format actual arguments on expectations in failure messages +(#280, Ben Langfeld)

          +
        + +

        Deprecations

        +
        • +

          Deprecate stub and mock as aliases for +double. double is the best term for creating a +test double, and it reduces confusion to have only one term (Michi Huber).

          +
        • +

          Deprecate stub! and unstub! in favor of +stub and unstub (Jon Rowe).

          +
        • +

          Deprecate at_least(0).times and +any_number_of_times (Michi Huber).

          +
        + +

        2.13.1 / 2013-04-06

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Allow a block implementation to be used in combination with +and_yield, and_raise, and_return or +and_throw (Myron Marston).

          +
        + +

        2.13.0 / 2013-02-23

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix bug that caused weird behavior when a method that had previously been +stubbed with multiple return values (e.g. +obj.stub(:foo).and_return(1, 2)) was later mocked with a +single return value (e.g. +obj.should_receive(:foo).once.and_return(1)). (Myron Marston)

          +
        • +

          Fix bug related to a mock expectation for a method that already had +multiple stubs with different with constraints. Previously, +the first stub was used, even though it may not have matched the passed +args. The fix defers this decision until the message is received so that +the proper stub response can be chosen based on the passed arguments +(Myron Marston).

          +
        • +

          Do not call nil? extra times on a mocked object, in case +nil? itself is expected a set number of times (Myron +Marston).

          +
        • +

          Fix missing_default_stub_error message so array args are +handled properly (Myron Marston).

          +
        • +

          Explicitly disallow any_instance.unstub! (Ryan Jones).

          +
        • +

          Fix any_instance stubbing so that it works with +Delegator subclasses (Myron Marston).

          +
        • +

          Fix and_call_original so that it works with +Delegator subclasses (Myron Marston).

          +
        • +

          Fix any_instance.should_not_receive when +any_instance.should_receive is used on the same class in the +same example. Previously it would wrongly report a failure even when the +message was not received (Myron Marston).

          +
        + +

        2.12.2 / 2013-01-27

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix and_call_original to work properly for methods defined on +a module extended onto an object instance (Myron Marston).

          +
        • +

          Fix stub_const with an undefined constnat name to work +properly with constant strings that are prefixed with :: – +and edge case I missed in the bug fix in the 2.12.1 release (Myron +Marston).

          +
        • +

          Ensure method visibility on a partial mock is restored after reseting +method stubs, even on a singleton module (created via extend +self) when the method visibility differs between the instance and +singleton versions (Andy Lindeman).

          +
        + +

        2.12.1 / 2012-12-21

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix any_instance to support and_call_original. +(Myron Marston)

          +
        • +

          Properly restore stubbed aliased methods on rubies that report the +incorrect owner (Myron Marston and Andy Lindeman).

          +
        • +

          Fix hide_const and stub_const with a defined +constnat name to work properly with constant strings that are prefixed +with :: (Myron Marston).

          +
        + +

        2.12.0 / 2012-11-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          and_raise can accept an exception class and message, more +closely matching Kernel#raise (e.g., +foo.stub(:bar).and_raise(RuntimeError, "message")) +(Bas Vodde)

          +
        • +

          Add and_call_original, which will delegate the message to the +original method (Myron Marston).

          +
        + +

        Deprecations:

        +
        • +

          Add deprecation warning when using and_return with +should_not_receive (Neha Kumari)

          +
        + +

        2.11.3 / 2012-09-19

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix :transfer_nested_constants option of +stub_const so that it doesn't blow up when there are +inherited constants. (Myron Marston)

          +
        • +

          any_instance stubs can be used on classes that override +Object#method. (Andy Lindeman)

          +
        • +

          Methods stubbed with any_instance are unstubbed after the test +finishes. (Andy Lindeman)

          +
        • +

          Fix confusing error message when calling a mocked class method an extra +time with the wrong arguments (Myron Marston).

          +
        + +

        2.11.2 / 2012-08-11

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Don't modify dup on classes that don't support +dup (David Chelimsky)

          +
        • +

          Fix any_instance so that it works properly with methods +defined on a superclass. (Daniel Eguzkiza)

          +
        • +

          Fix stub_const so that it works properly for nested constants +that share a name with a top-level constant (e.g. “MyGem::Hash”). (Myron +Marston)

          +
        + +

        2.11.1 / 2012-07-09

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix should_receive so that when it is called on an +as_null_object double with no implementation, and there is a +previous explicit stub for the same method, the explicit stub remains +(rather than being overriden with the null object +implementation–return self). (Myron Marston)

          +
        + +

        2.11.0 / 2012-07-07

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Expose ArgumentListMatcher as a formal API

          +
          • +

            supports use by 3rd party mock frameworks like Surrogate

            +
          +
        • +

          Add stub_const API to stub constants for the duration of an +example (Myron Marston).

          +
        + +

        Bug fixes

        +
        • +

          Fix regression of edge case behavior. double.should_receive(:foo) { a +} was causing a NoMethodError when +double.stub(:foo).and_return(a, b) had been setup before +(Myron Marston).

          +
        • +

          Infinite loop generated by using any_instance and +dup. (Sidu Ponnappa @kaiwren)

          +
        • +

          double.should_receive(:foo).at_least(:once).and_return(a) +always returns a even if :foo is already stubbed.

          +
        • +

          Prevent infinite loop when interpolating a null double into a string as an +integer ("%i" % double.as_null_object). (Myron +Marston)

          +
        • +

          Fix should_receive so that null object behavior (e.g. +returning self) is preserved if no implementation is given (Myron +Marston).

          +
        • +

          Fix and_raise so that it raises RuntimeError +rather than Exception by default, just like ruby does. +(Andrew Marshall)

          +
        + +

        2.10.1 / 2012-05-05

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fix regression of edge case behavior (github.com/rspec/rspec-mocks/issues/132)

          +
          • +

            fixed failure of +object.should_receive(:message).at_least(0).times.and_return +value

            +
          • +

            fixed failure of object.should_not_receive(:message).and_return +value

            +
          +
        + +

        2.10.0 / 2012-05-03

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fail fast when an exactly or at_most expectation +is exceeded

          +
        + +

        2.9.0 / 2012-03-17

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Support order constraints across objects (preethiramdev)

          +
        + +

        Bug fixes

        +
        • +

          Allow a as_null_object to be passed to with

          +
        • +

          Pass proc to block passed to stub (Aubrey Rhodes)

          +
        • +

          Initialize child message expectation args to match any args (#109 - +preethiramdev)

          +
        + +

        2.8.0 / 2012-01-04

        + +

        Full +Changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc2 / 2011-12-19

        + +

        Full +Changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc1 / 2011-11-06

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Eliminate Ruby warnings (Matijs van Zuijlen)

          +
        + +

        2.7.0 / 2011-10-16

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Use __send__ rather than send (alextk)

          +
        • +

          Add support for any_instance.stub_chain (Sidu Ponnappa)

          +
        • +

          Add support for any_instance argument matching based on +with (Sidu Ponnappa and Andy Lindeman)

          +
        + +

        Changes

        +
        • +

          Check for failure_message_for_should or +failure_message instead of description to detect +a matcher (Tibor Claassen)

          +
        + +

        Bug fixes

        +
        • +

          pass a hash to any_instance.stub. (Justin Ko)

          +
        • +

          allow to_ary to be called without raising +NoMethodError (Mikhail Dieterle)

          +
        • +

          any_instance properly restores private methods (Sidu Ponnappa)

          +
        + +

        2.6.0 / 2011-05-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Add support for any_instance.stub and +any_instance.should_receive (Sidu Ponnappa and Andy Lindeman)

          +
        + +

        Bug fixes

        +
        • +

          fix bug in which multiple chains with shared messages ending in hashes +failed to return the correct value

          +
        + +

        2.5.0 / 2011-02-05

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          message expectation counts now work in combination with a stub (Damian +Nurzynski)

          +
        • +

          fix failure message when message received with incorrect args (Josep M. +Bach)

          +
        + +

        2.4.0 / 2011-01-02

        + +

        Full +Changelog

        + +

        No functional changes in this release, which was made to align with the +rspec-core-2.4.0 release.

        + +

        2.3.0 / 2010-12-12

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix our Marshal extension so that it does not interfere with objects that +have their own @mock_proxy instance variable. (Myron Marston)

          +
        + +

        2.2.0 / 2010-11-28

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Added “rspec/mocks/standalone” for exploring the rspec-mocks in irb.

          +
        + +

        Bug fix

        +
        • +

          Eliminate warning on splat args without parens (Gioele Barabucci)

          +
        • +

          Fix bug where +obj.should_receive(:foo).with(stub.as_null_object) would pass +with a false positive.

          +
        + +

        2.1.0 / 2010-11-07

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix serialization of stubbed object (Josep M Bach)

          +
        + +

        2.0.0 / 2010-10-10

        + +

        Full +Changelog

        + +

        2.0.0.rc / 2010-10-05

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          support passing a block to an expectation block (Nicolas Braem)

          +
          • +

            obj.should_receive(:msg) {|&block| ... }

            +
          +
        + +

        Bug fixes

        +
        • +

          Fix YAML serialization of stub (Myron Marston)

          +
        • +

          Fix rdoc rake task (Hans de Graaff)

          +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fixed regression that broke obj.stub_chain(:a, :b => :c)

          +
        • +

          fixed regression that broke obj.stub_chain(:a, :b) { :c }

          +
        • +

          respond_to? always returns true when using +as_null_object

          +
        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/file.License.html b/source/documentation/2.99/rspec-mocks/file.License.html new file mode 100644 index 000000000..151d9b592 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/file.README.html b/source/documentation/2.99/rspec-mocks/file.README.html new file mode 100644 index 000000000..bad861051 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/file.README.html @@ -0,0 +1,385 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        RSpec Mocks

        + +

        rspec-mocks is a test-double framework for rspec with support for method +stubs, fakes, and message expectations on generated test-doubles and real +objects alike.

        + +

        Install

        + +
        gem install rspec       # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-mocks # for rspec-mocks only
        + +

        Test Doubles

        + +

        A Test Double is an object that stands in for a real object in a test. +RSpec creates test doubles that support method stubs and message +expectations.

        + +
        book = double("book")
        +
        + +

        Method Stubs

        + +

        A method stub is an implementation that returns a pre-determined value. +Method stubs can be declared on test doubles or real objects using the same +syntax. rspec-mocks supports 3 forms for declaring method stubs:

        + +
        book.stub(:title) { "The RSpec Book" }
        +book.stub(:title => "The RSpec Book")
        +book.stub(:title).and_return("The RSpec Book")
        +
        + +

        You can also use this shortcut, which creates a test double and declares a +method stub in one statement:

        + +
        book = double("book", :title => "The RSpec Book")
        +
        + +

        The first argument is a name, which is used for documentation and appears +in failure messages. If you don't care about the name, you can leave it +out, making the combined instantiation/stub declaration very terse:

        + +
        double(:foo => 'bar')
        +
        + +

        This is particularly nice when providing a list of test doubles to a method +that iterates through them:

        + +
        order.calculate_total_price(double(:price => 1.99),double(:price => 2.99))
        +
        + +

        Consecutive return values

        + +

        When a stub might be invoked more than once, you can provide additional +arguments to and_return. The invocations cycle through the +list. The last value is returned for any subsequent invocations:

        + +
        die.stub(:roll).and_return(1,2,3)
        +die.roll # => 1
        +die.roll # => 2
        +die.roll # => 3
        +die.roll # => 3
        +die.roll # => 3
        +
        + +

        To return an array in a single invocation, declare an array:

        + +
        team.stub(:players).and_return([stub(:name => "David")])
        +
        + +

        Message Expectations

        + +

        A message expectation is an expectation that the test double will receive a +message some time before the example ends. If the message is received, the +expectation is satisfied. If not, the example fails.

        + +
        validator = double("validator")
        +validator.should_receive(:validate).with("02134")
        +zipcode = Zipcode.new("02134", validator)
        +zipcode.valid?
        +
        + +

        Nomenclature

        + +

        Mock Objects and Test Stubs

        + +

        The names Mock Object and Test Stub suggest specialized Test Doubles. i.e. +a Test Stub is a Test Double that only supports method stubs, and a Mock +Object is a Test Double that supports message expectations and method +stubs.

        + +

        There is a lot of overlapping nomenclature here, and there are many +variations of these patterns (fakes, spies, etc). Keep in mind that most of +the time we're talking about method-level concepts that are variations +of method stubs and message expectations, and we're applying to them to +one generic kind of object: a Test Double.

        + +

        Test-Specific Extension

        + +

        a.k.a. Partial Stub/Mock, a Test-Specific Extension is an extension of a +real object in a system that is instrumented with test-double like +behaviour in the context of a test. This technique is very common in Ruby +because we often see class objects acting as global namespaces for methods. +For example, in Rails:

        + +
        person = double("person")
        +Person.stub(:find) { person }
        +
        + +

        In this case we're instrumenting Person to return the person object +we've defined whenever it receives the find message. We +can also set a message expectation so that the example fails if +find is not called:

        + +
        person = double("person")
        +Person.should_receive(:find) { person }
        +
        + +

        We can do this with any object in a system because rspec-mocks adds the +stub and should_receive methods to every object, +including class objects. When we use either, RSpec replaces the method +we're stubbing or mocking with its own test-double-like method. At the +end of the example, RSpec verifies any message expectations, and then +restores the original methods.

        + +

        Expecting Arguments

        + +
        double.should_receive(:msg).with(*args)
        +double.should_not_receive(:msg).with(*args)
        +
        + +

        You can set multiple expectations for the same message if you need to:

        + +
        double.should_receive(:msg).with("A", 1, 3)
        +double.should_receive(:msg).with("B", 2, 4)
        +
        + +

        Argument Matchers

        + +

        Arguments that are passed to with are compared with actual +arguments received using ==. In cases in which you want to specify things +about the arguments rather than the arguments themselves, you can use any +of the matchers that ship with rspec-expectations. They don't all make +syntactic sense (they were primarily designed for use with +RSpec::Expectations), but you are free to create your own custom +RSpec::Matchers.

        + +

        rspec-mocks also adds some keyword Symbols that you can use to specify +certain kinds of arguments:

        + +
        double.should_receive(:msg).with(no_args())
        +double.should_receive(:msg).with(any_args())
        +double.should_receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can be any kind of Numeric
        +double.should_receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
        +double.should_receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
        +double.should_receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
        +double.should_receive(:msg).with(1, duck_type(:abs, :div), "b")
        +                    #2nd argument can be object that responds to #abs and #div
        +
        + +

        Receive Counts

        + +
        double.should_receive(:msg).once
        +double.should_receive(:msg).twice
        +double.should_receive(:msg).exactly(n).times
        +double.should_receive(:msg).at_least(:once)
        +double.should_receive(:msg).at_least(:twice)
        +double.should_receive(:msg).at_least(n).times
        +double.should_receive(:msg).at_most(:once)
        +double.should_receive(:msg).at_most(:twice)
        +double.should_receive(:msg).at_most(n).times
        +double.should_receive(:msg).any_number_of_times
        +
        + +

        Ordering

        + +
        double.should_receive(:msg).ordered
        +double.should_receive(:other_msg).ordered
        +  #This will fail if the messages are received out of order
        +
        + +

        This can include the same message with different arguments:

        + +
        double.should_receive(:msg).with("A", 1, 3).ordered
        +double.should_receive(:msg).with("B", 2, 4).ordered
        +
        + +

        Setting Responses

        + +

        Whether you are setting a message expectation or a method stub, you can +tell the object precisely how to respond. The most generic way is to pass a +block to stub or should_receive:

        + +
        double.should_receive(:msg) { value }
        +
        + +

        When the double receives the msg message, it evaluates the +block and returns the result.

        + +
        double.should_receive(:msg).and_return(value)
        +double.should_receive(:msg).exactly(3).times.and_return(value1, value2, value3)
        +  # returns value1 the first time, value2 the second, etc
        +double.should_receive(:msg).and_raise(error)
        +  #error can be an instantiated object or a class
        +  #if it is a class, it must be instantiable with no args
        +double.should_receive(:msg).and_throw(:msg)
        +double.should_receive(:msg).and_yield(values,to,yield)
        +double.should_receive(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
        +  # for methods that yield to a block multiple times
        +
        + +

        Any of these responses can be applied to a stub as well

        + +
        double.stub(:msg).and_return(value)
        +double.stub(:msg).and_return(value1, value2, value3)
        +double.stub(:msg).and_raise(error)
        +double.stub(:msg).and_throw(:msg)
        +double.stub(:msg).and_yield(values,to,yield)
        +double.stub(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
        +
        + +

        Arbitrary Handling

        + +

        Once in a while you'll find that the available expectations don't +solve the particular problem you are trying to solve. Imagine that you +expect the message to come with an Array argument that has a specific +length, but you don't care what is in it. You could do this:

        + +
        double.should_receive(:msg) do |arg|
        +  arg.size.should eq(7)
        +end
        +
        + +

        If the method being stubbed itself takes a block, and you need to yield to +it in some special way, you can use this:

        + +
        double.should_receive(:msg) do |&arg|
        +  begin
        +    arg.call
        +  ensure
        +    # cleanup
        +  end
        +end
        +
        + +

        Delegating to the Original Implementation

        + +

        When working with a partial mock object, you may occasionally want to set a +message expecation without interfering with how the object responds to the +message. You can use and_call_original to achieve this:

        + +
        Person.should_receive(:find).and_call_original
        +Person.find # => executes the original find method and returns the result
        +
        + +

        Combining Expectation Details

        + +

        Combining the message name with specific arguments, receive counts and +responses you can get quite a bit of detail in your expectations:

        + +
        double.should_receive(:<<).with("illegal value").once.and_raise(ArgumentError)
        +
        + +

        While this is a good thing when you really need it, you probably don't +really need it! Take care to specify only the things that matter to the +behavior of your code.

        + +

        Stubbing and Hiding Constants

        + +

        See the mutating +constants README for info on this feature.

        + +

        Use before(:each), not before(:all)

        + +

        Stubs in before(:all) are not supported. The reason is that +all stubs and mocks get cleared out after each example, so any stub that is +set in before(:all) would work in the first example that +happens to run in that group, but not for any others.

        + +

        Instead of before(:all), use before(:each).

        + +

        Further Reading

        + +

        There are many different viewpoints about the meaning of mocks and stubs. +If you are interested in learning more, here is some recommended reading:

        + + +

        Also see

        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/file_list.html b/source/documentation/2.99/rspec-mocks/file_list.html new file mode 100644 index 000000000..4fbe39987 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/file_list.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-mocks/frames.html b/source/documentation/2.99/rspec-mocks/frames.html new file mode 100644 index 000000000..87a4a6df1 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + diff --git a/source/documentation/2.99/rspec-mocks/index.html b/source/documentation/2.99/rspec-mocks/index.html new file mode 100644 index 000000000..bad861051 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/index.html @@ -0,0 +1,385 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        RSpec Mocks

        + +

        rspec-mocks is a test-double framework for rspec with support for method +stubs, fakes, and message expectations on generated test-doubles and real +objects alike.

        + +

        Install

        + +
        gem install rspec       # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-mocks # for rspec-mocks only
        + +

        Test Doubles

        + +

        A Test Double is an object that stands in for a real object in a test. +RSpec creates test doubles that support method stubs and message +expectations.

        + +
        book = double("book")
        +
        + +

        Method Stubs

        + +

        A method stub is an implementation that returns a pre-determined value. +Method stubs can be declared on test doubles or real objects using the same +syntax. rspec-mocks supports 3 forms for declaring method stubs:

        + +
        book.stub(:title) { "The RSpec Book" }
        +book.stub(:title => "The RSpec Book")
        +book.stub(:title).and_return("The RSpec Book")
        +
        + +

        You can also use this shortcut, which creates a test double and declares a +method stub in one statement:

        + +
        book = double("book", :title => "The RSpec Book")
        +
        + +

        The first argument is a name, which is used for documentation and appears +in failure messages. If you don't care about the name, you can leave it +out, making the combined instantiation/stub declaration very terse:

        + +
        double(:foo => 'bar')
        +
        + +

        This is particularly nice when providing a list of test doubles to a method +that iterates through them:

        + +
        order.calculate_total_price(double(:price => 1.99),double(:price => 2.99))
        +
        + +

        Consecutive return values

        + +

        When a stub might be invoked more than once, you can provide additional +arguments to and_return. The invocations cycle through the +list. The last value is returned for any subsequent invocations:

        + +
        die.stub(:roll).and_return(1,2,3)
        +die.roll # => 1
        +die.roll # => 2
        +die.roll # => 3
        +die.roll # => 3
        +die.roll # => 3
        +
        + +

        To return an array in a single invocation, declare an array:

        + +
        team.stub(:players).and_return([stub(:name => "David")])
        +
        + +

        Message Expectations

        + +

        A message expectation is an expectation that the test double will receive a +message some time before the example ends. If the message is received, the +expectation is satisfied. If not, the example fails.

        + +
        validator = double("validator")
        +validator.should_receive(:validate).with("02134")
        +zipcode = Zipcode.new("02134", validator)
        +zipcode.valid?
        +
        + +

        Nomenclature

        + +

        Mock Objects and Test Stubs

        + +

        The names Mock Object and Test Stub suggest specialized Test Doubles. i.e. +a Test Stub is a Test Double that only supports method stubs, and a Mock +Object is a Test Double that supports message expectations and method +stubs.

        + +

        There is a lot of overlapping nomenclature here, and there are many +variations of these patterns (fakes, spies, etc). Keep in mind that most of +the time we're talking about method-level concepts that are variations +of method stubs and message expectations, and we're applying to them to +one generic kind of object: a Test Double.

        + +

        Test-Specific Extension

        + +

        a.k.a. Partial Stub/Mock, a Test-Specific Extension is an extension of a +real object in a system that is instrumented with test-double like +behaviour in the context of a test. This technique is very common in Ruby +because we often see class objects acting as global namespaces for methods. +For example, in Rails:

        + +
        person = double("person")
        +Person.stub(:find) { person }
        +
        + +

        In this case we're instrumenting Person to return the person object +we've defined whenever it receives the find message. We +can also set a message expectation so that the example fails if +find is not called:

        + +
        person = double("person")
        +Person.should_receive(:find) { person }
        +
        + +

        We can do this with any object in a system because rspec-mocks adds the +stub and should_receive methods to every object, +including class objects. When we use either, RSpec replaces the method +we're stubbing or mocking with its own test-double-like method. At the +end of the example, RSpec verifies any message expectations, and then +restores the original methods.

        + +

        Expecting Arguments

        + +
        double.should_receive(:msg).with(*args)
        +double.should_not_receive(:msg).with(*args)
        +
        + +

        You can set multiple expectations for the same message if you need to:

        + +
        double.should_receive(:msg).with("A", 1, 3)
        +double.should_receive(:msg).with("B", 2, 4)
        +
        + +

        Argument Matchers

        + +

        Arguments that are passed to with are compared with actual +arguments received using ==. In cases in which you want to specify things +about the arguments rather than the arguments themselves, you can use any +of the matchers that ship with rspec-expectations. They don't all make +syntactic sense (they were primarily designed for use with +RSpec::Expectations), but you are free to create your own custom +RSpec::Matchers.

        + +

        rspec-mocks also adds some keyword Symbols that you can use to specify +certain kinds of arguments:

        + +
        double.should_receive(:msg).with(no_args())
        +double.should_receive(:msg).with(any_args())
        +double.should_receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can be any kind of Numeric
        +double.should_receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
        +double.should_receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
        +double.should_receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
        +double.should_receive(:msg).with(1, duck_type(:abs, :div), "b")
        +                    #2nd argument can be object that responds to #abs and #div
        +
        + +

        Receive Counts

        + +
        double.should_receive(:msg).once
        +double.should_receive(:msg).twice
        +double.should_receive(:msg).exactly(n).times
        +double.should_receive(:msg).at_least(:once)
        +double.should_receive(:msg).at_least(:twice)
        +double.should_receive(:msg).at_least(n).times
        +double.should_receive(:msg).at_most(:once)
        +double.should_receive(:msg).at_most(:twice)
        +double.should_receive(:msg).at_most(n).times
        +double.should_receive(:msg).any_number_of_times
        +
        + +

        Ordering

        + +
        double.should_receive(:msg).ordered
        +double.should_receive(:other_msg).ordered
        +  #This will fail if the messages are received out of order
        +
        + +

        This can include the same message with different arguments:

        + +
        double.should_receive(:msg).with("A", 1, 3).ordered
        +double.should_receive(:msg).with("B", 2, 4).ordered
        +
        + +

        Setting Responses

        + +

        Whether you are setting a message expectation or a method stub, you can +tell the object precisely how to respond. The most generic way is to pass a +block to stub or should_receive:

        + +
        double.should_receive(:msg) { value }
        +
        + +

        When the double receives the msg message, it evaluates the +block and returns the result.

        + +
        double.should_receive(:msg).and_return(value)
        +double.should_receive(:msg).exactly(3).times.and_return(value1, value2, value3)
        +  # returns value1 the first time, value2 the second, etc
        +double.should_receive(:msg).and_raise(error)
        +  #error can be an instantiated object or a class
        +  #if it is a class, it must be instantiable with no args
        +double.should_receive(:msg).and_throw(:msg)
        +double.should_receive(:msg).and_yield(values,to,yield)
        +double.should_receive(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
        +  # for methods that yield to a block multiple times
        +
        + +

        Any of these responses can be applied to a stub as well

        + +
        double.stub(:msg).and_return(value)
        +double.stub(:msg).and_return(value1, value2, value3)
        +double.stub(:msg).and_raise(error)
        +double.stub(:msg).and_throw(:msg)
        +double.stub(:msg).and_yield(values,to,yield)
        +double.stub(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
        +
        + +

        Arbitrary Handling

        + +

        Once in a while you'll find that the available expectations don't +solve the particular problem you are trying to solve. Imagine that you +expect the message to come with an Array argument that has a specific +length, but you don't care what is in it. You could do this:

        + +
        double.should_receive(:msg) do |arg|
        +  arg.size.should eq(7)
        +end
        +
        + +

        If the method being stubbed itself takes a block, and you need to yield to +it in some special way, you can use this:

        + +
        double.should_receive(:msg) do |&arg|
        +  begin
        +    arg.call
        +  ensure
        +    # cleanup
        +  end
        +end
        +
        + +

        Delegating to the Original Implementation

        + +

        When working with a partial mock object, you may occasionally want to set a +message expecation without interfering with how the object responds to the +message. You can use and_call_original to achieve this:

        + +
        Person.should_receive(:find).and_call_original
        +Person.find # => executes the original find method and returns the result
        +
        + +

        Combining Expectation Details

        + +

        Combining the message name with specific arguments, receive counts and +responses you can get quite a bit of detail in your expectations:

        + +
        double.should_receive(:<<).with("illegal value").once.and_raise(ArgumentError)
        +
        + +

        While this is a good thing when you really need it, you probably don't +really need it! Take care to specify only the things that matter to the +behavior of your code.

        + +

        Stubbing and Hiding Constants

        + +

        See the mutating +constants README for info on this feature.

        + +

        Use before(:each), not before(:all)

        + +

        Stubs in before(:all) are not supported. The reason is that +all stubs and mocks get cleared out after each example, so any stub that is +set in before(:all) would work in the first example that +happens to run in that group, but not for any others.

        + +

        Instead of before(:all), use before(:each).

        + +

        Further Reading

        + +

        There are many different viewpoints about the meaning of mocks and stubs. +If you are interested in learning more, here is some recommended reading:

        + + +

        Also see

        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-mocks/method_list.html b/source/documentation/2.99/rspec-mocks/method_list.html new file mode 100644 index 000000000..96da252f5 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/method_list.html @@ -0,0 +1,1401 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-mocks/top-level-namespace.html b/source/documentation/2.99/rspec-mocks/top-level-namespace.html new file mode 100644 index 000000000..4c5b2b2b8 --- /dev/null +++ b/source/documentation/2.99/rspec-mocks/top-level-namespace.html @@ -0,0 +1,114 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Backports, Kernel, Marshal, RSpec + + + + Classes: Method, Proc + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file From 30eb185dd39cb1abdbd268e222f33be55e272da9 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:29:15 +1100 Subject: [PATCH 12/14] rspec-expectations 2.99 documentation --- .../2.99/rspec-expectations/RSpec.html | 129 + .../RSpec/CallerFilter.html | 274 ++ .../RSpec/Expectations.html | 501 +++ .../RSpec/Expectations/Configuration.html | 708 ++++ .../Expectations/DeprecatedConstants.html | 208 + .../RSpec/Expectations/Deprecation.html | 109 + .../RSpec/Expectations/Differ.html | 348 ++ .../Expectations/ExpectationHandler.html | 205 + .../Expectations/ExpectationNotMetError.html | 125 + .../RSpec/Expectations/ExpectationTarget.html | 860 ++++ .../NegativeExpectationHandler.html | 242 ++ .../PositiveExpectationHandler.html | 246 ++ .../RSpec/Expectations/Syntax.html | 1259 ++++++ .../Syntax/ExpectExpressionGenerator.html | 266 ++ .../Syntax/ShouldExpressionGenerator.html | 266 ++ .../rspec-expectations/RSpec/Matchers.html | 3519 +++++++++++++++++ .../RSpec/Matchers/BuiltIn.html | 119 + .../RSpec/Matchers/BuiltIn/BaseMatcher.html | 1028 +++++ .../RSpec/Matchers/BuiltIn/Be.html | 425 ++ .../RSpec/Matchers/BuiltIn/BeAKindOf.html | 244 ++ .../Matchers/BuiltIn/BeAnInstanceOf.html | 296 ++ .../RSpec/Matchers/BuiltIn/BeComparedTo.html | 574 +++ .../RSpec/Matchers/BuiltIn/BeFalsey.html | 348 ++ .../RSpec/Matchers/BuiltIn/BeHelpers.html | 109 + .../RSpec/Matchers/BuiltIn/BeNil.html | 348 ++ .../RSpec/Matchers/BuiltIn/BePredicate.html | 549 +++ .../RSpec/Matchers/BuiltIn/BeTruthy.html | 348 ++ .../RSpec/Matchers/BuiltIn/BeWithin.html | 573 +++ .../RSpec/Matchers/BuiltIn/Change.html | 1165 ++++++ .../RSpec/Matchers/BuiltIn/Cover.html | 407 ++ .../RSpec/Matchers/BuiltIn/EndWith.html | 353 ++ .../RSpec/Matchers/BuiltIn/Eq.html | 418 ++ .../RSpec/Matchers/BuiltIn/Eql.html | 422 ++ .../RSpec/Matchers/BuiltIn/Equal.html | 452 +++ .../RSpec/Matchers/BuiltIn/Exist.html | 351 ++ .../RSpec/Matchers/BuiltIn/Has.html | 469 +++ .../RSpec/Matchers/BuiltIn/Have.html | 1007 +++++ .../RSpec/Matchers/BuiltIn/Include.html | 537 +++ .../RSpec/Matchers/BuiltIn/Match.html | 318 ++ .../RSpec/Matchers/BuiltIn/MatchArray.html | 424 ++ .../BuiltIn/NegativeOperatorMatcher.html | 210 + .../Matchers/BuiltIn/OperatorMatcher.html | 631 +++ .../BuiltIn/PositiveOperatorMatcher.html | 220 ++ .../RSpec/Matchers/BuiltIn/RaiseError.html | 739 ++++ .../RSpec/Matchers/BuiltIn/RespondTo.html | 639 +++ .../RSpec/Matchers/BuiltIn/Satisfy.html | 455 +++ .../Matchers/BuiltIn/StartAndEndWith.html | 447 +++ .../RSpec/Matchers/BuiltIn/StartWith.html | 353 ++ .../RSpec/Matchers/BuiltIn/ThrowSymbol.html | 615 +++ .../RSpec/Matchers/BuiltIn/YieldControl.html | 777 ++++ .../RSpec/Matchers/BuiltIn/YieldProbe.html | 807 ++++ .../Matchers/BuiltIn/YieldSuccessiveArgs.html | 467 +++ .../RSpec/Matchers/BuiltIn/YieldWithArgs.html | 459 +++ .../Matchers/BuiltIn/YieldWithNoArgs.html | 372 ++ .../RSpec/Matchers/DSL.html | 222 ++ .../RSpec/Matchers/DSL/Matcher.html | 2012 ++++++++++ .../DifferentiateBlockMethodTypes.html | 372 ++ .../RSpec/Matchers/Extensions.html | 115 + .../Extensions/InstanceEvalWithArgs.html | 239 ++ .../RSpec/Matchers/MatchAliases.html | 246 ++ .../RSpec/Matchers/Pretty.html | 613 +++ .../2.99/rspec-expectations/_index.html | 643 +++ .../2.99/rspec-expectations/class_list.html | 54 + .../rspec-expectations/file.Changelog.html | 733 ++++ .../2.99/rspec-expectations/file.License.html | 73 + .../2.99/rspec-expectations/file.README.html | 248 ++ .../2.99/rspec-expectations/file_list.html | 62 + .../2.99/rspec-expectations/frames.html | 26 + .../2.99/rspec-expectations/index.html | 248 ++ .../2.99/rspec-expectations/method_list.html | 1847 +++++++++ .../top-level-namespace.html | 138 + 71 files changed, 35631 insertions(+) create mode 100644 source/documentation/2.99/rspec-expectations/RSpec.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/CallerFilter.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/Configuration.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/DeprecatedConstants.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/Deprecation.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/Differ.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationHandler.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationNotMetError.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationTarget.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/NegativeExpectationHandler.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/PositiveExpectationHandler.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax/ExpectExpressionGenerator.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax/ShouldExpressionGenerator.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalsey.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeHelpers.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeTruthy.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Have.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/MatchArray.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/NegativeOperatorMatcher.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/OperatorMatcher.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/PositiveOperatorMatcher.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldProbe.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/DSL.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/DSL/Matcher.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/DifferentiateBlockMethodTypes.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/Extensions.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/Extensions/InstanceEvalWithArgs.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/MatchAliases.html create mode 100644 source/documentation/2.99/rspec-expectations/RSpec/Matchers/Pretty.html create mode 100644 source/documentation/2.99/rspec-expectations/_index.html create mode 100644 source/documentation/2.99/rspec-expectations/class_list.html create mode 100644 source/documentation/2.99/rspec-expectations/file.Changelog.html create mode 100644 source/documentation/2.99/rspec-expectations/file.License.html create mode 100644 source/documentation/2.99/rspec-expectations/file.README.html create mode 100644 source/documentation/2.99/rspec-expectations/file_list.html create mode 100644 source/documentation/2.99/rspec-expectations/frames.html create mode 100644 source/documentation/2.99/rspec-expectations/index.html create mode 100644 source/documentation/2.99/rspec-expectations/method_list.html create mode 100644 source/documentation/2.99/rspec-expectations/top-level-namespace.html diff --git a/source/documentation/2.99/rspec-expectations/RSpec.html b/source/documentation/2.99/rspec-expectations/RSpec.html new file mode 100644 index 000000000..3274f0cd1 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec.html @@ -0,0 +1,129 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec + + + +

        + +
        + + + +
        Extended by:
        +
        Expectations::Deprecation
        + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers.rb,
        + lib/rspec/matchers/dsl.rb,
        lib/rspec/expectations.rb,
        lib/rspec/matchers/pretty.rb,
        lib/rspec/matchers/matcher.rb,
        lib/rspec/matchers/built_in.rb,
        lib/rspec/matchers/be_close.rb,
        lib/rspec/expectations/errors.rb,
        lib/rspec/expectations/differ.rb,
        lib/rspec/expectations/syntax.rb,
        lib/rspec/expectations/handler.rb,
        lib/rspec/matchers/built_in/be.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/expectations/version.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/have.rb,
        lib/rspec/matchers/match_aliases.rb,
        lib/rspec/expectations/fail_with.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/method_missing.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/expectations/deprecation.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/operator_matcher.rb,
        lib/rspec/expectations/configuration.rb,
        lib/rspec/expectations/caller_filter.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/match_array.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/expectations/extensions/object.rb,
        lib/rspec/expectations/expectation_target.rb,
        lib/rspec/matchers/generated_descriptions.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb,
        lib/rspec/matchers/differentiate_block_method_types.rb,
        lib/rspec/matchers/extensions/instance_eval_with_args.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Expectations, Matchers + + + + Classes: CallerFilter + + +

        + + + + + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/CallerFilter.html b/source/documentation/2.99/rspec-expectations/RSpec/CallerFilter.html new file mode 100644 index 000000000..384183a08 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/CallerFilter.html @@ -0,0 +1,274 @@ + + + + + + Class: RSpec::CallerFilter + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::CallerFilter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/caller_filter.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        RSPEC_LIBS = + +
        +
        %w[
        +core
        +mocks
        +expectations
        +matchers
        +rails
        + +
        ADDITIONAL_TOP_LEVEL_FILES = + +
        +
        %w[ autorun ]
        + +
        LIB_REGEX = + +
        +
        %r{/lib/rspec/(#{(RSPEC_LIBS + ADDITIONAL_TOP_LEVEL_FILES).join('|')})(\.rb|/)}
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) first_non_rspec_line + + + + + +

        +
        +

        Earlier rubies do not support the two argument form of caller. This +fallback is logically the same, but slower.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/expectations/caller_filter.rb', line 53
        +
        +def self.first_non_rspec_line
        +  # `caller` is an expensive method that scales linearly with the size of
        +  # the stack. The performance hit for fetching it in chunks is small,
        +  # and since the target line is probably near the top of the stack, the
        +  # overall improvement of a chunked search like this is significant.
        +  #
        +  # See benchmarks/caller.rb for measurements.
        +
        +  # Initial value here is mostly arbitrary, but is chosen to give good
        +  # performance on the common case of creating a double.
        +  increment = 5
        +  i         = 1
        +  line      = nil
        +
        +  while !line
        +    stack = caller(i, increment)
        +    return nil unless stack
        +
        +    line = stack.find { |l| l !~ LIB_REGEX }
        +
        +    i         += increment
        +    increment *= 2 # The choice of two here is arbitrary.
        +  end
        +
        +  line
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations.html new file mode 100644 index 000000000..a5d7dc658 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations.html @@ -0,0 +1,501 @@ + + + + + + Module: RSpec::Expectations + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations.rb,
        + lib/rspec/expectations/errors.rb,
        lib/rspec/expectations/differ.rb,
        lib/rspec/expectations/syntax.rb,
        lib/rspec/expectations/handler.rb,
        lib/rspec/expectations/version.rb,
        lib/rspec/expectations/fail_with.rb,
        lib/rspec/expectations/deprecation.rb,
        lib/rspec/expectations/configuration.rb,
        lib/rspec/expectations/extensions/object.rb,
        lib/rspec/expectations/expectation_target.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        RSpec::Expectations adds two instance methods to every object:

        + +
        should(matcher=nil)
        +should_not(matcher=nil)
        +
        + +

        Both methods take an optional matcher object (See +RSpec::Matchers). When should is invoked with a +matcher, it turns around and calls matcher.matches?(self). For example, +in the expression:

        + +
        order.total.should eq(Money.new(5.55, :USD))
        +
        + +

        the should method invokes the equivalent of eq.matches?(order.total). If +matches? returns true, the expectation is met and execution continues. If +false, then the spec fails with the message returned by +eq.failure_message_for_should.

        + +

        Given the expression:

        + +
        order.entries.should_not include(entry)
        +
        + +

        the should_not method invokes the equivalent of +include.matches?(order.entries), but it interprets false as success, and +true as a failure, using the message generated by +eq.failure_message_for_should_not.

        + +

        rspec-expectations ships with a standard set of useful matchers, and writing +your own matchers is quite simple.

        + +

        See RSpec::Matchers for more information about the +built-in matchers that ship with rspec-expectations, and how to write your +own custom matchers.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: DeprecatedConstants, Deprecation, Syntax + + + + Classes: Configuration, Differ, ExpectationHandler, ExpectationNotMetError, ExpectationTarget, NegativeExpectationHandler, PositiveExpectationHandler + + +

        + +

        Constant Summary

        + +
        + +
        KERNEL_METHOD_METHOD = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        +
        +
        ::Kernel.instance_method(:method)
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) fail_with(message, expected = nil, actual = nil) + + + + + +

        +
        +

        Raises an RSpec::Expectations::ExpectationNotMetError with message. +Adds a diff to the failure message when expected and actual are +both present.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + +
        • + +
        • + + expected + + + (Object) + + + (defaults to: nil) + + +
        • + +
        • + + actual + + + (Object) + + + (defaults to: nil) + + +
        • + +
        + +

        Raises:

        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/expectations/fail_with.rb', line 16
        +
        +def fail_with(message, expected=nil, actual=nil)
        +  if !message
        +    raise ArgumentError, "Failure message is nil. Does your matcher define the " +
        +                         "appropriate failure_message_for_* method to return a string?"
        +  end
        +
        +  if actual && expected
        +    if all_strings?(actual, expected)
        +      if any_multiline_strings?(actual, expected)
        +        message << "\nDiff:" << differ.diff_as_string(coerce_to_string(actual), coerce_to_string(expected))
        +      end
        +    elsif no_procs?(actual, expected) && no_numbers?(actual, expected)
        +      message << "\nDiff:" << differ.diff_as_object(actual, expected)
        +    end
        +  end
        +
        +  raise(RSpec::Expectations::ExpectationNotMetError.new(message))
        +end
        +
        +
        + +
        +

        + + + (Object) method_handle_for(object, method_name) + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/expectations.rb', line 60
        +
        +def self.method_handle_for(object, method_name)
        +  KERNEL_METHOD_METHOD.bind(object).call(method_name)
        +rescue NameError => original
        +  begin
        +    handle = object.method(method_name)
        +    raise original unless handle.is_a? Method
        +    handle
        +  rescue Exception
        +    raise original
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) differ=(ignore) + + + + + +

        +
        +
        Deprecated.

        (no replacement)

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/expectations/extensions/object.rb', line 23
        +
        +def differ=(ignore)
        +  RSpec.deprecate("RSpec::Expectations.differ=(differ)")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Configuration.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Configuration.html new file mode 100644 index 000000000..e747e03ab --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Configuration.html @@ -0,0 +1,708 @@ + + + + + + Class: RSpec::Expectations::Configuration + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/configuration.rb
        + +
        +
        + +

        Overview

        +
        +

        Provides configuration options for rspec-expectations.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + +
        + +
        NullBacktraceFormatter = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        +
        +
        Module.new do
        +  def self.format_backtrace(backtrace)
        +    backtrace
        +  end
        +end
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) backtrace_formatter + + + + + +

        + + + + +
        +
        +
        +
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 82
        +
        +def backtrace_formatter
        +  @backtrace_formatter ||= if defined?(::RSpec::Core::BacktraceFormatter)
        +    ::RSpec::Core::BacktraceFormatter
        +  else
        +    NullBacktraceFormatter
        +  end
        +end
        +
        +
        + + + +
        +

        + + - (Object) color=(value) (writeonly) + + + + + +

        +
        +

        Sets the attribute color

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + value + + + + + + + — +

          the value to set the attribute color to.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 49
        +
        +def color=(value)
        +  @color = value
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_should_and_should_not_to(*modules) + + + + + +

        +
        +

        Adds should and should_not to the given classes +or modules. This can be used to ensure should works +properly on things like proxy objects (particular +Delegator-subclassed objects on 1.8).

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + modules + + + (Array<Module>) + + + + — +

          the list of classes or modules +to add should and should_not to.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 62
        +
        +def add_should_and_should_not_to(*modules)
        +  modules.each do |mod|
        +    Expectations::Syntax.enable_should(mod)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) color? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 45
        +
        +def color?
        +  ::RSpec.configuration.color_enabled?
        +end
        +
        +
        + +
        +

        + + - (Array<Symbol>) syntax + + + + + +

        +
        +

        The list of configured syntaxes.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array<Symbol>) + + + + — +

          the list of configured syntaxes.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 35
        +
        +def syntax
        +  syntaxes = []
        +  syntaxes << :should if Expectations::Syntax.should_enabled?
        +  syntaxes << :expect if Expectations::Syntax.expect_enabled?
        +  syntaxes
        +end
        +
        +
        + +
        +

        + + - (Object) syntax=(values) + + + + + +

        +
        +

        Configures the supported syntax.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |rspec|
        +  rspec.expect_with :rspec do |c|
        +    c.syntax = :should
        +    # or
        +    c.syntax = :expect
        +    # or
        +    c.syntax = [:should, :expect]
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + values + + + (Array<Symbol>, Symbol) + + + + — +

          the syntaxes to enable

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 19
        +
        +def syntax=(values)
        +  if Array(values).include?(:expect)
        +    Expectations::Syntax.enable_expect
        +  else
        +    Expectations::Syntax.disable_expect
        +  end
        +
        +  if Array(values).include?(:should)
        +    Expectations::Syntax.enable_should
        +  else
        +    Expectations::Syntax.disable_should
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/DeprecatedConstants.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/DeprecatedConstants.html new file mode 100644 index 000000000..86a5acdcd --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/DeprecatedConstants.html @@ -0,0 +1,208 @@ + + + + + + Module: RSpec::Expectations::DeprecatedConstants + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::DeprecatedConstants + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/extensions/object.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) const_missing(name) + + + + + +

        +
        +

        Displays deprecation warning when it captures Rspec and Spec. Otherwise +delegates to super.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/expectations/extensions/object.rb', line 6
        +
        +def const_missing(name)
        +  case name
        +  when :Rspec, :Spec
        +    RSpec.deprecate(name.to_s, :replacement => "RSpec")
        +    RSpec
        +  else
        +    begin
        +      super
        +    rescue Exception => e
        +      e.backtrace.reject! {|l| l =~ Regexp.compile(__FILE__) }
        +      raise e
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Deprecation.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Deprecation.html new file mode 100644 index 000000000..41ed3d68d --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Deprecation.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Expectations::Deprecation + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Deprecation + + + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec
        + + + +
        Defined in:
        +
        lib/rspec/expectations/deprecation.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Differ.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Differ.html new file mode 100644 index 000000000..8e973ceab --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Differ.html @@ -0,0 +1,348 @@ + + + + + + Class: RSpec::Expectations::Differ + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::Differ + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/differ.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) diff_as_object(actual, expected) + + + + + +

        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/expectations/differ.rb', line 58
        +
        +def diff_as_object(actual, expected)
        +  actual_as_string = object_to_string(actual)
        +  expected_as_string = object_to_string(expected)
        +  if diff = diff_as_string(actual_as_string, expected_as_string)
        +    color_diff diff
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) diff_as_string(input_data_new, input_data_old) + + + + + +

        +
        +

        This is snagged from diff/lcs/ldiff.rb (which is a commandline tool)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +
        +
        # File 'lib/rspec/expectations/differ.rb', line 10
        +
        +def diff_as_string(input_data_new, input_data_old)
        +  encoding = pick_encoding input_data_new, input_data_old
        +  output = matching_encoding("", encoding)
        +  data_old = input_data_old.split(matching_encoding("\n", encoding)).map! { |e| e.chomp }
        +  data_new = input_data_new.split(matching_encoding("\n", encoding)).map! { |e| e.chomp }
        +  diffs = Diff::LCS.diff(data_old, data_new)
        +  return output if diffs.empty?
        +  oldhunk = hunk = nil
        +  file_length_difference = 0
        +  diffs.each do |piece|
        +    begin
        +      hunk = Diff::LCS::Hunk.new(
        +        data_old, data_new, piece, context_lines, file_length_difference
        +      )
        +      file_length_difference = hunk.file_length_difference
        +      next unless oldhunk
        +      # Hunks may overlap, which is why we need to be careful when our
        +      # diff includes lines of context. Otherwise, we might print
        +      # redundant lines.
        +      if (context_lines > 0) and hunk.overlaps?(oldhunk)
        +        if hunk.respond_to?(:merge)
        +          # diff-lcs 1.2.x
        +          hunk.merge(oldhunk)
        +        else
        +          # diff-lcs 1.1.3
        +          hunk.unshift(oldhunk)
        +        end
        +      else
        +        output << matching_encoding(oldhunk.diff(format).to_s, encoding)
        +      end
        +    ensure
        +      oldhunk = hunk
        +      output << matching_encoding("\n", encoding)
        +    end
        +  end
        +  #Handle the last remaining hunk
        +  output << matching_encoding(oldhunk.diff(format).to_s, encoding)
        +  output << matching_encoding("\n", encoding)
        +  color_diff output
        +rescue Encoding::CompatibilityError
        +  if input_data_new.encoding != input_data_old.encoding
        +    "Could not produce a diff because the encoding of the actual string (#{input_data_old.encoding}) "+
        +    "differs from the encoding of the expected string (#{input_data_new.encoding})"
        +  else
        +    "Could not produce a diff because of the encoding of the string (#{input_data_old.encoding})"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationHandler.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationHandler.html new file mode 100644 index 000000000..88d133232 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationHandler.html @@ -0,0 +1,205 @@ + + + + + + Class: RSpec::Expectations::ExpectationHandler + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::ExpectationHandler + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/handler.rb
        + +
        +
        + + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) check_message(msg) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/expectations/handler.rb', line 5
        +
        +def self.check_message(msg)
        +  unless msg.nil? || msg.respond_to?(:to_str) || msg.respond_to?(:call)
        +    ::Kernel.warn [
        +      "WARNING: ignoring the provided expectation message argument (",
        +      msg.inspect,
        +      ") since it is not a string or a proc."
        +    ].join
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationNotMetError.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationNotMetError.html new file mode 100644 index 000000000..41fb607a0 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationNotMetError.html @@ -0,0 +1,125 @@ + + + + + + Exception: RSpec::Expectations::ExpectationNotMetError + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Exception: RSpec::Expectations::ExpectationNotMetError + + + +

        + +
        + +
        Inherits:
        +
        + StandardError + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/errors.rb,
        + lib/rspec/expectations/errors.rb
        +
        + +
        +
        + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationTarget.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationTarget.html new file mode 100644 index 000000000..238f1bd5e --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/ExpectationTarget.html @@ -0,0 +1,860 @@ + + + + + + Class: RSpec::Expectations::ExpectationTarget + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::ExpectationTarget + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/expectation_target.rb
        + +
        +
        + +

        Overview

        +
        + +
        + Note: +

        ExpectationTarget is not intended to be instantiated +directly by users. Use expect instead.

        +
        +
        + +

        Wraps the target of an expectation.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(something)       # => ExpectationTarget wrapping something
        +expect { do_something } # => ExpectationTarget wrapping the block
        +
        +# used with `to`
        +expect(actual).to eq(3)
        +
        +# with `not_to`
        +expect(actual).not_to eq(3)
        + +
        + + +
        +

        Constant Summary

        + + + + + +

        Class Attribute Summary (collapse)

        +
          + +
        • + + + + (Object) deprecated_should_enabled + + + + (also: deprecated_should_enabled?) + + + + + + + + + + + + + + +

          Returns the value of attribute deprecated_should_enabled.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ExpectationTarget) initialize(value) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of ExpectationTarget

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 30
        +
        +def initialize(value)
        +  @target = value
        +end
        +
        +
        + +
        + +
        +

        Class Attribute Details

        + + + +
        +

        + + + (Object) deprecated_should_enabled + + + + Also known as: + deprecated_should_enabled? + + + + +

        +
        +

        Returns the value of attribute deprecated_should_enabled

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 19
        +
        +def deprecated_should_enabled
        +  @deprecated_should_enabled
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) disable_deprecated_should + + + + + +

        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 92
        +
        +def self.disable_deprecated_should
        +  return unless deprecated_should_enabled?
        +
        +  remove_method :should
        +  remove_method :should_not
        +
        +  self.deprecated_should_enabled = false
        +end
        +
        +
        + +
        +

        + + + (Object) enable_deprecated_should + + + + + +

        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 76
        +
        +def self.enable_deprecated_should
        +  return if deprecated_should_enabled?
        +
        +  def should(*args)
        +    RSpec.deprecate "`expect { }.should`", :replacement => "`expect { }.to`"
        +    @target.should(*args)
        +  end
        +
        +  def should_not(*args)
        +    RSpec.deprecate "`expect { }.should_not`", :replacement => "`expect { }.not_to`"
        +    @target.should_not(*args)
        +  end
        +
        +  self.deprecated_should_enabled = true
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) not_to(matcher = nil, message = nil, &block) + + + + Also known as: + to_not + + + + +

        +
        +

        Runs the given expectation, passing if matcher returns false.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(value).not_to eq(5)
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (String) + + + (defaults to: nil) + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          false if the negative expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +73
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 70
        +
        +def not_to(matcher=nil, message=nil, &block)
        +  prevent_operator_matchers(:not_to) unless matcher
        +  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(@target, matcher, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) should(*args) + + + + + +

        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 79
        +
        +def should(*args)
        +  RSpec.deprecate "`expect { }.should`", :replacement => "`expect { }.to`"
        +  @target.should(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) should_not(*args) + + + + + +

        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +87
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 84
        +
        +def should_not(*args)
        +  RSpec.deprecate "`expect { }.should_not`", :replacement => "`expect { }.not_to`"
        +  @target.should_not(*args)
        +end
        +
        +
        + +
        +

        + + - (Boolean) to(matcher = nil, message = nil, &block) + + + + + +

        +
        +

        Runs the given expectation, passing if matcher returns true.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(value).to eq(5)
        +expect { perform }.to raise_error
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (String) + + + (defaults to: nil) + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if the expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 57
        +
        +def to(matcher=nil, message=nil, &block)
        +  prevent_operator_matchers(:to) unless matcher
        +  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(@target, matcher, message, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/NegativeExpectationHandler.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/NegativeExpectationHandler.html new file mode 100644 index 000000000..cb9c2a186 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/NegativeExpectationHandler.html @@ -0,0 +1,242 @@ + + + + + + Class: RSpec::Expectations::NegativeExpectationHandler + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::NegativeExpectationHandler + + + +

        + +
        + +
        Inherits:
        +
        + ExpectationHandler + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/handler.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from ExpectationHandler

        +

        check_message

        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) handle_matcher(actual, matcher, message = nil, &block) + + + + + +

        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/expectations/handler.rb', line 46
        +
        +def self.handle_matcher(actual, matcher, message=nil, &block)
        +  check_message(message)
        +  ::RSpec::Matchers.last_should = :should_not
        +  ::RSpec::Matchers.last_matcher = matcher
        +  return ::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher.new(actual) if matcher.nil?
        +
        +  match = matcher.respond_to?(:does_not_match?) ?
        +          !matcher.does_not_match?(actual, &block) :
        +          matcher.matches?(actual, &block)
        +  return match unless match
        +
        +  message = message.call if message.respond_to?(:call)
        +
        +  message ||= matcher.respond_to?(:failure_message_for_should_not) ?
        +              matcher.failure_message_for_should_not :
        +              matcher.negative_failure_message
        +
        +  if matcher.respond_to?(:diffable?) && matcher.diffable?
        +    ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual
        +  else
        +    ::RSpec::Expectations.fail_with message
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/PositiveExpectationHandler.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/PositiveExpectationHandler.html new file mode 100644 index 000000000..e15f8ee40 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/PositiveExpectationHandler.html @@ -0,0 +1,246 @@ + + + + + + Class: RSpec::Expectations::PositiveExpectationHandler + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::PositiveExpectationHandler + + + +

        + +
        + +
        Inherits:
        +
        + ExpectationHandler + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/handler.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from ExpectationHandler

        +

        check_message

        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) handle_matcher(actual, matcher, message = nil, &block) + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/expectations/handler.rb', line 18
        +
        +def self.handle_matcher(actual, matcher, message=nil, &block)
        +  check_message(message)
        +  ::RSpec::Matchers.last_should = :should
        +  ::RSpec::Matchers.last_matcher = matcher
        +  return ::RSpec::Matchers::BuiltIn::PositiveOperatorMatcher.new(actual) if matcher.nil?
        +
        +  match = matcher.matches?(actual, &block)
        +  return match if match
        +
        +  message = message.call if message.respond_to?(:call)
        +
        +  message ||= matcher.respond_to?(:failure_message_for_should) ?
        +              matcher.failure_message_for_should :
        +              matcher.failure_message
        +
        +  if matcher.respond_to?(:diffable?) && matcher.diffable?
        +    if RSpec::Matchers::DSL::Matcher === matcher
        +      ::RSpec::Expectations.fail_with message, matcher.expected_as_array, matcher.actual
        +    else
        +      ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual
        +    end
        +  else
        +    ::RSpec::Expectations.fail_with message
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax.html new file mode 100644 index 000000000..2c5fd2a39 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax.html @@ -0,0 +1,1259 @@ + + + + + + Module: RSpec::Expectations::Syntax + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Syntax + + + Private +

        + +
        + + + +
        Extended by:
        +
        Syntax
        + + + + + + +
        Included in:
        +
        Syntax
        + + + +
        Defined in:
        +
        lib/rspec/expectations/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Provides methods for enabling and disabling the available +syntaxes provided by rspec-expectations.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: ExpectExpressionGenerator, ShouldExpressionGenerator + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) default_should_host + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Determines where we add should and should_not.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 42
        +
        +def default_should_host
        +  @default_should_host ||= ::Object.ancestors.last
        +end
        +
        +
        + +
        +

        + + - (Object) disable_expect(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Disables the expect syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 93
        +
        +def disable_expect(syntax_host = ::RSpec::Matchers)
        +  return unless expect_enabled?(syntax_host)
        +
        +  syntax_host.module_eval do
        +    undef expect
        +  end
        +
        +  ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should
        +end
        +
        +
        + +
        +

        + + - (Object) disable_should(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Disables the should syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 66
        +
        +def disable_should(syntax_host = default_should_host)
        +  return unless should_enabled?(syntax_host)
        +
        +  syntax_host.module_eval do
        +    undef should
        +    undef should_not
        +  end
        +
        +  ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should
        +end
        +
        +
        + +
        +

        + + - (Object) enable_expect(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Enables the expect syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 79
        +
        +def enable_expect(syntax_host = ::RSpec::Matchers)
        +  return if expect_enabled?(syntax_host)
        +
        +  syntax_host.module_exec do
        +    def expect(value=::RSpec::Expectations::ExpectationTarget::UndefinedValue, &block)
        +      ::RSpec::Expectations::ExpectationTarget.for(value, block)
        +    end
        +  end
        +
        +  ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if should_enabled?
        +end
        +
        +
        + +
        +

        + + - (Object) enable_should(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Enables the should syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 48
        +
        +def enable_should(syntax_host = default_should_host)
        +  return if should_enabled?(syntax_host)
        +
        +  syntax_host.module_eval do
        +    def should(matcher=nil, message=nil, &block)
        +      ::RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
        +    end
        +
        +    def should_not(matcher=nil, message=nil, &block)
        +      ::RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
        +    end
        +  end
        +
        +  ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if expect_enabled?
        +end
        +
        +
        + +
        +

        + + - (ExpectationTarget) expect + + + + + +

        +
        +

        Supports expect(actual).to matcher syntax by wrapping actual in an +ExpectationTarget.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(actual).to eq(expected)
        +expect(actual).not_to eq(expected)
        + +
        + +

        Returns:

        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 30
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) expect_enabled?(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates whether or not the expect syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +111
        +112
        +113
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 111
        +
        +def expect_enabled?(syntax_host = ::RSpec::Matchers)
        +  syntax_host.method_defined?(:expect)
        +end
        +
        +
        + +
        +

        + + - (Object) expression_generator + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Selects which expression generator to use based on the configured syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 129
        +
        +def expression_generator
        +  if expect_enabled?
        +    ExpectExpressionGenerator
        +  else
        +    ShouldExpressionGenerator
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) negative_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Generates a negative expectation expression.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 123
        +
        +def negative_expression(target_expression, matcher_expression)
        +  expression_generator.negative_expression(target_expression, matcher_expression)
        +end
        +
        +
        + +
        +

        + + - (Object) positive_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Generates a positive expectation expression.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +117
        +118
        +119
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 117
        +
        +def positive_expression(target_expression, matcher_expression)
        +  expression_generator.positive_expression(target_expression, matcher_expression)
        +end
        +
        +
        + +
        +

        + + - (Boolean) should + + + + + +

        +
        +

        Passes if matcher returns true. Available on every Object.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        actual.should eq expected
        +actual.should match /expression/
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + +
        • + +
        • + + message + + + (String) + + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if the expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 9
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) should_enabled?(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates whether or not the should syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +105
        +106
        +107
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 105
        +
        +def should_enabled?(syntax_host = default_should_host)
        +  syntax_host.method_defined?(:should)
        +end
        +
        +
        + +
        +

        + + - (Boolean) should_not + + + + + +

        +
        +

        Passes if matcher returns false. Available on every Object.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        actual.should_not eq expected
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + +
        • + +
        • + + message + + + (String) + + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          false if the negative expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 20
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax/ExpectExpressionGenerator.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax/ExpectExpressionGenerator.html new file mode 100644 index 000000000..0e0d0caf4 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax/ExpectExpressionGenerator.html @@ -0,0 +1,266 @@ + + + + + + Module: RSpec::Expectations::Syntax::ExpectExpressionGenerator + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Syntax::ExpectExpressionGenerator + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Generates expectation expressions for the expect syntax.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) negative_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +156
        +157
        +158
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 156
        +
        +def self.negative_expression(target_expression, matcher_expression)
        +  "expect(#{target_expression}).not_to #{matcher_expression}"
        +end
        +
        +
        + +
        +

        + + + (Object) positive_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +152
        +153
        +154
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 152
        +
        +def self.positive_expression(target_expression, matcher_expression)
        +  "expect(#{target_expression}).to #{matcher_expression}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax/ShouldExpressionGenerator.html b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax/ShouldExpressionGenerator.html new file mode 100644 index 000000000..83e4639b7 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Expectations/Syntax/ShouldExpressionGenerator.html @@ -0,0 +1,266 @@ + + + + + + Module: RSpec::Expectations::Syntax::ShouldExpressionGenerator + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Syntax::ShouldExpressionGenerator + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Generates expectation expressions for the should syntax.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) negative_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +144
        +145
        +146
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 144
        +
        +def self.negative_expression(target_expression, matcher_expression)
        +  "#{target_expression}.should_not #{matcher_expression}"
        +end
        +
        +
        + +
        +

        + + + (Object) positive_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +140
        +141
        +142
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 140
        +
        +def self.positive_expression(target_expression, matcher_expression)
        +  "#{target_expression}.should #{matcher_expression}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers.html new file mode 100644 index 000000000..c0485acf3 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers.html @@ -0,0 +1,3519 @@ + + + + + + Module: RSpec::Matchers + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers.rb,
        + lib/rspec/matchers/dsl.rb,
        lib/rspec/matchers/pretty.rb,
        lib/rspec/matchers/matcher.rb,
        lib/rspec/matchers/built_in.rb,
        lib/rspec/matchers/be_close.rb,
        lib/rspec/matchers/built_in/be.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/have.rb,
        lib/rspec/matchers/match_aliases.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/method_missing.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/operator_matcher.rb,
        lib/rspec/expectations/configuration.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/match_array.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/matchers/generated_descriptions.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb,
        lib/rspec/matchers/differentiate_block_method_types.rb,
        lib/rspec/matchers/extensions/instance_eval_with_args.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        RSpec::Matchers provides a number of useful matchers we use to define +expectations. A matcher is any object that responds to the following:

        + +
        matches?(actual)
        +failure_message_for_should
        +
        + +

        These methods are also part of the matcher protocol, but are optional:

        + +
        does_not_match?(actual)
        +failure_message_for_should_not
        +description
        +supports_block_expectations?
        +
        + +

        Predicates

        + +

        In addition to matchers that are defined explicitly, RSpec will create +custom matchers on the fly for any arbitrary predicate, giving your specs a +much more natural language feel.

        + +

        A Ruby predicate is a method that ends with a "?" and returns true or false. +Common examples are empty?, nil?, and instance_of?.

        + +

        All you need to do is write expect(..).to be_ followed by the predicate +without the question mark, and RSpec will figure it out from there. +For example:

        + +
        expect([]).to be_empty     # => [].empty?() | passes
        +expect([]).not_to be_empty # => [].empty?() | fails
        +
        + +

        In addtion to prefixing the predicate matchers with "be", you can also use "be_a" +and "bean", making your specs read much more naturally:

        + +
        expect("a string").to be_an_instance_of(String) # =>"a string".instance_of?(String) # passes
        +
        +expect(3).to be_a_kind_of(Fixnum)        # => 3.kind_of?(Numeric)     | passes
        +expect(3).to be_a_kind_of(Numeric)       # => 3.kind_of?(Numeric)     | passes
        +expect(3).to be_an_instance_of(Fixnum)   # => 3.instance_of?(Fixnum)  | passes
        +expect(3).not_to be_an_instance_of(Numeric) # => 3.instance_of?(Numeric) | fails
        +
        + +

        RSpec will also create custom matchers for predicates like has_key?. To +use this feature, just state that the object should have_key(:key) and RSpec will +call has_key?(:key) on the target. For example:

        + +
        expect(:a => "A").to have_key(:a)
        +expect(:a => "A").to have_key(:b) # fails
        +
        + +

        You can use this feature to invoke any predicate that begins with "has_", whether it is +part of the Ruby libraries (like Hash#has_key?) or a method you wrote on your own class.

        + +

        Custom Matchers

        + +

        When you find that none of the stock matchers provide a natural feeling +expectation, you can very easily write your own using RSpec's matcher DSL +or writing one from scratch.

        + +

        Matcher DSL

        + +

        Imagine that you are writing a game in which players can be in various +zones on a virtual board. To specify that bob should be in zone 4, you +could say:

        + +
        expect(bob.current_zone).to eql(Zone.new("4"))
        +
        + +

        But you might find it more expressive to say:

        + +
        expect(bob).to be_in_zone("4")
        +
        + +

        and/or

        + +
        expect(bob).not_to be_in_zone("3")
        +
        + +

        You can create such a matcher like so:

        + +
        RSpec::Matchers.define :be_in_zone do |zone|
        +  match do |player|
        +    player.in_zone?(zone)
        +  end
        +end
        +
        + +

        This will generate a be_in_zone method that returns a matcher +with logical default messages for failures. You can override the failure +messages and the generated description as follows:

        + +
        RSpec::Matchers.define :be_in_zone do |zone|
        +  match do |player|
        +    player.in_zone?(zone)
        +  end
        +
        +  failure_message_for_should do |player|
        +    # generate and return the appropriate string.
        +  end
        +
        +  failure_message_for_should_not do |player|
        +    # generate and return the appropriate string.
        +  end
        +
        +  description do
        +    # generate and return the appropriate string.
        +  end
        +end
        +
        + +

        Each of the message-generation methods has access to the block arguments +passed to the create method (in this case, zone). The +failure message methods (failure_message_for_should and +failure_message_for_should_not) are passed the actual value (the +receiver of expect(..) or expect(..).not_to).

        + +

        Custom Matcher from scratch

        + +

        You could also write a custom matcher from scratch, as follows:

        + +
        class BeInZone
        +  def initialize(expected)
        +    @expected = expected
        +  end
        +
        +  def matches?(target)
        +    @target = target
        +    @target.current_zone.eql?(Zone.new(@expected))
        +  end
        +
        +  def failure_message_for_should
        +    "expected #{@target.inspect} to be in Zone #{@expected}"
        +  end
        +
        +  def failure_message_for_should_not
        +    "expected #{@target.inspect} not to be in Zone #{@expected}"
        +  end
        +end
        +
        + +

        ... and a method like this:

        + +
        def be_in_zone(expected)
        +  BeInZone.new(expected)
        +end
        +
        + +

        And then expose the method to your specs. This is normally done +by including the method and the class in a module, which is then +included in your spec:

        + +
        module CustomGameMatchers
        +  class BeInZone
        +    # ...
        +  end
        +
        +  def be_in_zone(expected)
        +    # ...
        +  end
        +end
        +
        +describe "Player behaviour" do
        +  include CustomGameMatchers
        +  # ...
        +end
        +
        + +

        or you can include in globally in a spec_helper.rb file required +from your spec file(s):

        + +
        RSpec::configure do |config|
        +  config.include(CustomGameMatchers)
        +end
        +
        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: BuiltIn, DSL, Extensions, MatchAliases, Pretty + + + + Classes: DifferentiateBlockMethodTypes + + +

        + + + + +

        Class Attribute Summary (collapse)

        +
          + +
        • + + + + (Object) last_matcher + + + + + + + + + + + + + + + + +

          Returns the value of attribute last_matcher.

          +
          + +
        • + + +
        • + + + + (Object) last_should + + + + + + + + + + + + + + + + +

          Returns the value of attribute last_should.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(method, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/method_missing.rb', line 6
        +
        +def method_missing(method, *args, &block)
        +  return Matchers::BuiltIn::BePredicate.new(method, *args, &block) if method.to_s =~ /^be_/
        +  return Matchers::BuiltIn::Has.new(method, *args, &block) if method.to_s =~ /^have_/
        +  super
        +end
        +
        +
        + +
        + +
        +

        Class Attribute Details

        + + + +
        +

        + + + (Object) last_matcher + + + + + +

        +
        +

        Returns the value of attribute last_matcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 4
        +
        +def last_matcher
        +  @last_matcher
        +end
        +
        +
        + + + +
        +

        + + + (Object) last_should + + + + + +

        +
        +

        Returns the value of attribute last_should

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 4
        +
        +def last_should
        +  @last_should
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) clear_generated_description + + + + + +

        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 7
        +
        +def self.clear_generated_description
        +  self.last_matcher = nil
        +  self.last_should = nil
        +end
        +
        +
        + +
        +

        + + + (RSpec::Expectations::Configuration) configuration + + + + + +

        +
        +

        The configuration object

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +102
        +103
        +104
        +
        +
        # File 'lib/rspec/expectations/configuration.rb', line 102
        +
        +def self.configuration
        +  @configuration ||= Expectations::Configuration.new
        +end
        +
        +
        + +
        +

        + + + (Object) const_missing(name) + + + + + +

        + + + + +
        +
        +
        +
        +714
        +715
        +716
        +717
        +718
        +719
        +720
        +721
        +722
        +723
        +724
        +725
        +726
        +
        +
        # File 'lib/rspec/matchers.rb', line 714
        +
        +def self.const_missing(name)
        +  case name
        +    when :OperatorMatcher
        +      RSpec.deprecate("`RSpec::Matchers::OperatorMatcher`",
        +                      :replacement => "`RSpec::Matchers::BuiltIn::OperatorMatcher`")
        +      BuiltIn::OperatorMatcher
        +    when :Configuration
        +      RSpec.deprecate("`RSpec::Matchers::Configuration`",
        +                      :replacement => "`RSpec::Expectations::Configuration`")
        +      Expectations::Configuration
        +    else super
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) generated_description + + + + + +

        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 12
        +
        +def self.generated_description
        +  return nil if last_should.nil?
        +  "#{last_should.to_s.gsub('_',' ')} #{last_description}"
        +end
        +
        +
        + +
        +

        + + + (Boolean) is_a_matcher?(obj) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +180
        +181
        +182
        +183
        +184
        +185
        +186
        +
        +
        # File 'lib/rspec/matchers.rb', line 180
        +
        +def self.is_a_matcher?(obj)
        +  return true  if ::RSpec::Matchers::BuiltIn::BaseMatcher === obj
        +  return false if obj.respond_to?(:i_respond_to_everything_so_im_not_really_a_matcher)
        +  return false unless obj.respond_to?(:matches?)
        +
        +  obj.respond_to?(:failure_message_for_should) || obj.respond_to?(:failure_message)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) be(*args) + + + + + +

        +
        +

        Given true, false, or nil, will pass if actual value is true, false or +nil (respectively). Given no args means the caller should satisfy an if +condition (to be or not to be).

        + +

        Predicates are any Ruby method that ends in a "?" and returns true or +false. Given be_ followed by arbitrary_predicate (without the "?"), +RSpec will match convert that into a query against the target object.

        + +

        The arbitrarypredicate feature will handle any predicate prefixed with +"be_an" (e.g. bean_instance_of), "be_a" (e.g. bea_kind_of) or "be" +(e.g. be_empty), letting you choose the prefix that best suits the +predicate.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(actual).to     be_truthy
        +expect(actual).to     be_falsey
        +expect(actual).to     be_nil
        +expect(actual).to     be_[arbitrary_predicate](*args)
        +expect(actual).not_to be_nil
        +expect(actual).not_to be_[arbitrary_predicate](*args)
        + +
        + + +
        + + + + +
        +
        +
        +
        +241
        +242
        +243
        +244
        +
        +
        # File 'lib/rspec/matchers.rb', line 241
        +
        +def be(*args)
        +  args.empty? ?
        +    Matchers::BuiltIn::Be.new : equal(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) be_a(klass) + + + + Also known as: + be_an + + + + +

        +
        +

        passes if target.kind_of?(klass)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +247
        +248
        +249
        +
        +
        # File 'lib/rspec/matchers.rb', line 247
        +
        +def be_a(klass)
        +  be_a_kind_of(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) be_a_kind_of(expected) + + + + Also known as: + be_kind_of + + + + +

        +
        +

        Passes if actual.kind_of?(expected)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     be_a_kind_of(Fixnum)
        +expect(5).to     be_a_kind_of(Numeric)
        +expect(5).not_to be_a_kind_of(Float)
        + +
        + + +
        + + + + +
        +
        +
        +
        +273
        +274
        +275
        +
        +
        # File 'lib/rspec/matchers.rb', line 273
        +
        +def be_a_kind_of(expected)
        +  BuiltIn::BeAKindOf.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be_an_instance_of(expected) + + + + Also known as: + be_instance_of + + + + +

        +
        +

        Passes if actual.instance_of?(expected)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     be_an_instance_of(Fixnum)
        +expect(5).not_to be_an_instance_of(Numeric)
        +expect(5).not_to be_an_instance_of(Float)
        + +
        + + +
        + + + + +
        +
        +
        +
        +260
        +261
        +262
        +
        +
        # File 'lib/rspec/matchers.rb', line 260
        +
        +def be_an_instance_of(expected)
        +  BuiltIn::BeAnInstanceOf.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be_close(expected, delta) + + + + + +

        +
        +
        Deprecated.

        use +be_within+ instead.

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/be_close.rb', line 4
        +
        +def be_close(expected, delta)
        +  RSpec.deprecate("be_close(#{expected}, #{delta})",
        +    :replacement => "be_within(#{delta}).of(#{expected})",
        +    :type        => 'the be_close matcher'
        +  )
        +  be_within(delta).of(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be_false + + + + + +

        + + + + +
        +
        +
        +
        +196
        +197
        +198
        +199
        +200
        +201
        +202
        +
        +
        # File 'lib/rspec/matchers.rb', line 196
        +
        +def be_false
        +  RSpec.deprecate("`be_false`", :replacement =>
        +    "`be_falsey` (for Ruby's conditional semantics) or " +
        +    "`be false` (for exact `== false` equality)"
        +  )
        +  BuiltIn::BeFalsey.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_falsey + + + + Also known as: + be_falsy + + + + +

        +
        +

        Passes if actual is falsy (false or nil)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +210
        +211
        +212
        +
        +
        # File 'lib/rspec/matchers.rb', line 210
        +
        +def be_falsey
        +  BuiltIn::BeFalsey.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_nil + + + + + +

        +
        +

        Passes if actual is nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +217
        +218
        +219
        +
        +
        # File 'lib/rspec/matchers.rb', line 217
        +
        +def be_nil
        +  BuiltIn::BeNil.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_true + + + + + +

        + + + + +
        +
        +
        +
        +188
        +189
        +190
        +191
        +192
        +193
        +194
        +
        +
        # File 'lib/rspec/matchers.rb', line 188
        +
        +def be_true
        +  RSpec.deprecate("`be_true`", :replacement =>
        +    "`be_truthy` (for Ruby's conditional semantics) or " +
        +    "`be true` (for exact `== true` equality)"
        +  )
        +  BuiltIn::BeTruthy.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_truthy + + + + + +

        +
        +

        Passes if actual is truthy (anything but false or nil)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +205
        +206
        +207
        +
        +
        # File 'lib/rspec/matchers.rb', line 205
        +
        +def be_truthy
        +  BuiltIn::BeTruthy.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_within(delta) + + + + + +

        +
        +

        Passes if actual == expected +/- delta

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(result).to     be_within(0.5).of(3.0)
        +expect(result).not_to be_within(0.5).of(3.0)
        + +
        + + +
        + + + + +
        +
        +
        +
        +285
        +286
        +287
        +
        +
        # File 'lib/rspec/matchers.rb', line 285
        +
        +def be_within(delta)
        +  BuiltIn::BeWithin.new(delta)
        +end
        +
        +
        + +
        +

        + + - (Object) change(receiver = nil, message = nil, &block) + + + + + +

        +
        +

        Applied to a proc, specifies that its execution will cause some value to +change.

        + +

        You can either pass receiver and message, or a block, +but not both.

        + +

        When passing a block, it must use the { ... } format, not +do/end, as { ... } binds to the +change+ method, whereas do/end +would errantly bind to the +expect(..)+ or +expect(..).not_to+ method.

        + +

        == Notes

        + +

        Evaluates receiver.message or block before and after it +evaluates the block passed to expect.

        + +

        expect( ... ).not_to change only supports the form with no subsequent +calls to by, by_at_least, by_at_most, +to or from.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by(1)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by_at_least(1)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by_at_most(1)
        +
        +string = "string"
        +expect {
        +  string.reverse!
        +}.to change { string }.from("string").to("gnirts")
        +
        +string = "string"
        +expect {
        +  string
        +}.not_to change { string }
        +
        +expect {
        +  person.happy_birthday
        +}.to change(person, :birthday).from(32).to(33)
        +
        +expect {
        +  employee.develop_great_new_social_networking_app
        +}.to change(employee, :title).from("Mail Clerk").to("CEO")
        +
        +expect {
        +  doctor.leave_office
        +}.to change(doctor, :sign).from(/is in/).to(/is out/)
        +
        +user = User.new(:type => "admin")
        +expect {
        +  user.symbolize_type
        +}.to change(user, :type).from(String).to(Symbol)
        + +
        +

        Parameters:

        +
          + +
        • + + receiver + + + (Object) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (Symbol) + + + (defaults to: nil) + + + — +

          the message to send the receiver

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +355
        +356
        +357
        +
        +
        # File 'lib/rspec/matchers.rb', line 355
        +
        +def change(receiver=nil, message=nil, &block)
        +  BuiltIn::Change.new(receiver, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) cover(*values) + + + + + +

        + + + + +
        +
        +
        +
        +371
        +372
        +373
        +
        +
        # File 'lib/rspec/matchers.rb', line 371
        +
        +def cover(*values)
        +  BuiltIn::Cover.new(*values)
        +end
        +
        +
        + +
        +

        + + - (Object) end_with(*expected) + + + + + +

        +
        +

        Matches if the actual value ends with the expected value(s). In the case +of a string, matches against the last expected.length characters of the +actual string. In the case of an array, matches against the last +expected.length elements of the actual array.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect("this string").to   end_with "string"
        +expect([0, 1, 2, 3, 4]).to end_with 4
        +expect([0, 2, 3, 4, 4]).to end_with 3, 4
        + +
        + + +
        + + + + +
        +
        +
        +
        +385
        +386
        +387
        +
        +
        # File 'lib/rspec/matchers.rb', line 385
        +
        +def end_with(*expected)
        +  BuiltIn::EndWith.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) eq(expected) + + + + + +

        +
        +

        Passes if actual == expected.

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     eq(5)
        +expect(5).not_to eq(3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +398
        +399
        +400
        +
        +
        # File 'lib/rspec/matchers.rb', line 398
        +
        +def eq(expected)
        +  BuiltIn::Eq.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) eql(expected) + + + + + +

        +
        +

        Passes if +actual.eql?(expected)+

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     eql(5)
        +expect(5).not_to eql(3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +411
        +412
        +413
        +
        +
        # File 'lib/rspec/matchers.rb', line 411
        +
        +def eql(expected)
        +  BuiltIn::Eql.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) equal(expected) + + + + + +

        +
        +

        Passes if actual.equal?(expected) (object identity).

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to       equal(5)   # Fixnums are equal
        +expect("5").not_to equal("5") # Strings that look the same are not the same object
        + +
        + + +
        + + + + +
        +
        +
        +
        +424
        +425
        +426
        +
        +
        # File 'lib/rspec/matchers.rb', line 424
        +
        +def equal(expected)
        +  BuiltIn::Equal.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) exist(*args) + + + + + +

        +
        +

        Passes if actual.exist? or actual.exists?

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(File).to exist("path/to/file")
        + +
        + + +
        + + + + +
        +
        +
        +
        +432
        +433
        +434
        +
        +
        # File 'lib/rspec/matchers.rb', line 432
        +
        +def exist(*args)
        +  BuiltIn::Exist.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) have(n) + + + + Also known as: + have_exactly + + + + +

        +
        +

        Passes if receiver is a collection with the submitted number of items OR +if the receiver OWNS a collection with the submitted number of items.

        + +

        If the receiver OWNS the collection, you must use the name of the +collection. So if a Team instance has a collection named #players, +you must use that name to set the expectation.

        + +

        If the receiver IS the collection, you can use any name you like for +named_collection. We'd recommend using either "elements", "members", or +"items" as these are all standard ways of describing the things IN a +collection.

        + +

        This also works for Strings, letting you set expectations about their +lengths.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +# Passes if team.players.size == 11
        +expect(team).to have(11).players
        +
        +# Passes if [1,2,3].length == 3
        +expect([1,2,3]).to have(3).items #"items" is pure sugar
        +
        +# Passes if ['a', 'b', 'c'].count == 3
        +expect([1,2,3]).to have(3).items #"items" is pure sugar
        +
        +# Passes if "this string".length == 11
        +expect("this string").to have(11).characters #"characters" is pure sugar
        + +
        + + +
        + + + + +
        +
        +
        +
        +464
        +465
        +466
        +
        +
        # File 'lib/rspec/matchers.rb', line 464
        +
        +def have(n)
        +  BuiltIn::Have.new(n)
        +end
        +
        +
        + +
        +

        + + - (Object) have_at_least(n) + + + + + +

        +
        +

        Exactly like have() with >=.

        + +

        Warning:

        + +

        expect(..).not_to have_at_least is not supported

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect("this").to have_at_least(3).letters
        + +
        + + +
        + + + + +
        +
        +
        +
        +477
        +478
        +479
        +
        +
        # File 'lib/rspec/matchers.rb', line 477
        +
        +def have_at_least(n)
        +  BuiltIn::Have.new(n, :at_least)
        +end
        +
        +
        + +
        +

        + + - (Object) have_at_most(n) + + + + + +

        +
        +

        Exactly like have() with <=.

        + +

        Warning:

        + +

        expect(..).not_to have_at_most is not supported

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect("this").to have_at_most(4).letters
        + +
        + + +
        + + + + +
        +
        +
        +
        +489
        +490
        +491
        +
        +
        # File 'lib/rspec/matchers.rb', line 489
        +
        +def have_at_most(n)
        +  BuiltIn::Have.new(n, :at_most)
        +end
        +
        +
        + +
        +

        + + - (Object) include(*expected) + + + + + +

        +
        +

        Passes if actual includes expected. This works for +collections and Strings. You can also pass in multiple args +and it will only pass if all args are found in collection.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect([1,2,3]).to      include(3)
        +expect([1,2,3]).to      include(2,3)
        +expect([1,2,3]).to      include(2,3,4) # fails
        +expect([1,2,3]).not_to  include(4)
        +expect("spread").to     include("read")
        +expect("spread").not_to include("red")
        + +
        + + +
        + + + + +
        +
        +
        +
        +505
        +506
        +507
        +
        +
        # File 'lib/rspec/matchers.rb', line 505
        +
        +def include(*expected)
        +  BuiltIn::Include.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected) + + + + Also known as: + match_regex + + + + +

        +
        + +
        + Note: +

        Due to Ruby's method dispatch mechanism, using the #match matcher

        +
        +
        + +

        Given a Regexp or String, passes if actual.match(pattern)

        + +

        within a custom matcher defined via the matcher DSL +(RSpec::Matcher.define) will result Ruby calling the wrong #match +method and raising an ArgumentError. Instead, use the aliased +#match_regex method.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(email).to   match(/^([^\s]+)((?:[-a-z0-9]+\.)+[a-z]{2,})$/i)
        +expect(email).to   match("@example.com")
        +expect(zipcode).to match_regex(/\A\d{5}(-\d{4})?\z/)
        +expect(zipcode).to match_regex("90210")
        + +
        + + +
        + + + + +
        +
        +
        +
        +523
        +524
        +525
        +
        +
        # File 'lib/rspec/matchers.rb', line 523
        +
        +def match(expected)
        +  BuiltIn::Match.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) match_array(array) + + + + + +

        +
        + +
        + Note: +

        This is also available using the =~ operator with should, +but =~ is not supported with expect.

        +
        +
        + +
        + Note: +

        This matcher only supports positive expectations. +expect(..).not_to match_array(other_array) is not supported.

        +
        +
        + +

        Passes if actual contains all of the expected regardless of order. +This works for collections. Pass in multiple args and it will only +pass if all args are found in collection.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect([1,2,3]).to match_array([1,2,3])
        +expect([1,2,3]).to match_array([1,3,2])
        + +
        + + +
        + + + + +
        +
        +
        +
        +708
        +709
        +710
        +
        +
        # File 'lib/rspec/matchers.rb', line 708
        +
        +def match_array(array)
        +  BuiltIn::MatchArray.new(array)
        +end
        +
        +
        + +
        +

        + + - (Object) raise_error(error = Exception, message = nil, &block) + + + + Also known as: + raise_exception + + + + +

        +
        +

        With no args, matches if any error is raised. +With a named error, matches only if that specific error is raised. +With a named error and messsage specified as a String, matches only if both match. +With a named error and messsage specified as a Regexp, matches only if both match. +Pass an optional block to perform extra verifications on the exception matched

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { do_something_risky }.to raise_error
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError)
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError) { |error| expect(error.data).to eq 42 }
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError, "that was too risky")
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError, /oo ri/)
        +
        +expect { do_something_risky }.not_to raise_error
        + +
        + + +
        + + + + +
        +
        +
        +
        +544
        +545
        +546
        +
        +
        # File 'lib/rspec/matchers.rb', line 544
        +
        +def raise_error(error=Exception, message=nil, &block)
        +  BuiltIn::RaiseError.new(error, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) respond_to(*names) + + + + + +

        +
        +

        Matches if the target object responds to all of the names +provided. Names can be Strings or Symbols.

        + +

        expect("string").to respond_to(:length)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +557
        +558
        +559
        +
        +
        # File 'lib/rspec/matchers.rb', line 557
        +
        +def respond_to(*names)
        +  BuiltIn::RespondTo.new(*names)
        +end
        +
        +
        + +
        +

        + + - (Object) satisfy(&block) + + + + + +

        +
        +

        Passes if the submitted block returns true. Yields target to the +block.

        + +

        Generally speaking, this should be thought of as a last resort when +you can't find any other way to specify the behaviour you wish to +specify.

        + +

        If you do find yourself in such a situation, you could always write +a custom matcher, which would likely make your specs more expressive.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to satisfy { |n| n > 3 }
        + +
        + + +
        + + + + +
        +
        +
        +
        +574
        +575
        +576
        +
        +
        # File 'lib/rspec/matchers.rb', line 574
        +
        +def satisfy(&block)
        +  BuiltIn::Satisfy.new(&block)
        +end
        +
        +
        + +
        +

        + + - (Object) start_with(*expected) + + + + + +

        +
        +

        Matches if the actual value starts with the expected value(s). In the +case of a string, matches against the first expected.length characters +of the actual string. In the case of an array, matches against the first +expected.length elements of the actual array.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect("this string").to   start_with "this s"
        +expect([0, 1, 2, 3, 4]).to start_with 0
        +expect([0, 2, 3, 4, 4]).to start_with 0, 1
        + +
        + + +
        + + + + +
        +
        +
        +
        +588
        +589
        +590
        +
        +
        # File 'lib/rspec/matchers.rb', line 588
        +
        +def start_with(*expected)
        +  BuiltIn::StartWith.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) throw_symbol(expected_symbol = nil, expected_arg = nil) + + + + + +

        +
        +

        Given no argument, matches if a proc throws any Symbol.

        + +

        Given a Symbol, matches if the given proc throws the specified Symbol.

        + +

        Given a Symbol and an arg, matches if the given proc throws the +specified Symbol with the specified arg.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { do_something_risky }.to throw_symbol
        +expect { do_something_risky }.to throw_symbol(:that_was_risky)
        +expect { do_something_risky }.to throw_symbol(:that_was_risky, 'culprit')
        +
        +expect { do_something_risky }.not_to throw_symbol
        +expect { do_something_risky }.not_to throw_symbol(:that_was_risky)
        +expect { do_something_risky }.not_to throw_symbol(:that_was_risky, 'culprit')
        + +
        + + +
        + + + + +
        +
        +
        +
        +608
        +609
        +610
        +
        +
        # File 'lib/rspec/matchers.rb', line 608
        +
        +def throw_symbol(expected_symbol=nil, expected_arg=nil)
        +  BuiltIn::ThrowSymbol.new(expected_symbol, expected_arg)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_control + + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +
        + Note: +

        This matcher is not designed for use with methods that yield +multiple times.

        +
        +
        + +

        Passes if the method called in the expect block yields, regardless +of whether or not arguments are yielded.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| 5.tap(&b) }.to yield_control
        +expect { |b| "a".to_sym(&b) }.not_to yield_control
        + +
        + + +
        + + + + +
        +
        +
        +
        +624
        +625
        +626
        +
        +
        # File 'lib/rspec/matchers.rb', line 624
        +
        +def yield_control
        +  BuiltIn::YieldControl.new
        +end
        +
        +
        + +
        +

        + + - (Object) yield_successive_args(*args) + + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +

        Designed for use with methods that repeatedly yield (such as +iterators). Passes if the method called in the expect block yields +multiple times with arguments matching those given.

        + +

        Argument matching is done using === (the case match operator) +and ==. If the expected and actual arguments match with either +operator, the matcher will pass.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +expect { |b| [1, 2, 3].each(&b) }.not_to yield_successive_args(1, 2)
        + +
        + + +
        + + + + +
        +
        +
        +
        +690
        +691
        +692
        +
        +
        # File 'lib/rspec/matchers.rb', line 690
        +
        +def yield_successive_args(*args)
        +  BuiltIn::YieldSuccessiveArgs.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_with_args(*args) + + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +
        + Note: +

        This matcher is not designed for use with methods that yield +multiple times.

        +
        +
        + +

        Given no arguments, matches if the method called in the expect +block yields with arguments (regardless of what they are or how +many there are).

        + +

        Given arguments, matches if the method called in the expect block +yields with arguments that match the given arguments.

        + +

        Argument matching is done using === (the case match operator) +and ==. If the expected and actual arguments match with either +operator, the matcher will pass.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| 5.tap(&b) }.to yield_with_args # because #tap yields an arg
        +expect { |b| 5.tap(&b) }.to yield_with_args(5) # because 5 == 5
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum) # because Fixnum === 5
        +expect { |b| File.open("f.txt", &b) }.to yield_with_args(/txt/) # because /txt/ === "f.txt"
        +
        +expect { |b| User.transaction(&b) }.not_to yield_with_args # because it yields no args
        +expect { |b| 5.tap(&b) }.not_to yield_with_args(1, 2, 3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +670
        +671
        +672
        +
        +
        # File 'lib/rspec/matchers.rb', line 670
        +
        +def yield_with_args(*args)
        +  BuiltIn::YieldWithArgs.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_with_no_args + + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +
        + Note: +

        This matcher is not designed for use with methods that yield +multiple times.

        +
        +
        + +

        Passes if the method called in the expect block yields with +no arguments. Fails if it does not yield, or yields with arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| User.transaction(&b) }.to yield_with_no_args
        +expect { |b| 5.tap(&b) }.not_to yield_with_no_args # because it yields with `5`
        +expect { |b| "a".to_sym(&b) }.not_to yield_with_no_args # because it does not yield
        + +
        + + +
        + + + + +
        +
        +
        +
        +641
        +642
        +643
        +
        +
        # File 'lib/rspec/matchers.rb', line 641
        +
        +def yield_with_no_args
        +  BuiltIn::YieldWithNoArgs.new
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn.html new file mode 100644 index 000000000..e960f51c2 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn.html @@ -0,0 +1,119 @@ + + + + + + Module: RSpec::Matchers::BuiltIn + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::BuiltIn + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in.rb,
        + lib/rspec/matchers/built_in/be.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/have.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/operator_matcher.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/match_array.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: BeHelpers + + + + Classes: BaseMatcher, Be, BeAKindOf, BeAnInstanceOf, BeComparedTo, BeFalsey, BeNil, BePredicate, BeTruthy, BeWithin, Change, Cover, EndWith, Eq, Eql, Equal, Exist, Has, Have, Include, Match, MatchArray, NegativeOperatorMatcher, OperatorMatcher, PositiveOperatorMatcher, RaiseError, RespondTo, Satisfy, StartAndEndWith, StartWith, ThrowSymbol, YieldControl, YieldProbe, YieldSuccessiveArgs, YieldWithArgs, YieldWithNoArgs + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html new file mode 100644 index 000000000..7b340847a --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html @@ -0,0 +1,1028 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BaseMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BaseMatcher + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases, Pretty
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/base_matcher.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Used internally as a base class for matchers that ship with +rspec-expectations.

        + +

        Warning:

        + +

        This class is for internal use, and subject to change without notice. We +strongly recommend that you do not base your custom matchers on this +class. If/when this changes, we will announce it and remove this warning.

        + + +
        +
        +
        + + +
        + +

        Constant Summary

        + +
        + +
        UNDEFINED = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        +
        +
        Object.new.freeze
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (BaseMatcher) initialize(expected = UNDEFINED) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of BaseMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 22
        +
        +def initialize(expected = UNDEFINED)
        +  @expected = expected unless UNDEFINED.equal?(expected)
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) actual (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 20
        +
        +def actual
        +  @actual
        +end
        +
        +
        + + + +
        +

        + + - (Object) expected (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 20
        +
        +def expected
        +  @expected
        +end
        +
        +
        + + + +
        +

        + + - (Object) rescued_exception (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 20
        +
        +def rescued_exception
        +  @rescued_exception
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 51
        +
        +def description
        +  defined?(@expected) ? "#{name_to_sentence} #{@expected.inspect}" : name_to_sentence
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 55
        +
        +def diffable?
        +  false
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 41
        +
        +def failure_message_for_should
        +  assert_ivars :@actual
        +  "expected #{@actual.inspect} to #{name_to_sentence}#{to_sentence expected}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 46
        +
        +def failure_message_for_should_not
        +  assert_ivars :@actual
        +  "expected #{@actual.inspect} not to #{name_to_sentence}#{to_sentence expected}"
        +end
        +
        +
        + +
        +

        + + - (Object) match_unless_raises(*exceptions) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 31
        +
        +def match_unless_raises(*exceptions)
        +  exceptions.unshift Exception if exceptions.empty?
        +  begin
        +    yield
        +    true
        +  rescue *exceptions => @rescued_exception
        +    false
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 26
        +
        +def matches?(actual)
        +  @actual = actual
        +  match(expected, actual)
        +end
        +
        +
        + +
        +

        + + - (Boolean) supports_block_expectations? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Most matchers are value matchers (i.e. meant to work with expect(value)) +rather than block matchers (i.e. meant to work with expect { }), so +this defaults to false. Block matchers must override this to return true.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 63
        +
        +def supports_block_expectations?
        +  false
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html new file mode 100644 index 000000000..222f4b1e2 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html @@ -0,0 +1,425 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Be + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Be + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        BeHelpers
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        BeComparedTo

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (Be) initialize(*args, &block) + + + + + +

        +
        +

        Returns a new instance of Be

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +75
        +76
        +77
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 75
        +
        +def initialize(*args, &block)
        +  @args = args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 83
        +
        +def failure_message_for_should
        +  "expected #{@actual.inspect} to evaluate to true"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 87
        +
        +def failure_message_for_should_not
        +  "expected #{@actual.inspect} to evaluate to false"
        +end
        +
        +
        + +
        +

        + + - (Object) match(_, actual) + + + + + +

        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 79
        +
        +def match(_, actual)
        +  !!actual
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html new file mode 100644 index 000000000..83ea0a387 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html @@ -0,0 +1,244 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeAKindOf + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeAKindOf + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_kind_of.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/be_kind_of.rb', line 5
        +
        +def match(expected, actual)
        +  actual.kind_of? expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html new file mode 100644 index 000000000..b43e96892 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html @@ -0,0 +1,296 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeAnInstanceOf + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeAnInstanceOf + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_instance_of.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/be_instance_of.rb', line 9
        +
        +def description
        +  "be an instance of #{expected}"
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/be_instance_of.rb', line 5
        +
        +def match(expected, actual)
        +  actual.instance_of? expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html new file mode 100644 index 000000000..b9e47c44b --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html @@ -0,0 +1,574 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeComparedTo + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeComparedTo + + + +

        + +
        + +
        Inherits:
        +
        + Be + +
          +
        • Object
        • + + + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Be

        +

        #match

        + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (BeComparedTo) initialize(operand, operator) + + + + + +

        +
        +

        Returns a new instance of BeComparedTo

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 99
        +
        +def initialize(operand, operator)
        +  @expected, @operator = operand, operator
        +    @args = []
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 124
        +
        +def description
        +  "be #{@operator} #{expected_to_sentence}#{args_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +109
        +110
        +111
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 109
        +
        +def failure_message_for_should
        +  "expected: #{@operator} #{@expected.inspect}\n     got: #{@operator.to_s.gsub(/./, ' ')} #{@actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 113
        +
        +def failure_message_for_should_not
        +  message = <<-MESSAGE
        +`#{negative_expectation_expression}` not only FAILED,
        +it is a bit confusing.
        +  MESSAGE
        +
        +  raise message << ([:===,:==].include?(@operator) ?
        +                    "It might be more clearly expressed without the \"be\"?" :
        +                    "It might be more clearly expressed in the positive?")
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +107
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 104
        +
        +def matches?(actual)
        +  @actual = actual
        +  @actual.__send__ @operator, @expected
        +end
        +
        +
        + +
        +

        + + - (Object) negative_expectation_expression + + + + + +

        + + + + +
        +
        +
        +
        +128
        +129
        +130
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 128
        +
        +def negative_expectation_expression
        +  Expectations::Syntax.negative_expression("actual", "be #{@operator} #{@expected}")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalsey.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalsey.html new file mode 100644 index 000000000..cfcb9ac50 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalsey.html @@ -0,0 +1,348 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeFalsey + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeFalsey + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 25
        +
        +def failure_message_for_should
        +  "expected: falsey value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 29
        +
        +def failure_message_for_should_not
        +  "expected: truthy value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) match(_, actual) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 21
        +
        +def match(_, actual)
        +  !actual
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeHelpers.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeHelpers.html new file mode 100644 index 000000000..4eceedba3 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeHelpers.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Matchers::BuiltIn::BeHelpers + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::BuiltIn::BeHelpers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Be, BePredicate
        + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html new file mode 100644 index 000000000..909d65c35 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html @@ -0,0 +1,348 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeNil + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeNil + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 39
        +
        +def failure_message_for_should
        +  "expected: nil\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 43
        +
        +def failure_message_for_should_not
        +  "expected: not nil\n     got: nil"
        +end
        +
        +
        + +
        +

        + + - (Object) match(_, actual) + + + + + +

        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 35
        +
        +def match(_, actual)
        +  actual.nil?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html new file mode 100644 index 000000000..b801e6965 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html @@ -0,0 +1,549 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BePredicate + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BePredicate + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        BeHelpers
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (BePredicate) initialize(*args, &block) + + + + + +

        +
        +

        Returns a new instance of BePredicate

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +136
        +137
        +138
        +139
        +140
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 136
        +
        +def initialize(*args, &block)
        +  @expected = parse_expected(args.shift)
        +  @args = args
        +  @block = block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +178
        +179
        +180
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 178
        +
        +def description
        +  "#{prefix_to_sentence}#{expected_to_sentence}#{args_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +170
        +171
        +172
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 170
        +
        +def failure_message_for_should
        +  "expected #{predicate}#{args_to_s} to return true, got #{@result.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +174
        +175
        +176
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 174
        +
        +def failure_message_for_should_not
        +  "expected #{predicate}#{args_to_s} to return false, got #{@result.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + Also known as: + === + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +161
        +162
        +163
        +164
        +165
        +166
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 142
        +
        +def matches?(actual)
        +  @actual = actual
        +
        +  if is_private_on?( @actual )
        +    RSpec.deprecate "matching with be_#{predicate.to_s.gsub(/\?$/,'')} on private method #{predicate}",
        +      :replacement => "`expect(object.send(#{predicate.inspect})).to be_true` or change the method's visibility to public",
        +      :call_site => caller(0)[3]
        +  end
        +
        +  begin
        +    @result = actual.__send__(predicate, *@args, &@block)
        +    check_respond_to(predicate)
        +    return @result
        +  rescue NameError => predicate_missing_error
        +    "this needs to be here or rcov will not count this branch even though it's executed in a code example"
        +  end
        +
        +  begin
        +    @result = actual.__send__(present_tense_predicate, *@args, &@block)
        +    check_respond_to(present_tense_predicate)
        +    return @result
        +  rescue NameError
        +    raise predicate_missing_error
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeTruthy.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeTruthy.html new file mode 100644 index 000000000..fb8988865 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeTruthy.html @@ -0,0 +1,348 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeTruthy + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeTruthy + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 11
        +
        +def failure_message_for_should
        +  "expected: truthy value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 15
        +
        +def failure_message_for_should_not
        +  "expected: falsey value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) match(_, actual) + + + + + +

        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 7
        +
        +def match(_, actual)
        +  !!actual
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html new file mode 100644 index 000000000..f2b75b163 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html @@ -0,0 +1,573 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeWithin + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeWithin + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_within.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (BeWithin) initialize(delta) + + + + + +

        +
        +

        Returns a new instance of BeWithin

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 7
        +
        +def initialize(delta)
        +  @delta = delta
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 40
        +
        +def description
        +  "be within #{@delta}#{@unit} of #{@expected}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 32
        +
        +def failure_message_for_should
        +  "expected #{@actual} to #{description}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 36
        +
        +def failure_message_for_should_not
        +  "expected #{@actual} not to #{description}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 11
        +
        +def matches?(actual)
        +  @actual = actual
        +  raise needs_expected     unless defined? @expected
        +  raise needs_subtractable unless @actual.respond_to? :-
        +  (@actual - @expected).abs <= @tolerance
        +end
        +
        +
        + +
        +

        + + - (Object) of(expected) + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 18
        +
        +def of(expected)
        +  @expected  = expected
        +  @tolerance = @delta
        +  @unit      = ''
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) percent_of(expected) + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 25
        +
        +def percent_of(expected)
        +  @expected  = expected
        +  @tolerance = @delta * @expected.abs / 100.0
        +  @unit      = '%'
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html new file mode 100644 index 000000000..7ff410941 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html @@ -0,0 +1,1165 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Change + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Change + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/change.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (Change) initialize(receiver = nil, message = nil, &block) + + + + + +

        +
        +

        Returns a new instance of Change

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 7
        +
        +def initialize(receiver=nil, message=nil, &block)
        +  @message = message
        +  @value_proc = block || lambda {receiver.__send__(message)}
        +  @expected_after = @expected_before = @minimum = @maximum = @expected_delta = nil
        +  @eval_before = @eval_after = false
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) actual_delta + + + + + +

        + + + + +
        +
        +
        +
        +88
        +89
        +90
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 88
        +
        +def actual_delta
        +  @actual_after - @actual_before
        +end
        +
        +
        + +
        +

        + + - (Object) by(expected_delta) + + + + + +

        + + + + +
        +
        +
        +
        +96
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 96
        +
        +def by(expected_delta)
        +  @expected_delta = expected_delta
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) by_at_least(minimum) + + + + + +

        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +104
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 101
        +
        +def by_at_least(minimum)
        +  @minimum = minimum
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) by_at_most(maximum) + + + + + +

        + + + + +
        +
        +
        +
        +106
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 106
        +
        +def by_at_most(maximum)
        +  @maximum = maximum
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 123
        +
        +def description
        +  "change ##{message}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(event_proc, &block) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 24
        +
        +def does_not_match?(event_proc, &block)
        +  expression = if @expected_delta
        +    "by()"
        +  elsif @minimum
        +    "by_at_least()"
        +  elsif @maximum
        +    "by_at_most()"
        +  elsif @eval_after
        +    "to()"
        +  end
        +
        +  if expression
        +    RSpec.deprecate("`expect { }.not_to change { }.#{expression}`")
        +  end
        +
        +  matched_positively = matches?(event_proc, &block)
        +
        +  unless matches_before?
        +    RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, ''))
        +      |The semantics of `expect { }.not_to change { }.from()` are changing
        +      |in RSpec 3. In RSpec 2.x, this would pass if the value changed but
        +      |the starting value was not what you specified with `from()`. In
        +      |RSpec 3, this will only pass if the starting value matches your
        +      |`from()` value _and_ it has not changed.
        +      |
        +      |You have an expectation that relies upon the old RSpec 2.x semantics
        +      |at: #{CallerFilter.first_non_rspec_line}"
        +    EOS
        +  end
        +
        +  !matched_positively
        +end
        +
        +
        + +
        +

        + + - (Object) evaluate_value_proc + + + + + +

        + + + + +
        +
        +
        +
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 63
        +
        +def evaluate_value_proc
        +  case val = @value_proc.call
        +  when Enumerable, String
        +    val.dup
        +  else
        +    val
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 72
        +
        +def failure_message_for_should
        +  if @eval_before && !expected_matches_actual?(@expected_before, @actual_before)
        +    "#{message} should have initially been #{@expected_before.inspect}, but was #{@actual_before.inspect}"
        +  elsif @eval_after && !expected_matches_actual?(@expected_after, @actual_after)
        +    "#{message} should have been changed to #{failure_message_for_expected_after}, but is now #{@actual_after.inspect}"
        +  elsif @expected_delta
        +    "#{message} should have been changed by #{@expected_delta.inspect}, but was changed by #{actual_delta.inspect}"
        +  elsif @minimum
        +    "#{message} should have been changed by at least #{@minimum.inspect}, but was changed by #{actual_delta.inspect}"
        +  elsif @maximum
        +    "#{message} should have been changed by at most #{@maximum.inspect}, but was changed by #{actual_delta.inspect}"
        +  else
        +    "#{message} should have changed, but is still #{@actual_before.inspect}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 92
        +
        +def failure_message_for_should_not
        +  "#{message} should not have changed, but did change from #{@actual_before.inspect} to #{@actual_after.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) from(before) + + + + + +

        + + + + +
        +
        +
        +
        +117
        +118
        +119
        +120
        +121
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 117
        +
        +def from (before)
        +  @eval_before = true
        +  @expected_before = before
        +  self
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(event_proc) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 14
        +
        +def matches?(event_proc)
        +  raise_block_syntax_error if block_given?
        +
        +  @actual_before = evaluate_value_proc
        +  event_proc.call
        +  @actual_after = evaluate_value_proc
        +
        +  (!change_expected? || changed?) && matches_before? && matches_after? && matches_expected_delta? && matches_min? && matches_max?
        +end
        +
        +
        + +
        +

        + + - (Object) raise_block_syntax_error + + + + + +

        +
        + + +
        +
        +
        + +

        Raises:

        +
          + +
        • + + + (SyntaxError) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 57
        +
        +def raise_block_syntax_error
        +  raise SyntaxError.new(<<-MESSAGE)
        +block passed to should or should_not change must use {} instead of do/end
        +MESSAGE
        +end
        +
        +
        + +
        +

        + + - (Boolean) supports_block_expectations? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +127
        +128
        +129
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 127
        +
        +def supports_block_expectations?
        +  true
        +end
        +
        +
        + +
        +

        + + - (Object) to(to) + + + + + +

        + + + + +
        +
        +
        +
        +111
        +112
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 111
        +
        +def to(to)
        +  @eval_after = true
        +  @expected_after = to
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html new file mode 100644 index 000000000..6d7727046 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html @@ -0,0 +1,407 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Cover + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Cover + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/cover.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (Cover) initialize(*expected) + + + + + +

        +
        +

        Returns a new instance of Cover

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 5
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) does_not_match?(range) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 14
        +
        +def does_not_match?(range)
        +  @actual = range
        +  expected.none? { |e| range.cover?(e) }
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(range) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 9
        +
        +def matches?(range)
        +  @actual = range
        +  @expected.all? { |e| range.cover?(e) }
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html new file mode 100644 index 000000000..85d6c3c8c --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html @@ -0,0 +1,353 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::EndWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::EndWith + + + +

        + +
        + +
        Inherits:
        +
        + StartAndEndWith + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from StartAndEndWith

        +

        #failure_message_for_should, #failure_message_for_should_not, #initialize, #matches?

        + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::StartAndEndWith

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) element_matches?(expected, actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 42
        +
        +def element_matches?(expected, actual)
        +  actual[-1] == expected
        +end
        +
        +
        + +
        +

        + + - (Boolean) subset_matches?(expected, actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 38
        +
        +def subset_matches?(expected, actual)
        +  actual[-expected.length, expected.length] == expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html new file mode 100644 index 000000000..1ff86ca51 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html @@ -0,0 +1,418 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Eq + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Eq + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/eq.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 17
        +
        +def diffable?; true; end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 9
        +
        +def failure_message_for_should
        +  "\nexpected: #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using ==)\n"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 13
        +
        +def failure_message_for_should_not
        +  "\nexpected: value != #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using ==)\n"
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 5
        +
        +def match(expected, actual)
        +  actual == expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html new file mode 100644 index 000000000..b93778b31 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html @@ -0,0 +1,422 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Eql + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Eql + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/eql.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 17
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 9
        +
        +def failure_message_for_should
        +  "\nexpected: #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 13
        +
        +def failure_message_for_should_not
        +  "\nexpected: value != #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 5
        +
        +def match(expected, actual)
        +  actual.eql? expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html new file mode 100644 index 000000000..2f4e10324 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html @@ -0,0 +1,452 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Equal + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Equal + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/equal.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 34
        +
        +def diffable?; true; end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 9
        +
        +def failure_message_for_should
        +  return <<-MESSAGE
        +
        +expected #{inspect_object(expected)}
        +     got #{inspect_object(actual)}
        +
        +Compared using equal?, which compares object identity,
        +but expected and actual are not the same object. Use
        +`#{eq_expression}` if you don't care about
        +object identity in this example.
        +
        +MESSAGE
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 23
        +
        +def failure_message_for_should_not
        +  return <<-MESSAGE
        +
        +expected not #{inspect_object(actual)}
        + got #{inspect_object(expected)}
        +
        +Compared using equal?, which compares object identity.
        +
        +MESSAGE
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 5
        +
        +def match(expected, actual)
        +  actual.equal? expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html new file mode 100644 index 000000000..7ad68d6a3 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html @@ -0,0 +1,351 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Exist + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Exist + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/exist.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (Exist) initialize(*expected) + + + + + +

        +
        +

        Returns a new instance of Exist

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 5
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 9
        +
        +def matches?(actual)
        +  @actual = actual
        +  predicates = [:exist?, :exists?].select { |p| @actual.respond_to?(p) }
        +  existence_values = predicates.map { |p| @actual.__send__(p, *@expected) }
        +  uniq_truthy_values = existence_values.map { |v| !!v }.uniq
        +
        +  case uniq_truthy_values.size
        +  when 0; raise NoMethodError.new("#{@actual.inspect} does not respond to either #exist? or #exists?")
        +  when 1; existence_values.first
        +  else raise "#exist? and #exists? returned different values:\n\n" +
        +    " exist?: #{existence_values.first}\n" +
        +    "exists?: #{existence_values.last}"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html new file mode 100644 index 000000000..81770ef41 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html @@ -0,0 +1,469 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Has + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Has + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/has.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (Has) initialize(expected, *args) + + + + + +

        +
        +

        Returns a new instance of Has

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 7
        +
        +def initialize(expected, *args)
        +  @expected, @args = expected, args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 32
        +
        +def description
        +  [method_description(@expected), args_description].compact.join(' ')
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 24
        +
        +def failure_message_for_should
        +  "expected ##{predicate}#{failure_message_args_description} to return true, got false"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 28
        +
        +def failure_message_for_should_not
        +  "expected ##{predicate}#{failure_message_args_description} to return false, got true"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 11
        +
        +def matches?(actual)
        +  method = predicate
        +
        +  if is_private_on?(actual)
        +    RSpec.deprecate "matching with #{@expected} on private method #{predicate}",
        +      :replacement => "`expect(object.send(#{predicate.inspect})).to be_true` or change the method's visibility to public"
        +  end
        +
        +  result = actual.__send__(method, *@args)
        +  check_respond_to(actual, method)
        +  result
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Have.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Have.html new file mode 100644 index 000000000..4f23e4161 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Have.html @@ -0,0 +1,1007 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Have + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Have + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/have.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        QUERY_METHODS = + +
        +
        [:size, :length, :count].freeze
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (Have) initialize(expected, relativity = :exactly) + + + + + +

        +
        +

        Returns a new instance of Have

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 9
        +
        +def initialize(expected, relativity=:exactly)
        +  @expected = case expected
        +              when :no then 0
        +              when String then expected.to_i
        +              else expected
        +              end
        +  @relativity = relativity
        +
        +  @actual = @collection_name = @plural_collection_name = nil
        +  @target_owns_a_collection = false
        +  @negative_expectation = false
        +  @expectation_format_method = "to"
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(method, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 124
        +
        +def method_missing(method, *args, &block)
        +  @collection_name = method
        +  if inflector = (defined?(ActiveSupport::Inflector) && ActiveSupport::Inflector.respond_to?(:pluralize) ? ActiveSupport::Inflector : (defined?(Inflector) ? Inflector : nil))
        +    @plural_collection_name = inflector.pluralize(method.to_s)
        +  end
        +  @args = args
        +  @block = block
        +  self
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 114
        +
        +def description
        +  "have #{relative_expectation} #{@collection_name}"
        +end
        +
        +
        + +
        +

        + + - (Object) determine_collection(collection_or_owner) + + + + + +

        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 66
        +
        +def determine_collection(collection_or_owner)
        +  if collection_or_owner.respond_to?(@collection_name)
        +    @target_owns_a_collection = true
        +    collection_or_owner.__send__(@collection_name, *@args, &@block)
        +  elsif (@plural_collection_name && collection_or_owner.respond_to?(@plural_collection_name))
        +    @target_owns_a_collection = true
        +    collection_or_owner.__send__(@plural_collection_name, *@args, &@block)
        +  elsif determine_query_method(collection_or_owner)
        +    collection_or_owner
        +  else
        +    collection_or_owner.__send__(@collection_name, *@args, &@block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) determine_query_method(collection) + + + + + +

        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 80
        +
        +def determine_query_method(collection)
        +  QUERY_METHODS.detect {|m| collection.respond_to?(m)}
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(collection_or_owner) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 60
        +
        +def does_not_match?(collection_or_owner)
        +  @negative_expectation = true
        +  @expectation_format_method = "to_not"
        +  !matches?(collection_or_owner)
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +88
        +89
        +90
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 88
        +
        +def failure_message_for_should
        +  "expected #{relative_expectation} #{@collection_name}, got #{@actual}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 92
        +
        +def failure_message_for_should_not
        +  if @relativity == :exactly
        +    return "expected target not to have #{@expected} #{@collection_name}, got #{@actual}"
        +  elsif @relativity == :at_most
        +    return <<-EOF
        +Isn't life confusing enough?
        +Instead of having to figure out the meaning of this:
        +  #{Expectations::Syntax.negative_expression("actual", "have_at_most(#{@expected}).#{@collection_name}")}
        +We recommend that you use this instead:
        +  #{Expectations::Syntax.positive_expression("actual", "have_at_least(#{@expected + 1}).#{@collection_name}")}
        +EOF
        +  elsif @relativity == :at_least
        +    return <<-EOF
        +Isn't life confusing enough?
        +Instead of having to figure out the meaning of this:
        +  #{Expectations::Syntax.negative_expression("actual", "have_at_least(#{@expected}).#{@collection_name}")}
        +We recommend that you use this instead:
        +  #{Expectations::Syntax.positive_expression("actual", "have_at_most(#{@expected - 1}).#{@collection_name}")}
        +EOF
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(collection_or_owner) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 31
        +
        +def matches?(collection_or_owner)
        +  collection = determine_collection(collection_or_owner)
        +  case collection
        +  when enumerator_class
        +    for query_method in QUERY_METHODS
        +      next unless collection.respond_to?(query_method)
        +      @actual = collection.__send__(query_method)
        +
        +      if @actual
        +        print_deprecation_message(query_method)
        +        break
        +      end
        +    end
        +
        +    raise not_a_collection if @actual.nil?
        +  else
        +    query_method = determine_query_method(collection)
        +    raise not_a_collection unless query_method
        +    @actual = collection.__send__(query_method)
        +
        +    print_deprecation_message(query_method)
        +  end
        +  case @relativity
        +  when :at_least then @actual >= @expected
        +  when :at_most  then @actual <= @expected
        +  else                @actual == @expected
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) not_a_collection + + + + + +

        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 84
        +
        +def not_a_collection
        +  "expected #{@collection_name} to be a collection but it does not respond to #length, #size or #count"
        +end
        +
        +
        + +
        +

        + + - (Object) relativities + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 23
        +
        +def relativities
        +  @relativities ||= {
        +    :exactly => "",
        +    :at_least => "at least ",
        +    :at_most => "at most "
        +  }
        +end
        +
        +
        + +
        +

        + + - (Boolean) respond_to?(m) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 118
        +
        +def respond_to?(m)
        +  @expected.respond_to?(m) || super
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html new file mode 100644 index 000000000..c5bb3b876 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html @@ -0,0 +1,537 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Include + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Include + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/include.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (Include) initialize(*expected) + + + + + +

        +
        +

        Returns a new instance of Include

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 5
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 19
        +
        +def description
        +  "include#{to_sentence expected}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 23
        +
        +def diffable?
        +  # Matchers do not diff well, since diff uses their inspect
        +  # output, which includes their instance variables and such.
        +  @expected.none? { |e| RSpec::Matchers.is_a_matcher?(e) }
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 14
        +
        +def does_not_match?(actual)
        +  @actual = actual
        +  perform_match(:none?, :any?, @actual, @expected)
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 9
        +
        +def matches?(actual)
        +  @actual = actual
        +  perform_match(:all?, :all?, @actual, @expected)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html new file mode 100644 index 000000000..cf130cbb3 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html @@ -0,0 +1,318 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Match + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Match + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/match.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/match.rb', line 10
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/matchers/built_in/match.rb', line 6
        +
        +def match(expected, actual)
        +  actual.match expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/MatchArray.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/MatchArray.html new file mode 100644 index 000000000..ddabb3538 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/MatchArray.html @@ -0,0 +1,424 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::MatchArray + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::MatchArray + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/match_array.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #diffable?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/matchers/built_in/match_array.rb', line 29
        +
        +def description
        +  "contain exactly#{to_sentence(expected)}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/match_array.rb', line 12
        +
        +def failure_message_for_should
        +  if actual.respond_to? :to_ary
        +    message =  "expected collection contained:  #{safe_sort(expected).inspect}\n"
        +    message += "actual collection contained:    #{safe_sort(actual).inspect}\n"
        +    message += "the missing elements were:      #{safe_sort(@missing_items).inspect}\n" unless @missing_items.empty?
        +    message += "the extra elements were:        #{safe_sort(@extra_items).inspect}\n"   unless @extra_items.empty?
        +  else
        +    message = "expected an array, actual collection was #{actual.inspect}"
        +  end
        +
        +  message
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/match_array.rb', line 25
        +
        +def failure_message_for_should_not
        +  "Matcher does not support should_not"
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/match_array.rb', line 5
        +
        +def match(expected, actual)
        +  return false unless actual.respond_to? :to_ary
        +  @extra_items = difference_between_arrays(actual, expected)
        +  @missing_items = difference_between_arrays(expected, actual)
        +  @extra_items.empty? & @missing_items.empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/NegativeOperatorMatcher.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/NegativeOperatorMatcher.html new file mode 100644 index 000000000..130c2be77 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/NegativeOperatorMatcher.html @@ -0,0 +1,210 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::NegativeOperatorMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::NegativeOperatorMatcher + + + +

        + +
        + +
        Inherits:
        +
        + OperatorMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/operator_matcher.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from OperatorMatcher

        +

        #description, #fail_with_message, get, #initialize, register, registry, unregister, use_custom_matcher_or_delegate

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::OperatorMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) __delegate_operator(actual, operator, expected) + + + + + +

        + + + + +
        +
        +
        +
        +106
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 106
        +
        +def __delegate_operator(actual, operator, expected)
        +  return false unless actual.__send__(operator, expected)
        +  return fail_with_message("expected not: #{operator} #{expected.inspect}\n         got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/OperatorMatcher.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/OperatorMatcher.html new file mode 100644 index 000000000..61634fd5e --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/OperatorMatcher.html @@ -0,0 +1,631 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::OperatorMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::OperatorMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/operator_matcher.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        NegativeOperatorMatcher, PositiveOperatorMatcher

        +
        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (OperatorMatcher) initialize(actual) + + + + + +

        +
        +

        Returns a new instance of OperatorMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 29
        +
        +def initialize(actual)
        +  @actual = actual
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) get(klass, operator) + + + + + +

        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 19
        +
        +def get(klass, operator)
        +  klass.ancestors.each { |ancestor|
        +    matcher = registry[ancestor] && registry[ancestor][operator]
        +    return matcher if matcher
        +  }
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + + (Object) register(klass, operator, matcher) + + + + + +

        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 10
        +
        +def register(klass, operator, matcher)
        +  registry[klass] ||= {}
        +  registry[klass][operator] = matcher
        +end
        +
        +
        + +
        +

        + + + (Object) registry + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 6
        +
        +def registry
        +  @registry ||= {}
        +end
        +
        +
        + +
        +

        + + + (Object) unregister(klass, operator) + + + + + +

        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 15
        +
        +def unregister(klass, operator)
        +  registry[klass] && registry[klass].delete(operator)
        +end
        +
        +
        + +
        +

        + + + (Object) use_custom_matcher_or_delegate(operator) + + + + + +

        + + + + +
        +
        +
        +
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 33
        +
        +def self.use_custom_matcher_or_delegate(operator)
        +  define_method(operator) do |expected|
        +    if !has_non_generic_implementation_of?(operator) && matcher = OperatorMatcher.get(@actual.class, operator)
        +      @actual.__send__(::RSpec::Matchers.last_should, matcher.new(expected))
        +    else
        +      eval_match(@actual, operator, expected)
        +    end
        +  end
        +
        +  negative_operator = operator.sub(/^=/, '!')
        +  if negative_operator != operator && respond_to?(negative_operator)
        +    define_method(negative_operator) do |expected|
        +      opposite_should = ::RSpec::Matchers.last_should == :should ? :should_not : :should
        +      raise "RSpec does not support `#{::RSpec::Matchers.last_should} #{negative_operator} expected`.  " +
        +        "Use `#{opposite_should} #{operator} expected` instead."
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 60
        +
        +def description
        +  "#{@operator} #{@expected.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) fail_with_message(message) + + + + + +

        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 56
        +
        +def fail_with_message(message)
        +  RSpec::Expectations.fail_with(message, @expected, @actual)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/PositiveOperatorMatcher.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/PositiveOperatorMatcher.html new file mode 100644 index 000000000..5ab475c80 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/PositiveOperatorMatcher.html @@ -0,0 +1,220 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::PositiveOperatorMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::PositiveOperatorMatcher + + + +

        + +
        + +
        Inherits:
        +
        + OperatorMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/operator_matcher.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from OperatorMatcher

        +

        #description, #fail_with_message, get, #initialize, register, registry, unregister, use_custom_matcher_or_delegate

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::OperatorMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) __delegate_operator(actual, operator, expected) + + + + + +

        + + + + +
        +
        +
        +
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 94
        +
        +def __delegate_operator(actual, operator, expected)
        +  if actual.__send__(operator, expected)
        +    true
        +  elsif ['==','===', '=~'].include?(operator)
        +    fail_with_message("expected: #{expected.inspect}\n     got: #{actual.inspect} (using #{operator})")
        +  else
        +    fail_with_message("expected: #{operator} #{expected.inspect}\n     got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html new file mode 100644 index 000000000..315c3a241 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html @@ -0,0 +1,739 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::RaiseError + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::RaiseError + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/raise_error.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (RaiseError) initialize(expected_error_or_message = Exception, expected_message = nil, &block) + + + + + +

        +
        +

        Returns a new instance of RaiseError

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 7
        +
        +def initialize(expected_error_or_message=Exception, expected_message=nil, &block)
        +  @block = block
        +  @actual_error = nil
        +  case expected_error_or_message
        +  when String, Regexp
        +    @expected_error, @expected_message = Exception, expected_error_or_message
        +  else
        +    @expected_error, @expected_message = expected_error_or_message, expected_message
        +  end
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +90
        +91
        +92
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 90
        +
        +def description
        +  "raise #{expected_error}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(given_proc) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 57
        +
        +def does_not_match?(given_proc)
        +  !matches?(given_proc, :negative_expectation)
        +end
        +
        +
        + +
        +

        + + - (Object) eval_block + + + + + +

        + + + + +
        +
        +
        +
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 61
        +
        +def eval_block
        +  @eval_block = true
        +  begin
        +    @block[@actual_error]
        +    @eval_block_passed = true
        +  rescue Exception => err
        +    @actual_error = err
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 82
        +
        +def failure_message_for_should
        +  @eval_block ? @actual_error.message : "expected #{expected_error}#{given_error}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 86
        +
        +def failure_message_for_should_not
        +  "expected no #{expected_error}#{given_error}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(given_proc, negative_expectation = false) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 18
        +
        +def matches?(given_proc, negative_expectation = false)
        +  if negative_expectation && (expecting_specific_exception? || @expected_message)
        +    what_to_deprecate = if expecting_specific_exception? && @expected_message
        +                          "`expect { }.not_to raise_error(SpecificErrorClass, message)`"
        +                        elsif expecting_specific_exception?
        +                          "`expect { }.not_to raise_error(SpecificErrorClass)`"
        +                        elsif @expected_message
        +                          "`expect { }.not_to raise_error(message)`"
        +                        end
        +
        +    RSpec.deprecate(
        +      what_to_deprecate,
        +      :replacement => "`expect { }.not_to raise_error` (with no args)"
        +    )
        +  end
        +  @raised_expected_error = false
        +  @with_expected_message = false
        +  @eval_block = false
        +  @eval_block_passed = false
        +  unless given_proc.respond_to?(:call)
        +    ::Kernel.warn "`raise_error` was called with non-proc object #{given_proc.inspect}"
        +    return false
        +  end
        +  begin
        +    given_proc.call
        +  rescue Exception => @actual_error
        +    if @actual_error == @expected_error || @expected_error === @actual_error
        +      @raised_expected_error = true
        +      @with_expected_message = verify_message
        +    end
        +  end
        +
        +  unless negative_expectation
        +    eval_block if @raised_expected_error && @with_expected_message && @block
        +  end
        +ensure
        +  return (@raised_expected_error & @with_expected_message) ? (@eval_block ? @eval_block_passed : true) : false
        +end
        +
        +
        + +
        +

        + + - (Object) verify_message + + + + + +

        + + + + +
        +
        +
        +
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 71
        +
        +def verify_message
        +  case @expected_message
        +  when nil
        +    true
        +  when Regexp
        +    @expected_message =~ @actual_error.message
        +  else
        +    @expected_message == @actual_error.message
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html new file mode 100644 index 000000000..223179720 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html @@ -0,0 +1,639 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::RespondTo + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::RespondTo + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/respond_to.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (RespondTo) initialize(*names) + + + + + +

        +
        +

        Returns a new instance of RespondTo

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 7
        +
        +def initialize(*names)
        +  @names = names
        +  @expected_arity = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) argument + + + + Also known as: + arguments + + + + +

        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 37
        +
        +def argument
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 28
        +
        +def description
        +  "respond to #{pp_names}#{with_arity}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 16
        +
        +def does_not_match?(actual)
        +  find_failing_method_names(actual, :select).empty?
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 20
        +
        +def failure_message_for_should
        +  "expected #{@actual.inspect} to respond to #{@failing_method_names.collect {|name| name.inspect }.join(', ')}#{with_arity}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 24
        +
        +def failure_message_for_should_not
        +  failure_message_for_should.sub(/to respond to/, 'not to respond to')
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 12
        +
        +def matches?(actual)
        +  find_failing_method_names(actual, :reject).empty?
        +end
        +
        +
        + +
        +

        + + - (Object) with(n) + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 32
        +
        +def with(n)
        +  @expected_arity = n
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html new file mode 100644 index 000000000..634a0ba06 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html @@ -0,0 +1,455 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Satisfy + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Satisfy + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/satisfy.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (Satisfy) initialize(&block) + + + + + +

        +
        +

        Returns a new instance of Satisfy

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 7
        +
        +def initialize(&block)
        +  @block = block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 25
        +
        +def description
        +  "satisfy block"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 17
        +
        +def failure_message_for_should
        +  "expected #{@actual} to satisfy block"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 21
        +
        +def failure_message_for_should_not
        +  "expected #{@actual} not to satisfy block"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual, &block) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 11
        +
        +def matches?(actual, &block)
        +  @block = block if block
        +  @actual = actual
        +  @block.call(actual)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html new file mode 100644 index 000000000..c961ecccd --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html @@ -0,0 +1,447 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::StartAndEndWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::StartAndEndWith + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        EndWith, StartWith

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #match_unless_raises, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (StartAndEndWith) initialize(*expected) + + + + + +

        +
        +

        Returns a new instance of StartAndEndWith

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 5
        +
        +def initialize(*expected)
        +  @expected = expected.length == 1 ? expected.first : expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 18
        +
        +def failure_message_for_should
        +  "expected #{@actual.inspect} to #{self.class.name.split('::').last.sub(/With/,'').downcase} with #{@expected.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 22
        +
        +def failure_message_for_should_not
        +  "expected #{@actual.inspect} not to #{self.class.name.split('::').last.sub(/With/,'').downcase} with #{@expected.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 9
        +
        +def matches?(actual)
        +  @actual = actual.respond_to?(:[]) ? actual : (raise ArgumentError.new("#{actual.inspect} does not respond to :[]"))
        +  begin
        +    @expected.respond_to?(:length) ? subset_matches?(@expected, @actual) : element_matches?(@expected, @actual)
        +  rescue ArgumentError
        +    raise ArgumentError.new("#{actual.inspect} does not have ordered elements")
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html new file mode 100644 index 000000000..9c44f495d --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html @@ -0,0 +1,353 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::StartWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::StartWith + + + +

        + +
        + +
        Inherits:
        +
        + StartAndEndWith + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from StartAndEndWith

        +

        #failure_message_for_should, #failure_message_for_should_not, #initialize, #matches?

        + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::StartAndEndWith

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) element_matches?(expected, actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 32
        +
        +def element_matches?(expected, actual)
        +  @actual[0] == @expected
        +end
        +
        +
        + +
        +

        + + - (Boolean) subset_matches?(expected, actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 28
        +
        +def subset_matches?(expected, actual)
        +  actual[0, expected.length] == expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html new file mode 100644 index 000000000..9f7f91eb6 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html @@ -0,0 +1,615 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::ThrowSymbol + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::ThrowSymbol + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/throw_symbol.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (ThrowSymbol) initialize(expected_symbol = nil, expected_arg = nil) + + + + + +

        +
        +

        Returns a new instance of ThrowSymbol

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 7
        +
        +def initialize(expected_symbol = nil, expected_arg=nil)
        +  @expected_symbol = expected_symbol
        +  @expected_arg = expected_arg
        +  @caught_symbol = @caught_arg = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 65
        +
        +def description
        +  "throw #{expected}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 57
        +
        +def failure_message_for_should
        +  "expected #{expected} to be thrown, got #{caught}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 61
        +
        +def failure_message_for_should_not
        +  "expected #{expected('no Symbol')}#{' not' if @expected_symbol} to be thrown, got #{caught}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(given_proc) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 13
        +
        +def matches?(given_proc)
        +  begin
        +    if @expected_symbol.nil?
        +      given_proc.call
        +    else
        +      @caught_arg = catch :proc_did_not_throw_anything do
        +        catch @expected_symbol do
        +          given_proc.call
        +          throw :proc_did_not_throw_anything, :nothing_thrown
        +        end
        +      end
        +
        +      if @caught_arg == :nothing_thrown
        +        @caught_arg = nil
        +      else
        +        @caught_symbol = @expected_symbol
        +      end
        +    end
        +
        +    # Ruby 1.8 uses NameError with `symbol'
        +    # Ruby 1.9 uses ArgumentError with :symbol
        +  rescue NameError, ArgumentError => e
        +    unless e.message =~ /uncaught throw (`|\:)([a-zA-Z0-9_]*)(')?/
        +      other_exception = e
        +      raise
        +    end
        +    @caught_symbol = $2.to_sym
        +  rescue => other_exception
        +    raise
        +  ensure
        +    unless other_exception
        +      if @expected_symbol.nil?
        +        return !@caught_symbol.nil?
        +      else
        +        if @expected_arg.nil?
        +          return @caught_symbol == @expected_symbol
        +        else
        +          return (@caught_symbol == @expected_symbol) & (@caught_arg == @expected_arg)
        +        end
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (True) supports_block_expectations? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates this matcher matches against a block.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (True) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 72
        +
        +def supports_block_expectations?
        +  true
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html new file mode 100644 index 000000000..f04133812 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html @@ -0,0 +1,777 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldControl + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldControl + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #match_unless_raises

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (YieldControl) initialize + + + + + +

        +
        +

        Returns a new instance of YieldControl

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +68
        +69
        +70
        +71
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 68
        +
        +def initialize
        +  @expectation_type = nil
        +  @expected_yields_count = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) at_least(number) + + + + + +

        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 103
        +
        +def at_least(number)
        +  set_expected_yields_count(:>=, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) at_most(number) + + + + + +

        + + + + +
        +
        +
        +
        +98
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 98
        +
        +def at_most(number)
        +  set_expected_yields_count(:<=, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) exactly(number) + + + + + +

        + + + + +
        +
        +
        +
        +93
        +94
        +95
        +96
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 93
        +
        +def exactly(number)
        +  set_expected_yields_count(:==, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +112
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 112
        +
        +def failure_message_for_should
        +  'expected given block to yield control'.tap do |failure_message|
        +    failure_message << relativity_failure_message
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 118
        +
        +def failure_message_for_should_not
        +  'expected given block not to yield control'.tap do |failure_message|
        +    failure_message << relativity_failure_message
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 73
        +
        +def matches?(block)
        +  probe = YieldProbe.probe(block)
        +
        +  if @expectation_type
        +    probe.num_yields.send(@expectation_type, @expected_yields_count)
        +  else
        +    probe.yielded_once?(:yield_control)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) once + + + + + +

        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 83
        +
        +def once
        +  exactly(1)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) times + + + + + +

        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 108
        +
        +def times
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) twice + + + + + +

        + + + + +
        +
        +
        +
        +88
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 88
        +
        +def twice
        +  exactly(2)
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldProbe.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldProbe.html new file mode 100644 index 000000000..51bbbf94b --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldProbe.html @@ -0,0 +1,807 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldProbe + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldProbe + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) num_yields + + + + + + + + + + + + + + + + +

          Returns the value of attribute num_yields.

          +
          + +
        • + + +
        • + + + - (Object) yielded_args + + + + + + + + + + + + + + + + +

          Returns the value of attribute yielded_args.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (YieldProbe) initialize + + + + + +

        +
        +

        Returns a new instance of YieldProbe

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 15
        +
        +def initialize
        +  @used = false
        +  self.num_yields, self.yielded_args = 0, []
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) num_yields + + + + + +

        +
        +

        Returns the value of attribute num_yields

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 13
        +
        +def num_yields
        +  @num_yields
        +end
        +
        +
        + + + +
        +

        + + - (Object) yielded_args + + + + + +

        +
        +

        Returns the value of attribute yielded_args

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 13
        +
        +def yielded_args
        +  @yielded_args
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) assert_valid_expect_block!(block) + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 60
        +
        +def self.assert_valid_expect_block!(block)
        +  return if block.arity == 1
        +  raise "Your expect block must accept an argument to be used with this " +
        +        "matcher. Pass the argument as a block on to the method you are testing."
        +end
        +
        +
        + +
        +

        + + + (Object) probe(block) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 5
        +
        +def self.probe(block)
        +  probe = new
        +  assert_valid_expect_block!(block)
        +  block.call(probe)
        +  probe.assert_used!
        +  probe
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) assert_used! + + + + + +

        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 51
        +
        +def assert_used!
        +  return if @used
        +  raise "You must pass the argument yielded to your expect block on " +
        +        "to the method-under-test as a block. It acts as a probe that " +
        +        "allows the matcher to detect whether or not the method-under-test " +
        +        "yields, and, if so, how many times, and what the yielded arguments " +
        +        "are."
        +end
        +
        +
        + +
        +

        + + - (Object) single_yield_args + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 30
        +
        +def single_yield_args
        +  yielded_args.first
        +end
        +
        +
        + +
        +

        + + - (Object) successive_yield_args + + + + + +

        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 45
        +
        +def successive_yield_args
        +  yielded_args.map do |arg_array|
        +    arg_array.size == 1 ? arg_array.first : arg_array
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) to_proc + + + + + +

        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 20
        +
        +def to_proc
        +  @used = true
        +
        +  probe = self
        +  Proc.new do |*args|
        +    probe.num_yields += 1
        +    probe.yielded_args << args
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) yielded_once?(matcher_name) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 34
        +
        +def yielded_once?(matcher_name)
        +  case num_yields
        +  when 1 then true
        +  when 0 then false
        +  else
        +    raise "The #{matcher_name} matcher is not designed to be used with a " +
        +          "method that yields multiple times. Use the yield_successive_args " +
        +          "matcher for that case."
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html new file mode 100644 index 000000000..868c1f590 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html @@ -0,0 +1,467 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (YieldSuccessiveArgs) initialize(*args) + + + + + +

        +
        +

        Returns a new instance of YieldSuccessiveArgs

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +272
        +273
        +274
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 272
        +
        +def initialize(*args)
        +  @expected = args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +294
        +295
        +296
        +297
        +298
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 294
        +
        +def description
        +  desc = "yield successive args"
        +  desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")"
        +  desc
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +282
        +283
        +284
        +285
        +286
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 282
        +
        +def failure_message_for_should
        +  "expected given block to yield successively with arguments, but yielded with unexpected arguments" +
        +    "\nexpected: #{@expected.inspect}" +
        +    "\n     got: #{@actual.inspect} (compared using === and ==)"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +288
        +289
        +290
        +291
        +292
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 288
        +
        +def failure_message_for_should_not
        +  "expected given block not to yield successively with arguments, but yielded with expected arguments" +
        +      "\nexpected not: #{@expected.inspect}" +
        +      "\n         got: #{@actual.inspect} (compared using === and ==)"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +276
        +277
        +278
        +279
        +280
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 276
        +
        +def matches?(block)
        +  @probe = YieldProbe.probe(block)
        +  @actual = @probe.successive_yield_args
        +  args_match?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html new file mode 100644 index 000000000..df27824e8 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html @@ -0,0 +1,459 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldWithArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldWithArgs + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        MatchAliases
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        +
        +

        Constructor Details

        + +
        +

        + + - (YieldWithArgs) initialize(*args) + + + + + +

        +
        +

        Returns a new instance of YieldWithArgs

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +196
        +197
        +198
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 196
        +
        +def initialize(*args)
        +  @expected = args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +214
        +215
        +216
        +217
        +218
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 214
        +
        +def description
        +  desc = "yield with args"
        +  desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")" unless @expected.empty?
        +  desc
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +206
        +207
        +208
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 206
        +
        +def failure_message_for_should
        +  "expected given block to yield with arguments, but #{positive_failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +210
        +211
        +212
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 210
        +
        +def failure_message_for_should_not
        +  "expected given block not to yield with arguments, but #{negative_failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +200
        +201
        +202
        +203
        +204
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 200
        +
        +def matches?(block)
        +  @probe = YieldProbe.probe(block)
        +  @actual = @probe.single_yield_args
        +  @probe.yielded_once?(:yield_with_args) && args_match?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html new file mode 100644 index 000000000..5d98de41b --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html @@ -0,0 +1,372 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldWithNoArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldWithNoArgs + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #description, #diffable?, #initialize, #match_unless_raises

        + + + + + + + + + +

        Methods included from MatchAliases

        +

        #==, #===

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 169
        +
        +def failure_message_for_should
        +  "expected given block to yield with no arguments, but #{failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +173
        +174
        +175
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 173
        +
        +def failure_message_for_should_not
        +  "expected given block not to yield with no arguments, but did"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +164
        +165
        +166
        +167
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 164
        +
        +def matches?(block)
        +  @probe = YieldProbe.probe(block)
        +  @probe.yielded_once?(:yield_with_no_args) && @probe.single_yield_args.empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DSL.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DSL.html new file mode 100644 index 000000000..9ebf5606b --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DSL.html @@ -0,0 +1,222 @@ + + + + + + Module: RSpec::Matchers::DSL + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::DSL + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/dsl.rb,
        + lib/rspec/matchers/matcher.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: Matcher + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) define(name, &declarations) + + + + Also known as: + matcher + + + + +

        +
        +

        Defines a custom matcher.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 6
        +
        +def define(name, &declarations)
        +  matcher_template = RSpec::Matchers::DSL::Matcher.new(name, &declarations)
        +  define_method name do |*expected|
        +    matcher = matcher_template.for_expected(*expected)
        +    @matcher_execution_context ||= self
        +    matcher.instance_variable_set(:@matcher_execution_context, @matcher_execution_context)
        +    matcher
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DSL/Matcher.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DSL/Matcher.html new file mode 100644 index 000000000..b07752225 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DSL/Matcher.html @@ -0,0 +1,2012 @@ + + + + + + Class: RSpec::Matchers::DSL::Matcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::DSL::Matcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        RSpec::Matchers, Extensions::InstanceEvalWithArgs, Pretty
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/matcher.rb
        + +
        +
        + +

        Overview

        +
        +

        Provides the context in which the block passed to RSpec::Matchers.define +will be evaluated.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + +
        + +
        PERSISTENT_INSTANCE_VARIABLES = + +
        +
        [
        +  :@name, :@declarations, :@diffable,
        +  :@supports_block_expectations,
        +  :@match_block, :@match_for_should_not_block,
        +  :@expected_exception
        +].to_set
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) actual + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute actual.

          +
          + +
        • + + +
        • + + + - (Object) rescued_exception + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute rescued_exception.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from RSpec::Matchers

        +

        #be, #be_a, #be_a_kind_of, #be_an_instance_of, #be_close, #be_false, #be_falsey, #be_nil, #be_true, #be_truthy, #be_within, #change, clear_generated_description, configuration, const_missing, #cover, #end_with, #eq, #eql, #equal, #exist, generated_description, #have, #have_at_least, #have_at_most, is_a_matcher?, #match_array, #raise_error, #respond_to, #satisfy, #start_with, #throw_symbol, #yield_control, #yield_successive_args, #yield_with_args, #yield_with_no_args

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        + + + + + + + + + +

        Methods included from Extensions::InstanceEvalWithArgs

        +

        #instance_eval_with_args

        +
        +

        Constructor Details

        + +
        +

        + + - (Matcher) initialize(name, &declarations) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Matcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 17
        +
        +def initialize(name, &declarations)
        +  @name         = name
        +  @declarations = declarations
        +  @actual       = nil
        +  @diffable     = false
        +  @supports_block_expectations = false
        +  @expected_exception, @rescued_exception = nil, nil
        +  @match_for_should_not_block = nil
        +  @messages = {}
        +  @define_block_executed = false
        +  @block_method_differentiator = nil
        +  @deprecated_methods = Set.new
        +  @matcher_execution_context = nil
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(method, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +279
        +280
        +281
        +282
        +283
        +284
        +285
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 279
        +
        +def method_missing(method, *args, &block)
        +  if @matcher_execution_context.respond_to?(method)
        +    @matcher_execution_context.__send__ method, *args, &block
        +  else
        +    super(method, *args, &block)
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) actual (readonly) + + + + + +

        +
        +

        Returns the value of attribute actual

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 14
        +
        +def actual
        +  @actual
        +end
        +
        +
        + + + +
        +

        + + - (Object) rescued_exception (readonly) + + + + + +

        +
        +

        Returns the value of attribute rescued_exception

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 14
        +
        +def rescued_exception
        +  @rescued_exception
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) chain(method, &block) + + + + + +

        +
        +

        Convenience for defining methods on this matcher to create a fluent +interface. The trick about fluent interfaces is that each method must +return self in order to chain methods together. chain handles that +for you.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_errors_on do |key|
        +  chain :with do |message|
        +    @message = message
        +  end
        +
        +  match do |actual|
        +    actual.errors[key] == @message
        +  end
        +end
        +
        +minor.should have_errors_on(:age).with("Not old enough to participate")
        + +
        + + +
        + + + + +
        +
        +
        +
        +246
        +247
        +248
        +249
        +250
        +251
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 246
        +
        +def chain(method, &block)
        +  define_method method do |*args|
        +    block.call(*args)
        +    self
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) description(&block) + + + + + +

        +
        +

        Customize the description to use for one-liners. Only use this when +the description generated by default doesn't suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :qualify_for do |expected|
        +  match { ... }
        +
        +  description do
        +    "qualify for #{expected}"
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +214
        +215
        +216
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 214
        +
        +def description(&block)
        +  cache_or_call_cached(:description, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) diffable + + + + + +

        +
        +

        Tells the matcher to diff the actual and expected values in the failure +message.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +220
        +221
        +222
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 220
        +
        +def diffable
        +  @diffable = true
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used internally by objects returns by +should+ and +should_not+.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +255
        +256
        +257
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 255
        +
        +def diffable?
        +  @diffable
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used internally by +should_not+

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +266
        +267
        +268
        +269
        +270
        +271
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 266
        +
        +def does_not_match?(actual)
        +  @actual = actual
        +  @match_for_should_not_block ?
        +    instance_eval_with_args(actual, &@match_for_should_not_block) :
        +    !matches?(actual)
        +end
        +
        +
        + +
        +

        + + - (Object) expected + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 39
        +
        +def expected
        +  if @expected.size == 1
        +    RSpec.warn_deprecation(
        +      "Custom matchers in 3.x will set expected to be a single value "+
        +      "(when provided as such) rather than an array. This may change "+
        +      "the behaviour of your matcher.\n"+
        +      "To continue to access this as an array use `expected_as_array`\n"+
        +      "Called from: #{ RSpec::CallerFilter.first_non_rspec_line }\n\n"
        +    )
        +  end
        +  @expected
        +end
        +
        +
        + +
        +

        + + - (Object) expected_as_array + + + + + +

        + + + + +
        +
        +
        +
        +52
        +53
        +54
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 52
        +
        +def expected_as_array
        +  @expected
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should {|Object| ... } + + + + + +

        +
        +

        Customize the failure messsage to use when this matcher is invoked with +should. Only use this when the message generated by default doesn't +suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_strength do |expected|
        +  match { ... }
        +
        +  failure_message_for_should do |actual|
        +    "Expected strength of #{expected}, but had #{actual.strength}"
        +  end
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +177
        +178
        +179
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 177
        +
        +def failure_message_for_should(&block)
        +  cache_or_call_cached(:failure_message_for_should, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not {|Object| ... } + + + + + +

        +
        +

        Customize the failure messsage to use when this matcher is invoked with +should_not. Only use this when the message generated by default +doesn't suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_strength do |expected|
        +  match { ... }
        +
        +  failure_message_for_should_not do |actual|
        +    "Expected not to have strength of #{expected}, but did"
        +  end
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual object

          +
          + +
        • + +
        • + + + (Object) + + + + — +

          actual the actual object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +197
        +198
        +199
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 197
        +
        +def failure_message_for_should_not(&block)
        +  cache_or_call_cached(:failure_message_for_should_not, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) for_expected(*expected) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 67
        +
        +def for_expected(*expected)
        +  @expected = expected
        +  dup.instance_eval do
        +    instance_variables.map {|ivar| ivar.intern}.each do |ivar|
        +      instance_variable_set(ivar, nil) unless (PERSISTENT_INSTANCE_VARIABLES + [:@expected]).include?(ivar)
        +    end
        +    @messages = {}
        +    @deprecated_methods = Set.new
        +
        +    @block_method_differentiator = DifferentiateBlockMethodTypes.new(*@expected, &@declarations)
        +    making_declared_methods_public do
        +      instance_eval_with_args(*@expected, &@declarations)
        +    end
        +
        +    @define_block_executed = true
        +    self
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) match {|Object| ... } + + + + Also known as: + match_for_should + + + + +

        +
        +

        Stores the block that is used to determine whether this matcher passes +or fails. The block should return a boolean value. When the matcher is +passed to should and the block returns true, then the expectation +passes. Similarly, when the matcher is passed to should_not and the +block returns false, then the expectation passes.

        + +

        Use match_for_should when used in conjuntion with +match_for_should_not.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :be_even do
        +  match do |actual|
        +    actual.even?
        +  end
        +end
        +
        +4.should be_even     # passes
        +3.should_not be_even # passes
        +3.should be_even     # fails
        +4.should_not be_even # fails
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual value (or receiver of should)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +129
        +130
        +131
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 129
        +
        +def match(&block)
        +  @match_block = block
        +end
        +
        +
        + +
        +

        + + - (Object) match_for_should_not {|Object| ... } + + + + + +

        +
        +

        Use this to define the block for a negative expectation (should_not) +when the positive and negative forms require different handling. This +is rarely necessary, but can be helpful, for example, when specifying +asynchronous processes that require different timeouts.

        + + +
        +
        +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual value (or receiver of should)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +141
        +142
        +143
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 141
        +
        +def match_for_should_not(&block)
        +  @match_for_should_not_block = block
        +end
        +
        +
        + +
        +

        + + - (Object) match_unless_raises(exception = Exception, &block) + + + + + +

        +
        +

        Use this instead of match when the block will raise an exception +rather than returning false to indicate a failure.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :accept_as_valid do |candidate_address|
        +  match_unless_raises ValidationException do |validator|
        +    validator.validate(candidate_address)
        +  end
        +end
        +
        +email_validator.should accept_as_valid("person@company.com")
        + +
        + + +
        + + + + +
        +
        +
        +
        +157
        +158
        +159
        +160
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 157
        +
        +def match_unless_raises(exception=Exception, &block)
        +  @expected_exception = exception
        +  match(&block)
        +end
        +
        +
        + +
        +

        + + - (Object) matcher_execution_context + + + + + +

        + + + + +
        +
        +
        +
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 61
        +
        +def matcher_execution_context
        +  RSpec.deprecate("`matcher_execution_context` on custom matchers")
        +  @matcher_execution_context
        +end
        +
        +
        + +
        +

        + + - (Object) matcher_execution_context=(value) + + + + + +

        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +59
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 56
        +
        +def matcher_execution_context=(value)
        +  RSpec.deprecate("`matcher_execution_context=` on custom matchers")
        +  @matcher_execution_context = value
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used internally by +should+ and +should_not+.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 88
        +
        +def matches?(actual)
        +  @actual = actual
        +  if @expected_exception
        +    begin
        +      instance_eval_with_args(actual, &@match_block)
        +      true
        +    rescue @expected_exception => @rescued_exception
        +      false
        +    end
        +  else
        +    begin
        +      instance_eval_with_args(actual, &@match_block)
        +    rescue RSpec::Expectations::ExpectationNotMetError
        +      false
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) respond_to?(method, include_private = false) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +273
        +274
        +275
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 273
        +
        +def respond_to?(method, include_private=false)
        +  super || @matcher_execution_context.respond_to?(method, include_private)
        +end
        +
        +
        + +
        +

        + + - (Object) supports_block_expectations + + + + + +

        + + + + +
        +
        +
        +
        +224
        +225
        +226
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 224
        +
        +def supports_block_expectations
        +  @supports_block_expectations = true
        +end
        +
        +
        + +
        +

        + + - (Boolean) supports_block_expectations? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +260
        +261
        +262
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 260
        +
        +def supports_block_expectations?
        +  @supports_block_expectations
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DifferentiateBlockMethodTypes.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DifferentiateBlockMethodTypes.html new file mode 100644 index 000000000..55227aba0 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/DifferentiateBlockMethodTypes.html @@ -0,0 +1,372 @@ + + + + + + Class: RSpec::Matchers::DifferentiateBlockMethodTypes + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::DifferentiateBlockMethodTypes + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/differentiate_block_method_types.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Evaluates a block in order to determine what methods, if any, +it defines as instance methods (using def foo) vs singleton +methods (using def self.foo).

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (DifferentiateBlockMethodTypes) initialize(*block_args, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of DifferentiateBlockMethodTypes

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/matchers/differentiate_block_method_types.rb', line 9
        +
        +def initialize(*block_args, &block)
        +  @block_args = block_args
        +  @block = block
        +
        +  ignore_macro_methods
        +
        +  capture_added_methods(singletons_singleton_class, singleton_methods)
        +  capture_added_methods(singleton_class, instance_methods)
        +
        +  singleton_class.class_exec(*block_args, &block)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) instance_methods + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/differentiate_block_method_types.rb', line 25
        +
        +def instance_methods
        +  @instance_methods ||= []
        +end
        +
        +
        + +
        +

        + + - (Object) singleton_methods + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/differentiate_block_method_types.rb', line 21
        +
        +def singleton_methods
        +  @singleton_methods ||= []
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Extensions.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Extensions.html new file mode 100644 index 000000000..ff9103745 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Extensions.html @@ -0,0 +1,115 @@ + + + + + + Module: RSpec::Matchers::Extensions + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::Extensions + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/extensions/instance_eval_with_args.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: InstanceEvalWithArgs + + + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Extensions/InstanceEvalWithArgs.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Extensions/InstanceEvalWithArgs.html new file mode 100644 index 000000000..38015f28a --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Extensions/InstanceEvalWithArgs.html @@ -0,0 +1,239 @@ + + + + + + Module: RSpec::Matchers::Extensions::InstanceEvalWithArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::Extensions::InstanceEvalWithArgs + + + +

        + +
        + + + + + + + +
        Included in:
        +
        DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/extensions/instance_eval_with_args.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) instance_eval_with_args(*args, &block) + + + + + +

        +
        +

        based on Bounded Spec InstanceExec (Mauricio Fernandez) +http://eigenclass.org/hiki/bounded+space+instance_exec +- uses singleton_class instead of global InstanceExecHelper module +- this keeps it scoped to classes/modules that include this module +- only necessary for ruby 1.8.6

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/matchers/extensions/instance_eval_with_args.rb', line 10
        +
        +def instance_eval_with_args(*args, &block)
        +  return instance_exec(*args, &block) if respond_to?(:instance_exec)
        +
        +  # If there are no args and the block doesn't expect any, there's no
        +  # need to fake instance_exec with our hack below.
        +  # Notes:
        +  #   * lambda { }.arity # => -1
        +  #   * lambda { || }.arity # => 0
        +  #   * lambda { |*a| }.arity # -1
        +  return instance_eval(&block) if block.arity < 1 && args.empty?
        +
        +  singleton_class = (class << self; self; end)
        +  begin
        +    orig_critical, Thread.critical = Thread.critical, true
        +    n = 0
        +    n += 1 while respond_to?(method_name="__instance_exec#{n}")
        +    singleton_class.module_eval{ define_method(method_name, &block) }
        +  ensure
        +    Thread.critical = orig_critical
        +  end
        +  begin
        +    return __send__(method_name, *args)
        +  ensure
        +    singleton_class.module_eval{ remove_method(method_name) } rescue nil
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/MatchAliases.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/MatchAliases.html new file mode 100644 index 000000000..d9c4a4c25 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/MatchAliases.html @@ -0,0 +1,246 @@ + + + + + + Module: RSpec::Matchers::MatchAliases + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::MatchAliases + + + +

        + +
        + + + + + + + +
        Included in:
        +
        BuiltIn::BaseMatcher, BuiltIn::BeWithin, BuiltIn::Change, BuiltIn::Has, BuiltIn::Have, BuiltIn::RaiseError, BuiltIn::RespondTo, BuiltIn::Satisfy, BuiltIn::ThrowSymbol, BuiltIn::YieldSuccessiveArgs, BuiltIn::YieldWithArgs
        + + + +
        Defined in:
        +
        lib/rspec/matchers/match_aliases.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(other) + + + + + +

        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/match_aliases.rb', line 4
        +
        +def ==(other)
        +  return true if equal?(other)
        +
        +  matched = matches?(other)
        +
        +  if matched
        +    RSpec.deprecate("Using `matcher == value` as an alias for `#matches?`", :replacement => "`matcher === value`")
        +  end
        +
        +  matched
        +end
        +
        +
        + +
        +

        + + - (Object) ===(other) + + + + + +

        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/match_aliases.rb', line 16
        +
        +def ===(other)
        +  matches?(other)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Pretty.html b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Pretty.html new file mode 100644 index 000000000..1d0e9286d --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/RSpec/Matchers/Pretty.html @@ -0,0 +1,613 @@ + + + + + + Module: RSpec::Matchers::Pretty + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::Pretty + + + +

        + +
        + + + + + + + +
        Included in:
        +
        BuiltIn::BaseMatcher, DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/pretty.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) _pretty_print(array) + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 23
        +
        +def _pretty_print(array)
        +  RSpec.deprecate("`RSpec::Matchers::Pretty#_pretty_print`",
        +                  :replacement => "`RSpec::Matchers::Pretty#to_sentence`")
        +  result = ""
        +  array.each_with_index do |item, index|
        +    if index < (array.length - 2)
        +      result << "#{item.inspect}, "
        +    elsif index < (array.length - 1)
        +      result << "#{item.inspect} and "
        +    else
        +      result << "#{item.inspect}"
        +    end
        +  end
        +  result
        +end
        +
        +
        + +
        +

        + + - (Object) expected_to_sentence + + + + + +

        + + + + +
        +
        +
        +
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 47
        +
        +def expected_to_sentence
        +  RSpec.deprecate("`RSpec::Matchers::Pretty#expected_to_sentence`",
        +                  :replacement => "`RSpec::Matchers::Pretty#to_sentence(expected)`")
        +  to_sentence(@expected) if defined?(@expected)
        +end
        +
        +
        + +
        +

        + + - (Object) name + + + + + +

        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 53
        +
        +def name
        +  defined?(@name) ? @name : underscore(self.class.name.split("::").last)
        +end
        +
        +
        + +
        +

        + + - (Object) name_to_sentence + + + + + +

        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 43
        +
        +def name_to_sentence
        +  split_words(name)
        +end
        +
        +
        + +
        +

        + + - (Object) split_words(sym) + + + + + +

        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 4
        +
        +def split_words(sym)
        +  sym.to_s.gsub(/_/,' ')
        +end
        +
        +
        + +
        +

        + + - (Object) to_sentence(words) + + + + + +

        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 8
        +
        +def to_sentence(words)
        +  return "" unless words
        +  words = Array(words).map { |w| to_word(w) }
        +  case words.length
        +    when 0
        +      ""
        +    when 1
        +      " #{words[0]}"
        +    when 2
        +      " #{words[0]} and #{words[1]}"
        +    else
        +      " #{words[0...-1].join(', ')}, and #{words[-1]}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) to_word(item) + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 39
        +
        +def to_word(item)
        +  is_matcher_with_description?(item) ? item.description : item.inspect
        +end
        +
        +
        + +
        +

        + + - (Object) underscore(camel_cased_word) + + + + + +

        +
        +

        Borrowed from ActiveSupport

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 58
        +
        +def underscore(camel_cased_word)
        +  word = camel_cased_word.to_s.dup
        +  word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
        +  word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
        +  word.tr!("-", "_")
        +  word.downcase!
        +  word
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/_index.html b/source/documentation/2.99/rspec-expectations/_index.html new file mode 100644 index 000000000..49f21b298 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/_index.html @@ -0,0 +1,643 @@ + + + + + + Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.4

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + +
          +
        • B
        • +
            + +
          • + BaseMatcher + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Be + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeAKindOf + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeAnInstanceOf + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeComparedTo + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeFalsey + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeHelpers + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeNil + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BePredicate + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeTruthy + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeWithin + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BuiltIn + + (RSpec::Matchers) + +
          • + +
          +
        + + +
          +
        • C
        • +
            + +
          • + CallerFilter + + (RSpec) + +
          • + +
          • + Change + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Configuration + + (RSpec::Expectations) + +
          • + +
          • + Cover + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + + + + + +
          +
        • H
        • +
            + +
          • + Has + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Have + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + + +
          +
        • M
        • +
            + +
          • + Match + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + MatchAliases + + (RSpec::Matchers) + +
          • + +
          • + MatchArray + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Matcher + + (RSpec::Matchers::DSL) + +
          • + +
          • + Matchers + + (RSpec) + +
          • + +
          +
        + + +
        + + + + + + + + + + + +
          +
        • R
        • +
            + +
          • + RSpec + +
          • + +
          • + RaiseError + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + RespondTo + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + + +
          +
        • T
        • +
            + +
          • + ThrowSymbol + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/class_list.html b/source/documentation/2.99/rspec-expectations/class_list.html new file mode 100644 index 000000000..e5cadc052 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/class_list.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-expectations/file.Changelog.html b/source/documentation/2.99/rspec-expectations/file.Changelog.html new file mode 100644 index 000000000..27da0faa6 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/file.Changelog.html @@ -0,0 +1,733 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        2.99.2 / 2014-07-21

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix regression in Expectations#method_handle_for where proxy objects +with method delegated would wrongly not return a method handle. +(Jon Rowe, #594)
        • +
        • Fix issue with detection of generic operator matchers so they work +correctly when undefined. (Myron Marston, #597)
        • +
        + +

        2.99.1 / 2014-06-19

        + +

        Full Changelog

        + +

        Bug Fixes:

        + +
          +
        • Fix typo in custom matcher expected deprecation warning -- it's +expected_as_array, not expected_array. (Frederick Cheung, #562)
        • +
        + +

        2.99.0 / 2014-06-01

        + +

        Full Changelog

        + +

        Enhancements:

        + +
          +
        • Special case deprecation message for errors_on with rspec-rails to be more useful. +(Aaron Kromer)
        • +
        + +

        2.99.0.rc1 / 2014-05-18

        + +

        Full Changelog

        + +

        Deprecations:

        + +
          +
        • Deprecate matcher_execution_context attribute on DSL-defined +custom matchers. (Myron Marston)
        • +
        • Deprecate RSpec::Matchers::Pretty#_pretty_print. (Myron Marston)
        • +
        • Deprecate RSpec::Matchers::Pretty#expected_to_sentence. (Myron Marston)
        • +
        • Deprecate RSpec::Matchers::Configuration in favor of +RSpec::Expectations::Configuration. (Myron Marston)
        • +
        • Deprecate be_xyz predicate matcher on an object that doesn't respond to +xyz? or xyzs?. (Daniel Fone)
        • +
        • Deprecate have_xyz matcher on an object that doesn't respond to has_xyz?. +(Daniel Fone)
        • +
        • Deprecate have_xyz matcher on an object that has a private method has_xyz?. +(Jon Rowe)
        • +
        • Issue a deprecation warning when a block expectation expression is +used with a matcher that doesn't explicitly support block expectations +via supports_block_expectations?. (Myron Marston)
        • +
        • Deprecate require 'rspec-expectations'. Use +require 'rspec/expectations' instead. (Myron Marston)
        • +
        + +

        2.99.0.beta2 / 2014-02-17

        + +

        Full Changelog

        + +

        Deprecations:

        + +
          +
        • Deprecate chaining by, by_at_least, by_at_most or to off of +expect { }.not_to change { }. The docs have always said these are +not supported for the negative form but now they explicitly raise +errors in RSpec 3. (Myron Marston)
        • +
        • Change the semantics of expect { }.not_to change { x }.from(y). +In RSpec 2.x, this expectation would only fail if x started with +the value of y and changed. If it started with a different value +and changed, it would pass. In RSpec 3, it will pass only if the +value starts at y and it does not change. (Myron Marston)
        • +
        • Deprecate matcher == value as an alias for matcher.matches?(value), +in favor of matcher === value. (Myron Marston)
        • +
        • Deprecate RSpec::Matchers::OperatorMatcher in favor of +RSpec::Matchers::BuiltIn::OperatorMatcher. (Myron Marston)
        • +
        • Deprecate auto-integration with Test::Unit and minitest. +Instead, include RSpec::Matchers in the appropriate test case +base class yourself. (Myron Marston)
        • +
        • Deprecate treating #expected on a DSL-generated custom matcher +as an array when only 1 argument is passed to the matcher method. +In RSpec 3 it will be the single value in order to make diffs +work properly. (Jon Rowe)
        • +
        + +

        2.99.0.beta1 / 2013-11-07

        + +

        Full Changelog

        + +

        Deprecations:

        + +
          +
        • Deprecate have, have_at_least and have_at_most. You can continue using those +matchers through https://github.com/rspec/rspec-collection_matchers, or +you can rewrite your expectations with something like +expect(your_object.size).to eq(num). (Hugo Baraúna)
        • +
        • Deprecate be_xyz predicate matcher when xyz? is a private method. +(Jon Rowe)
        • +
        • Deprecate be_true/be_false in favour of be_truthy/be_falsey +(for Ruby's conditional semantics) or be true/be false +(for exact equality). (Sam Phippen)
        • +
        • Deprecate calling helper methods from a custom matcher with the wrong +scope. (Myron Marston) + +
            +
          • def self.foo / extend Helper can be used to add macro methods +(e.g. methods that call the custom matcher DSL methods), but should +not be used to define helper methods called from within the DSL +blocks.
          • +
          • def foo / include Helper is the opposite: it's for helper methods +callable from within a DSL block, but not for defining macros.
          • +
          • RSpec 2.x allowed helper methods defined either way to be used for +either purpose, but RSpec 3.0 will not.
          • +
        • +
        + +

        2.14.5 / 2014-02-01

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix wrong matcher descriptions with falsey expected value +(yujinakayama)
        • +
        + +

        2.14.4 / 2013-11-06

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Make the match matcher produce a diff output. (Jon Rowe, Ben Moss)
        • +
        • Choose encoding for diff's more intelligently, and when all else fails fall +back to default internal encoding with replacing characters. (Jon Rowe)
        • +
        + +

        2.14.3 / 2013-09-22

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix operator matchers (should syntax) when method is redefined on target. +(Brandon Turner)
        • +
        • Fix diffing of hashes with object based keys. (Jon Rowe)
        • +
        • Fix operator matchers (should syntax) when operator is defined via +method_missing (Jon Rowe)
        • +
        + +

        2.14.2 / 2013-08-14

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix be_<predicate> matcher to not support operator chaining like the +be matcher does (e.g. be == 5). This led to some odd behaviors +since be_<predicate> == anything returned a BeComparedTo matcher +and was thus always truthy. This was a consequence of the implementation +(e.g. subclassing the basic Be matcher) and was not intended behavior. +(Myron Marston).
        • +
        • Fix change matcher to compare using == in addition to ===. This +is important for an expression like: +expect {}.to change { a.class }.from(ClassA).to(ClassB) because +SomeClass === SomeClass returns false. (Myron Marston)
        • +
        + +

        2.14.1 / 2013-08-08

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Ensure diff output uses the same encoding as the encoding of +the string being diff'd to prevent Encoding::UndefinedConversionError +errors (Jon Rowe).
        • +
        + +

        2.14.0 / 2013-07-06

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Values that are not matchers use #inspect, rather than #description for +documentation output (Andy Lindeman, Sam Phippen).
        • +
        • Make expect(a).to be_within(x).percent_of(y) work with negative y +(Katsuhiko Nishimra).
        • +
        • Make the be_predicate matcher work as expected used with expect{...}.to +change... (Sam Phippen).
        • +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Enhance yield_control so that you can specify an exact or relative +number of times: expect { }.to yield_control.exactly(3).times, +expect { }.to yield_control.at_least(2).times, etc (Bartek +Borkowski).
        • +
        • Make the differ that is used when an expectation fails better handle arrays +by splitting each element of the array onto its own line. (Sam Phippen)
        • +
        • Accept duck-typed strings that respond to :to_str as expectation messages. +(Toby Ovod-Everett)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix differ to not raise errors when dealing with differently-encoded +strings (Jon Rowe).
        • +
        • Fix expect(something).to be_within(x).percent_of(y) where x and y are both +integers (Sam Phippen).
        • +
        • Fix have matcher to handle the fact that on ruby 2.0, +Enumerator#size may return nil (Kenta Murata).
        • +
        • Fix expect { raise s }.to raise_error(s) where s is an error instance +on ruby 2.0 (Sam Phippen).
        • +
        • Fix expect(object).to raise_error passing. This now warns the user and +fails the spec (tomykaira).
        • +
        + +

        Deprecations

        + +
          +
        • Deprecate expect { }.not_to raise_error(SpecificErrorClass) or +expect { }.not_to raise_error("some specific message"). Using +these was prone to hiding failures as they would allow any other +error to pass. (Sam Phippen and David Chelimsky)
        • +
        + +

        2.13.0 / 2013-02-23

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Add support for percent deltas to be_within matcher: +expect(value).to be_within(10).percent_of(expected) +(Myron Marston).
        • +
        • Add support to include matcher to allow it to be given a list +of matchers as the expecteds to match against (Luke Redpath).
        • +
        + +

        Bug fixes

        + +
          +
        • Fix change matcher so that it dups strings in order to handle +mutated strings (Myron Marston).
        • +
        • Fix should be =~ /some regex/ / expect(...).to be =~ /some regex/. +Previously, these either failed with a confusing undefined method +matches?' for false:FalseClass error or were no-ops that didn't +actually verify anything (Myron Marston).
        • +
        • Add compatibility for diff-lcs 1.2 and relax the version +constraint (Peter Goldstein).
        • +
        • Fix DSL-generated matchers to allow multiple instances of the +same matcher in the same example to have different description +and failure messages based on the expected value (Myron Marston).
        • +
        • Prevent undefined method #split for Array error when dumping +the diff of an array of multiline strings (Myron Marston).
        • +
        • Don't blow up when comparing strings that are in an encoding +that is not ASCII compatible (Myron Marston).
        • +
        • Remove confusing "Check the implementation of #==" message +printed for empty diffs (Myron Marston).
        • +
        + +

        2.12.1 / 2012-12-15

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Improve the failure message for an expression like +{}.should =~ {}. (Myron Marston and Andy Lindeman)
        • +
        • Provide a match_regex alias so that custom matchers +built using the matcher DSL can use it (since match +is a different method in that context). +(Steven Harman)
        • +
        + +

        2.12.0 / 2012-11-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Colorize diffs if the --color option is configured. (Alex Coplan)
        • +
        • Include backtraces in unexpected errors handled by raise_error +matcher (Myron Marston)
        • +
        • Print a warning when users accidentally pass a non-string argument +as an expectation message (Sam Phippen)
        • +
        • =~ and match_array matchers output a more useful error message when +the actual value is not an array (or an object that responds to #to_ary) +(Sam Phippen)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix include matcher so that expect({}).to include(:a => nil) +fails as it should (Sam Phippen).
        • +
        • Fix be_an_instance_of matcher so that Class#to_s is used in the +description rather than Class#inspect, since some classes (like +ActiveRecord::Base) define a long, verbose #inspect. +(Tom Stuart)
        • +
        + +

        2.11.3 / 2012-09-04

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Fix (and deprecate) expect { }.should syntax so that it works even +though it was never a documented or intended syntax. It worked as a +consequence of the implementation of expect in RSpec 2.10 and +earlier. (Myron Marston)
        • +
        • Ensure #== is defined on built in matchers so that they can be composed. +For example:

          + +

          expect { + user.emailed! +}.to change { user.last_emailed_at }.to be_within(1.second).of(Time.zone.now)

        • +
        + +

        2.11.2 / 2012-07-25

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Define should and should_not on Object rather than BasicObject +on MacRuby. On MacRuby, BasicObject is defined but is not the root +of the object hierarchy. (Gabriel Gilder)
        • +
        + +

        2.11.1 / 2012-07-08

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Constrain actual in be_within matcher to values that respond to - instead +of requiring a specific type. + +
            +
          • Time, for example, is a legit alternative.
          • +
        • +
        + +

        2.11.0 / 2012-07-07

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Expand expect syntax so that it supports expections on bare values +in addition to blocks (Myron Marston).
        • +
        • Add configuration options to control available expectation syntaxes +(Myron Marston): + +
            +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :expect }
          • +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :should }
          • +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
          • +
          • RSpec.configuration.add_should_and_should_not_to Delegator
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • Allow only Numeric values to be the "actual" in the be_within matcher. +This prevents confusing error messages. (Su Zhang @zhangsu)
        • +
        • Define should and should_not on BasicObject rather than Kernel +on 1.9. This makes should and should_not work properly with +BasicObject-subclassed proxy objects like Delegator. (Myron +Marston)
        • +
        + +

        2.10.0 / 2012-05-03

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Add new start_with and end_with matchers (Jeremy Wadsack)
        • +
        • Add new matchers for specifying yields (Myron Marston): + +
            +
          • expect {...}.to yield_control
          • +
          • expect {...}.to yield_with_args(1, 2, 3)
          • +
          • expect {...}.to yield_with_no_args
          • +
          • expect {...}.to yield_successive_args(1, 2, 3)
          • +
        • +
        • match_unless_raises takes multiple exception args
        • +
        + +

        Bug fixes

        + +
          +
        • Fix be_within matcher to be inclusive of delta.
        • +
        • Fix message-specific specs to pass on Rubinius (John Firebaugh)
        • +
        + +

        2.9.1 / 2012-04-03

        + +

        Full Changelog

        + +

        Bug fixes

        + +
          +
        • Provide a helpful message if the diff between two objects is empty.
        • +
        • Fix bug diffing single strings with multiline strings.
        • +
        • Fix for error with using custom matchers inside other custom matchers +(mirasrael)
        • +
        • Fix using execution context methods in nested DSL matchers (mirasrael)
        • +
        + +

        2.9.0 / 2012-03-17

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce pollution +of RSpec::Matchers (which is included in every example).
        • +
        • Autoload files with matcher classes to improve load time.
        • +
        + +

        Bug fixes

        + +
          +
        • Align respond_to? and method_missing in DSL-defined matchers.
        • +
        • Clear out user-defined instance variables between invocations of DSL-defined +matchers.
        • +
        • Dup the instance of a DSL generated matcher so its state is not changed by +subsequent invocations.
        • +
        • Treat expected args consistently across positive and negative expectations +(thanks to Ralf Kistner for the heads up)
        • +
        + +

        2.8.0 / 2012-01-04

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Better diff output for Hash (Philippe Creux)
        • +
        • Eliminate Ruby warnings (Olek Janiszewski)
        • +
        + +

        2.8.0.rc2 / 2011-12-19

        + +

        Full Changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc1 / 2011-11-06

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Use classes for the built-in matchers (they're faster).
        • +
        • Eliminate Ruby warnings (Matijs van Zuijlen)
        • +
        + +

        2.7.0 / 2011-10-16

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • HaveMatcher converts argument using to_i (Alex Bepple & Pat Maddox)
        • +
        • Improved failure message for the have_xxx matcher (Myron Marston)
        • +
        • HaveMatcher supports count (Matthew Bellantoni)
        • +
        • Change matcher dups Enumerable before the action, supporting custom +Enumerable types like CollectionProxy in Rails (David Chelimsky)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix typo in have(n).xyz documentation (Jean Boussier)
        • +
        • fix safe_sort for ruby 1.9.2 (Kernel now defines <=> for Object) (Peter +van Hardenberg)
        • +
        + +

        2.6.0 / 2011-05-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • change matcher accepts regexps (Robert Davis)
        • +
        • better descriptions for have_xxx matchers (Magnus Bergmark)
        • +
        • range.should cover(*values) (Anders Furseth)
        • +
        + +

        Bug fixes

        + +
          +
        • Removed non-ascii characters that were choking rcov (Geoffrey Byers)
        • +
        • change matcher dups arrays and hashes so their before/after states can be +compared correctly.
        • +
        • Fix the order of inclusion of RSpec::Matchers in Test::Unit::TestCase and +MiniTest::Unit::TestCase to prevent a SystemStackError (Myron Marston)
        • +
        + +

        2.5.0 / 2011-02-05

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • should exist works with exist? or exists? (Myron Marston)
        • +
        • expect { ... }.not_to do_something (in addition to to_not)
        • +
        + +

        Documentation

        + +
          +
        • improved docs for raise_error matcher (James Almond)
        • +
        + +

        2.4.0 / 2011-01-02

        + +

        Full Changelog

        + +

        No functional changes in this release, which was made to align with the +rspec-core-2.4.0 release.

        + +

        Enhancements

        + +
          +
        • improved RDoc for change matcher (Jo Liss)
        • +
        + +

        2.3.0 / 2010-12-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • diff strings when include matcher fails (Mike Sassak)
        • +
        + +

        2.2.0 / 2010-11-28

        + +

        Full Changelog

        + +

        2.1.0 / 2010-11-07

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • be_within(delta).of(expected) matcher (Myron Marston)
        • +
        • Lots of new Cucumber features (Myron Marston)
        • +
        • Raise error if you try should != expected on Ruby-1.9 (Myron Marston)
        • +
        • Improved failure messages from throw_symbol (Myron Marston)
        • +
        + +

        Bug fixes

        + +
          +
        • Eliminate hard dependency on RSpec::Core (Myron Marston)
        • +
        • have_matcher - use pluralize only when ActiveSupport inflections are indeed +defined (Josep M Bach)
        • +
        • throw_symbol matcher no longer swallows exceptions (Myron Marston)
        • +
        • fix matcher chaining to avoid name collisions (Myron Marston)
        • +
        + +

        2.0.0 / 2010-10-10

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • Add match_for_should_not method to matcher DSL (Myron Marston)
        • +
        + +

        Bug fixes

        + +
          +
        • respond_to matcher works correctly with should_not with multiple methods +(Myron Marston)
        • +
        • include matcher works correctly with should_not with multiple values +(Myron Marston)
        • +
        + +

        2.0.0.rc / 2010-10-05

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • require 'rspec/expectations' in a T::U or MiniUnit suite (Josep M. Bach)
        • +
        + +

        Bug fixes

        + +
          +
        • change by 0 passes/fails correctly (Len Smith)
        • +
        • Add description to satisfy matcher
        • +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        Full Changelog

        + +

        Enhancements

        + +
          +
        • diffing improvements + +
            +
          • diff multiline strings
          • +
          • don't diff single line strings
          • +
          • don't diff numbers (silly)
          • +
          • diff regexp + multiline string
          • +
        • +
        + +

        Bug fixes + * should[_not] change now handles boolean values correctly

        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/file.License.html b/source/documentation/2.99/rspec-expectations/file.License.html new file mode 100644 index 000000000..ccc479aae --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/file.README.html b/source/documentation/2.99/rspec-expectations/file.README.html new file mode 100644 index 000000000..fc1f9a527 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/file.README.html @@ -0,0 +1,248 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        RSpec Expectations Build Status Code Climate

        + +

        RSpec::Expectations lets you express expected outcomes on an object in an +example.

        + +
        expect(.balance).to eq(Money.new(37.42, :USD))
        +
        + +

        Install

        + +

        If you want to use rspec-expectations with rspec, just install the rspec gem +and RubyGems will also install rspec-expectations for you (along with +rspec-core and rspec-mocks):

        + +
        gem install rspec
        +
        + +

        If you want to use rspec-expectations with another tool, like Test::Unit, +Minitest, or Cucumber, you can install it directly:

        + +
        gem install rspec-expectations
        +
        + +

        Basic usage

        + +

        Here's an example using rspec-core:

        + +
        describe Order do
        +  it "sums the prices of the items in its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        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 +expresses an expected outcome. If order.total == Money.new(5.55, :USD), then +the example passes. If not, it fails with a message like:

        + +
        expected: #<Money @value=5.55 @currency=:USD>
        +     got: #<Money @value=1.11 @currency=:USD>
        +
        + +

        Built-in matchers

        + +

        Equivalence

        + +
        expect(actual).to eq(expected)  # passes if actual == expected
        +expect(actual).to eql(expected) # passes if actual.eql?(expected)
        +
        + +

        Note: The new expect syntax no longer supports == matcher.

        + +

        Identity

        + +
        expect(actual).to be(expected)    # passes if actual.equal?(expected)
        +expect(actual).to equal(expected) # passes if actual.equal?(expected)
        +
        + +

        Comparisons

        + +
        expect(actual).to be >  expected
        +expect(actual).to be >= expected
        +expect(actual).to be <= expected
        +expect(actual).to be <  expected
        +expect(actual).to be_within(delta).of(expected)
        +
        + +

        Regular expressions

        + +
        expect(actual).to match(/expression/)
        +
        + +

        Note: The new expect syntax no longer supports =~ matcher.

        + +

        Types/classes

        + +
        expect(actual).to be_an_instance_of(expected)
        +expect(actual).to be_a_kind_of(expected)
        +
        + +

        Truthiness

        + +
        expect(actual).to be_true  # passes if actual is truthy (not nil or false)
        +expect(actual).to be_false # passes if actual is falsy (nil or false)
        +expect(actual).to be_nil   # passes if actual is nil
        +
        + +

        Expecting errors

        + +
        expect { ... }.to raise_error
        +expect { ... }.to raise_error(ErrorClass)
        +expect { ... }.to raise_error("message")
        +expect { ... }.to raise_error(ErrorClass, "message")
        +
        + +

        Expecting throws

        + +
        expect { ... }.to throw_symbol
        +expect { ... }.to throw_symbol(:symbol)
        +expect { ... }.to throw_symbol(:symbol, 'value')
        +
        + +

        Yielding

        + +
        expect { |b| 5.tap(&b) }.to yield_control # passes regardless of yielded args
        +
        +expect { |b| yield_if_true(true, &b) }.to yield_with_no_args # passes only if no args are yielded
        +
        +expect { |b| 5.tap(&b) }.to yield_with_args(5)
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum)
        +expect { |b| "a string".tap(&b) }.to yield_with_args(/str/)
        +
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +
        + +

        Predicate matchers

        + +
        expect(actual).to be_xxx         # passes if actual.xxx?
        +expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
        +
        + +

        Ranges (Ruby >= 1.9 only)

        + +
        expect(1..10).to cover(3)
        +
        + +

        Collection membership

        + +
        expect(actual).to include(expected)
        +expect(actual).to start_with(expected)
        +expect(actual).to end_with(expected)
        +
        + +

        Examples

        + +
        expect([1,2,3]).to include(1)
        +expect([1,2,3]).to include(1, 2)
        +expect([1,2,3]).to start_with(1)
        +expect([1,2,3]).to start_with(1,2)
        +expect([1,2,3]).to end_with(3)
        +expect([1,2,3]).to end_with(2,3)
        +expect({:a => 'b'}).to include(:a => 'b')
        +expect("this string").to include("is str")
        +expect("this string").to start_with("this")
        +expect("this string").to end_with("ring")
        +
        + +

        should syntax

        + +

        In addition to the expect syntax, rspec-expectations continues to support the +should syntax:

        + +
        actual.should eq expected
        +actual.should be > 3
        +[1, 2, 3].should_not include 4
        +
        + +

        See detailed information on the should syntax and its usage.

        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/file_list.html b/source/documentation/2.99/rspec-expectations/file_list.html new file mode 100644 index 000000000..ac9df6c7e --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/file_list.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-expectations/frames.html b/source/documentation/2.99/rspec-expectations/frames.html new file mode 100644 index 000000000..43d89f7b9 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.4 + + + + diff --git a/source/documentation/2.99/rspec-expectations/index.html b/source/documentation/2.99/rspec-expectations/index.html new file mode 100644 index 000000000..fc1f9a527 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/index.html @@ -0,0 +1,248 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        RSpec Expectations Build Status Code Climate

        + +

        RSpec::Expectations lets you express expected outcomes on an object in an +example.

        + +
        expect(.balance).to eq(Money.new(37.42, :USD))
        +
        + +

        Install

        + +

        If you want to use rspec-expectations with rspec, just install the rspec gem +and RubyGems will also install rspec-expectations for you (along with +rspec-core and rspec-mocks):

        + +
        gem install rspec
        +
        + +

        If you want to use rspec-expectations with another tool, like Test::Unit, +Minitest, or Cucumber, you can install it directly:

        + +
        gem install rspec-expectations
        +
        + +

        Basic usage

        + +

        Here's an example using rspec-core:

        + +
        describe Order do
        +  it "sums the prices of the items in its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        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 +expresses an expected outcome. If order.total == Money.new(5.55, :USD), then +the example passes. If not, it fails with a message like:

        + +
        expected: #<Money @value=5.55 @currency=:USD>
        +     got: #<Money @value=1.11 @currency=:USD>
        +
        + +

        Built-in matchers

        + +

        Equivalence

        + +
        expect(actual).to eq(expected)  # passes if actual == expected
        +expect(actual).to eql(expected) # passes if actual.eql?(expected)
        +
        + +

        Note: The new expect syntax no longer supports == matcher.

        + +

        Identity

        + +
        expect(actual).to be(expected)    # passes if actual.equal?(expected)
        +expect(actual).to equal(expected) # passes if actual.equal?(expected)
        +
        + +

        Comparisons

        + +
        expect(actual).to be >  expected
        +expect(actual).to be >= expected
        +expect(actual).to be <= expected
        +expect(actual).to be <  expected
        +expect(actual).to be_within(delta).of(expected)
        +
        + +

        Regular expressions

        + +
        expect(actual).to match(/expression/)
        +
        + +

        Note: The new expect syntax no longer supports =~ matcher.

        + +

        Types/classes

        + +
        expect(actual).to be_an_instance_of(expected)
        +expect(actual).to be_a_kind_of(expected)
        +
        + +

        Truthiness

        + +
        expect(actual).to be_true  # passes if actual is truthy (not nil or false)
        +expect(actual).to be_false # passes if actual is falsy (nil or false)
        +expect(actual).to be_nil   # passes if actual is nil
        +
        + +

        Expecting errors

        + +
        expect { ... }.to raise_error
        +expect { ... }.to raise_error(ErrorClass)
        +expect { ... }.to raise_error("message")
        +expect { ... }.to raise_error(ErrorClass, "message")
        +
        + +

        Expecting throws

        + +
        expect { ... }.to throw_symbol
        +expect { ... }.to throw_symbol(:symbol)
        +expect { ... }.to throw_symbol(:symbol, 'value')
        +
        + +

        Yielding

        + +
        expect { |b| 5.tap(&b) }.to yield_control # passes regardless of yielded args
        +
        +expect { |b| yield_if_true(true, &b) }.to yield_with_no_args # passes only if no args are yielded
        +
        +expect { |b| 5.tap(&b) }.to yield_with_args(5)
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum)
        +expect { |b| "a string".tap(&b) }.to yield_with_args(/str/)
        +
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +
        + +

        Predicate matchers

        + +
        expect(actual).to be_xxx         # passes if actual.xxx?
        +expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
        +
        + +

        Ranges (Ruby >= 1.9 only)

        + +
        expect(1..10).to cover(3)
        +
        + +

        Collection membership

        + +
        expect(actual).to include(expected)
        +expect(actual).to start_with(expected)
        +expect(actual).to end_with(expected)
        +
        + +

        Examples

        + +
        expect([1,2,3]).to include(1)
        +expect([1,2,3]).to include(1, 2)
        +expect([1,2,3]).to start_with(1)
        +expect([1,2,3]).to start_with(1,2)
        +expect([1,2,3]).to end_with(3)
        +expect([1,2,3]).to end_with(2,3)
        +expect({:a => 'b'}).to include(:a => 'b')
        +expect("this string").to include("is str")
        +expect("this string").to start_with("this")
        +expect("this string").to end_with("ring")
        +
        + +

        should syntax

        + +

        In addition to the expect syntax, rspec-expectations continues to support the +should syntax:

        + +
        actual.should eq expected
        +actual.should be > 3
        +[1, 2, 3].should_not include 4
        +
        + +

        See detailed information on the should syntax and its usage.

        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.99/rspec-expectations/method_list.html b/source/documentation/2.99/rspec-expectations/method_list.html new file mode 100644 index 000000000..15a1075b2 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/method_list.html @@ -0,0 +1,1847 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/2.99/rspec-expectations/top-level-namespace.html b/source/documentation/2.99/rspec-expectations/top-level-namespace.html new file mode 100644 index 000000000..58d3c42c6 --- /dev/null +++ b/source/documentation/2.99/rspec-expectations/top-level-namespace.html @@ -0,0 +1,138 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + +
        Extended by:
        +
        RSpec::Expectations::DeprecatedConstants, RSpec::Matchers::DSL
        + + + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: RSpec + + + + +

        + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from RSpec::Expectations::DeprecatedConstants

        +

        const_missing

        + + + + + + + + + +

        Methods included from RSpec::Matchers::DSL

        +

        define

        + + +
        + + + + + \ No newline at end of file From 95184f18512f5ac98c5dcc11637a6a29dfa8230f Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:31:37 +1100 Subject: [PATCH 13/14] rspec-mocks 2.14 documentation --- .../2.14/rspec-mocks/Backports.html | 212 ++ .../2.14/rspec-mocks/Kernel.html | 234 ++ .../2.14/rspec-mocks/Marshal.html | 232 ++ .../2.14/rspec-mocks/Method.html | 193 ++ .../documentation/2.14/rspec-mocks/Proc.html | 211 ++ .../documentation/2.14/rspec-mocks/RSpec.html | 129 + .../2.14/rspec-mocks/RSpec/CallerFilter.html | 276 ++ .../2.14/rspec-mocks/RSpec/Mocks.html | 1113 ++++++++ .../RSpec/Mocks/AllowanceTarget.html | 151 ++ .../rspec-mocks/RSpec/Mocks/AnyInstance.html | 117 + .../RSpec/Mocks/AnyInstance/Chain.html | 299 +++ .../AnyInstance/Chain/Customizations.html | 1187 +++++++++ .../Mocks/AnyInstance/ExpectationChain.html | 329 +++ .../RSpec/Mocks/AnyInstance/Recorder.html | 831 ++++++ .../Mocks/AnyInstanceAllowanceTarget.html | 151 ++ .../Mocks/AnyInstanceExpectationTarget.html | 151 ++ .../RSpec/Mocks/ArgumentListMatcher.html | 422 ++++ .../RSpec/Mocks/ArgumentMatchers.html | 850 +++++++ .../Mocks/ArgumentMatchers/AnyArgMatcher.html | 258 ++ .../ArgumentMatchers/AnyArgsMatcher.html | 189 ++ .../ArgumentMatchers/BooleanMatcher.html | 258 ++ .../ArgumentMatchers/DuckTypeMatcher.html | 260 ++ .../Mocks/ArgumentMatchers/EqualityProxy.html | 284 +++ .../HashExcludingMatcher.html | 316 +++ .../HashIncludingMatcher.html | 316 +++ .../Mocks/ArgumentMatchers/InstanceOf.html | 260 ++ .../RSpec/Mocks/ArgumentMatchers/KindOf.html | 260 ++ .../ArgumentMatchers/MatcherMatcher.html | 260 ++ .../Mocks/ArgumentMatchers/NoArgsMatcher.html | 189 ++ .../Mocks/ArgumentMatchers/RegexpMatcher.html | 260 ++ .../RSpec/Mocks/Configuration.html | 768 ++++++ .../rspec-mocks/RSpec/Mocks/Constant.html | 1163 +++++++++ .../RSpec/Mocks/ConstantMutator.html | 912 +++++++ .../Mocks/ConstantMutator/BaseMutator.html | 479 ++++ .../Mocks/ConstantMutator/ConstantHider.html | 396 +++ .../DefinedConstantReplacer.html | 594 +++++ .../UndefinedConstantSetter.html | 414 +++ .../rspec-mocks/RSpec/Mocks/Deprecation.html | 109 + .../2.14/rspec-mocks/RSpec/Mocks/Double.html | 145 ++ .../RSpec/Mocks/ExampleMethods.html | 898 +++++++ .../Mocks/ExampleMethods/ExpectHost.html | 117 + .../RSpec/Mocks/ExpectationTarget.html | 151 ++ .../rspec-mocks/RSpec/Mocks/Matchers.html | 117 + .../RSpec/Mocks/Matchers/HaveReceived.html | 548 ++++ .../RSpec/Mocks/Matchers/Receive.html | 556 ++++ .../Mocks/Matchers/Receive/Customization.html | 264 ++ .../RSpec/Mocks/MessageExpectation.html | 2242 +++++++++++++++++ .../RSpec/Mocks/RecursiveConstMethods.html | 590 +++++ .../2.14/rspec-mocks/RSpec/Mocks/Space.html | 1135 +++++++++ .../2.14/rspec-mocks/RSpec/Mocks/Syntax.html | 2059 +++++++++++++++ .../rspec-mocks/RSpec/Mocks/TargetBase.html | 353 +++ .../rspec-mocks/RSpec/Mocks/TestDouble.html | 693 +++++ .../RSpec/Mocks/TestDoubleProxy.html | 199 ++ .../2.14/rspec-mocks/RSpec/Mocks/Version.html | 117 + .../2.14/rspec-mocks/_index.html | 603 +++++ .../2.14/rspec-mocks/class_list.html | 58 + .../2.14/rspec-mocks/file.Changelog.html | 837 ++++++ .../2.14/rspec-mocks/file.License.html | 73 + .../2.14/rspec-mocks/file.README.html | 385 +++ .../2.14/rspec-mocks/file_list.html | 66 + .../2.14/rspec-mocks/frames.html | 26 + .../documentation/2.14/rspec-mocks/index.html | 385 +++ .../2.14/rspec-mocks/method_list.html | 1401 ++++++++++ .../2.14/rspec-mocks/top-level-namespace.html | 114 + 64 files changed, 29165 insertions(+) create mode 100644 source/documentation/2.14/rspec-mocks/Backports.html create mode 100644 source/documentation/2.14/rspec-mocks/Kernel.html create mode 100644 source/documentation/2.14/rspec-mocks/Marshal.html create mode 100644 source/documentation/2.14/rspec-mocks/Method.html create mode 100644 source/documentation/2.14/rspec-mocks/Proc.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/CallerFilter.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/AllowanceTarget.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Chain.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Chain/Customizations.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/ExpectationChain.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstanceAllowanceTarget.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstanceExpectationTarget.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgsMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/BooleanMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/DuckTypeMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/EqualityProxy.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashExcludingMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashIncludingMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/InstanceOf.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/KindOf.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/MatcherMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/NoArgsMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/RegexpMatcher.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Configuration.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Constant.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/BaseMutator.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/ConstantHider.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/DefinedConstantReplacer.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/UndefinedConstantSetter.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Deprecation.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Double.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExampleMethods.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExpectationTarget.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/HaveReceived.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/Receive.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/Receive/Customization.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/MessageExpectation.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/RecursiveConstMethods.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Space.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Syntax.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/TargetBase.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/TestDouble.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/TestDoubleProxy.html create mode 100644 source/documentation/2.14/rspec-mocks/RSpec/Mocks/Version.html create mode 100644 source/documentation/2.14/rspec-mocks/_index.html create mode 100644 source/documentation/2.14/rspec-mocks/class_list.html create mode 100644 source/documentation/2.14/rspec-mocks/file.Changelog.html create mode 100644 source/documentation/2.14/rspec-mocks/file.License.html create mode 100644 source/documentation/2.14/rspec-mocks/file.README.html create mode 100644 source/documentation/2.14/rspec-mocks/file_list.html create mode 100644 source/documentation/2.14/rspec-mocks/frames.html create mode 100644 source/documentation/2.14/rspec-mocks/index.html create mode 100644 source/documentation/2.14/rspec-mocks/method_list.html create mode 100644 source/documentation/2.14/rspec-mocks/top-level-namespace.html diff --git a/source/documentation/2.14/rspec-mocks/Backports.html b/source/documentation/2.14/rspec-mocks/Backports.html new file mode 100644 index 000000000..0091ac5d5 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/Backports.html @@ -0,0 +1,212 @@ + + + + + + Module: Backports + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: Backports + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/proc.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) alias_method_chain(mod, target, feature) + + + + + +

        + + + + +
        +
        +
        +
        +3
        +4
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 3
        +
        +def self.alias_method_chain(mod, target, feature)
        +  mod.class_eval do
        +    # Strip out punctuation on predicates or bang methods since
        +    # e.g. target?_without_feature is not a valid method name.
        +    aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
        +    yield(aliased_target, punctuation) if block_given?
        +
        +    with_method, without_method = "#{aliased_target}_with_#{feature}#{punctuation}", "#{aliased_target}_without_#{feature}#{punctuation}"
        +
        +    alias_method without_method, target
        +    alias_method target, with_method
        +
        +    case
        +      when public_method_defined?(without_method)
        +        public target
        +      when protected_method_defined?(without_method)
        +        protected target
        +      when private_method_defined?(without_method)
        +        private target
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/Kernel.html b/source/documentation/2.14/rspec-mocks/Kernel.html new file mode 100644 index 000000000..018f5f9cc --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/Kernel.html @@ -0,0 +1,234 @@ + + + + + + Module: Kernel + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: Kernel + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/proc.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) lambda_with_lambda_tracking(&block) + + + + + +

        + + + + +
        +
        +
        +
        +48
        +49
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 48
        +
        +def lambda_with_lambda_tracking(&block)
        +  l = lambda_without_lambda_tracking(&block)
        +  l.send :__is_lambda__=, true unless block.send(:__is_lambda__) == false
        +  l
        +end
        +
        +
        + +
        +

        + + - (Object) proc_with_lambda_tracking(&block) + + + + + +

        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 54
        +
        +def proc_with_lambda_tracking(&block)
        +  l = proc_without_lambda_tracking(&block)
        +  l.send :__is_lambda__=, block.send(:__is_lambda__) == true
        +  l
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/Marshal.html b/source/documentation/2.14/rspec-mocks/Marshal.html new file mode 100644 index 000000000..808dfbd63 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/Marshal.html @@ -0,0 +1,232 @@ + + + + + + Module: Marshal + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: Marshal + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/marshal.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) dump_with_mocks(object, *rest) + + + + Also known as: + dump + + + + +

        +
        + +

        Duplicates any mock objects before serialization. Otherwise, serialization +will fail because methods exist on the singleton class.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/mocks/extensions/marshal.rb', line 5
        +
        +def dump_with_mocks(object, *rest)
        +  if ::RSpec::Mocks.space.nil? || !::RSpec::Mocks.space.registered?(object) || NilClass === object
        +    dump_without_mocks(object, *rest)
        +  else
        +    unless ::RSpec::Mocks.configuration.marshal_patched?
        +      RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, ''))
        +        |Using Marshal.dump on stubbed objects relies on a monkey-patch
        +        |that is being made opt-in in RSpec 3. To silence this warning
        +        |please explicitly enable it:
        +        |
        +        |RSpec.configure do |rspec|
        +        |  rspec.mock_with :rspec do |mocks|
        +        |    mocks.patch_marshal_to_support_partial_doubles = true
        +        |  end
        +        |end
        +        |
        +        |Called from #{RSpec::CallerFilter.first_non_rspec_line}."
        +      EOS
        +    end
        +    dump_without_mocks(object.dup, *rest)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/Method.html b/source/documentation/2.14/rspec-mocks/Method.html new file mode 100644 index 000000000..178a2fd85 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/Method.html @@ -0,0 +1,193 @@ + + + + + + Class: Method + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: Method + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/proc.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) to_proc_with_lambda_tracking + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 39
        +
        +def to_proc_with_lambda_tracking
        +  proc = to_proc_without_lambda_tracking
        +  proc.send :__is_lambda__=, true
        +  proc
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/Proc.html b/source/documentation/2.14/rspec-mocks/Proc.html new file mode 100644 index 000000000..5c6eb3165 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/Proc.html @@ -0,0 +1,211 @@ + + + + + + Class: Proc + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: Proc + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/extensions/proc.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) lambda? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/mocks/extensions/proc.rb', line 29
        +
        +def lambda?
        +  !!__is_lambda__
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec.html b/source/documentation/2.14/rspec-mocks/RSpec.html new file mode 100644 index 000000000..3150dc328 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec.html @@ -0,0 +1,129 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec + + + +

        + +
        + + + +
        Extended by:
        +
        Mocks::Deprecation
        + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks.rb,
        + lib/rspec/mocks/mock.rb,
        lib/rspec/mocks/space.rb,
        lib/rspec/mocks/proxy.rb,
        lib/rspec/mocks/syntax.rb,
        lib/rspec/mocks/errors.rb,
        lib/rspec/mocks/version.rb,
        lib/rspec/mocks/targets.rb,
        lib/rspec/mocks/stub_chain.rb,
        lib/rspec/mocks/deprecation.rb,
        lib/rspec/mocks/test_double.rb,
        lib/rspec/mocks/order_group.rb,
        lib/rspec/mocks/mutate_const.rb,
        lib/rspec/mocks/method_double.rb,
        lib/rspec/mocks/proxy_for_nil.rb,
        lib/rspec/mocks/configuration.rb,
        lib/rspec/mocks/caller_filter.rb,
        lib/rspec/mocks/error_generator.rb,
        lib/rspec/mocks/example_methods.rb,
        lib/rspec/mocks/matchers/receive.rb,
        lib/rspec/mocks/argument_matchers.rb,
        lib/rspec/mocks/any_instance/chain.rb,
        lib/rspec/mocks/message_expectation.rb,
        lib/rspec/mocks/any_instance/recorder.rb,
        lib/rspec/mocks/argument_list_matcher.rb,
        lib/rspec/mocks/matchers/have_received.rb,
        lib/rspec/mocks/any_instance/stub_chain.rb,
        lib/rspec/mocks/instance_method_stasher.rb,
        lib/rspec/mocks/extensions/instance_exec.rb,
        lib/rspec/mocks/any_instance/message_chains.rb,
        lib/rspec/mocks/any_instance/stub_chain_chain.rb,
        lib/rspec/mocks/any_instance/expectation_chain.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Mocks + + + + Classes: CallerFilter + + +

        + + + + + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/CallerFilter.html b/source/documentation/2.14/rspec-mocks/RSpec/CallerFilter.html new file mode 100644 index 000000000..c701e70a0 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/CallerFilter.html @@ -0,0 +1,276 @@ + + + + + + Class: RSpec::CallerFilter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::CallerFilter + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/caller_filter.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        RSPEC_LIBS = + +
        +
        %w[
        +core
        +mocks
        +expectations
        +matchers
        +rails
        + +
        ADDITIONAL_TOP_LEVEL_FILES = + +
        +
        %w[ autorun ]
        + +
        LIB_REGEX = + +
        +
        %r{/lib/rspec/(#{(RSPEC_LIBS + ADDITIONAL_TOP_LEVEL_FILES).join('|')})(\.rb|/)}
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) first_non_rspec_line + + + + + +

        +
        + +

        Earlier rubies do not support the two argument form of caller. +This fallback is logically the same, but slower.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/mocks/caller_filter.rb', line 53
        +
        +def self.first_non_rspec_line
        +  # `caller` is an expensive method that scales linearly with the size of
        +  # the stack. The performance hit for fetching it in chunks is small,
        +  # and since the target line is probably near the top of the stack, the
        +  # overall improvement of a chunked search like this is significant.
        +  #
        +  # See benchmarks/caller.rb for measurements.
        +
        +  # Initial value here is mostly arbitrary, but is chosen to give good
        +  # performance on the common case of creating a double.
        +  increment = 5
        +  i         = 1
        +  line      = nil
        +
        +  while !line
        +    stack = caller(i, increment)
        +    return nil unless stack
        +
        +    line = stack.find { |l| l !~ LIB_REGEX }
        +
        +    i         += increment
        +    increment *= 2 # The choice of two here is arbitrary.
        +  end
        +
        +  line
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks.html new file mode 100644 index 000000000..5117fe605 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks.html @@ -0,0 +1,1113 @@ + + + + + + Module: RSpec::Mocks + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks.rb,
        + lib/rspec/mocks/mock.rb,
        lib/rspec/mocks/space.rb,
        lib/rspec/mocks/proxy.rb,
        lib/rspec/mocks/syntax.rb,
        lib/rspec/mocks/errors.rb,
        lib/rspec/mocks/version.rb,
        lib/rspec/mocks/targets.rb,
        lib/rspec/mocks/stub_chain.rb,
        lib/rspec/mocks/deprecation.rb,
        lib/rspec/mocks/test_double.rb,
        lib/rspec/mocks/order_group.rb,
        lib/rspec/mocks/mutate_const.rb,
        lib/rspec/mocks/method_double.rb,
        lib/rspec/mocks/proxy_for_nil.rb,
        lib/rspec/mocks/configuration.rb,
        lib/rspec/mocks/error_generator.rb,
        lib/rspec/mocks/example_methods.rb,
        lib/rspec/mocks/matchers/receive.rb,
        lib/rspec/mocks/argument_matchers.rb,
        lib/rspec/mocks/any_instance/chain.rb,
        lib/rspec/mocks/message_expectation.rb,
        lib/rspec/mocks/any_instance/recorder.rb,
        lib/rspec/mocks/argument_list_matcher.rb,
        lib/rspec/mocks/matchers/have_received.rb,
        lib/rspec/mocks/any_instance/stub_chain.rb,
        lib/rspec/mocks/instance_method_stasher.rb,
        lib/rspec/mocks/extensions/instance_exec.rb,
        lib/rspec/mocks/any_instance/message_chains.rb,
        lib/rspec/mocks/any_instance/stub_chain_chain.rb,
        lib/rspec/mocks/any_instance/expectation_chain.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: AnyInstance, ArgumentMatchers, Deprecation, ExampleMethods, Matchers, RecursiveConstMethods, Syntax, TestDouble, Version + + + + Classes: AllowanceTarget, AnyInstanceAllowanceTarget, AnyInstanceExpectationTarget, ArgumentListMatcher, Configuration, Constant, ConstantMutator, Double, ExpectationTarget, MessageExpectation, Space, TargetBase, TestDoubleProxy + + +

        + +

        Constant Summary

        + +
        + +
        KERNEL_METHOD_METHOD = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        +
        +
        ::Kernel.instance_method(:method)
        + +
        DEPRECATED_CONSTANTS = + +
        +
        {
        +  :Mock            => Double,
        +  :ConstantStubber => ConstantMutator,
        +}
        + +
        UnsupportedMatcherError = + +
        +
        Class.new(StandardError)
        + +
        NegationUnsupportedError = + +
        +
        Class.new(StandardError)
        + +
        + + + + + +

        Class Attribute Summary (collapse)

        +
          + +
        • + + + + (Object) space + + + + + + + + + + + + + + + + +
          +

          Returns the value of attribute space.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + +
        +

        Class Attribute Details

        + + + +
        +

        + + + (Object) space + + + + + +

        +
        + +

        Returns the value of attribute space

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/mocks.rb', line 7
        +
        +def space
        +  @space
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) allow_message(subject, message, opts = {}, &block) + + + + + +

        +
        + +

        Adds an allowance (stub) on subject

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        +

        Defines the implementation of foo on bar, using +the passed block

        +

        + +
        x = 0
        +RSpec::Mocks.allow_message(bar, :foo) { x += 1 }
        + +
        +

        Parameters:

        +
          + +
        • + + subject + + + + + + + — +
          +

          the subject to which the message will be added

          +
          + +
        • + +
        • + + message + + + + + + + — +
          +

          a symbol, representing the message that will be added.

          +
          + +
        • + +
        • + + opts + + + + + + (defaults to: {}) + + + — +
          +

          a hash of options, :expected_from is used to set the original call site

          +
          + +
        • + +
        • + + block + + + + + + + — +
          +

          an optional implementation for the allowance

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/mocks.rb', line 59
        +
        +def allow_message(subject, message, opts={}, &block)
        +  orig_caller = opts.fetch(:expected_from) {
        +    CallerFilter.first_non_rspec_line
        +  }
        +  ::RSpec::Mocks.proxy_for(subject).
        +    add_stub(orig_caller, message.to_sym, opts, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) any_instance_recorder_for(klass) + + + + + +

        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/mocks.rb', line 43
        +
        +def any_instance_recorder_for(klass)
        +  space.any_instance_recorder_for(klass)
        +end
        +
        +
        + +
        +

        + + + (Object) configuration + + + + + +

        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 76
        +
        +def self.configuration
        +  @configuration ||= Configuration.new
        +end
        +
        +
        + +
        +

        + + + (Object) const_missing(name) + + + + + +

        + + + + +
        +
        +
        +
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +
        +
        # File 'lib/rspec/mocks.rb', line 117
        +
        +def self.const_missing(name)
        +  if const = DEPRECATED_CONSTANTS[name]
        +    RSpec.deprecate("RSpec::Mocks::#{name}", :replacement => const.name)
        +    const
        +  else
        +    super
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) expect_message(subject, message, opts = {}, &block) + + + + + +

        +
        + +

        Sets a message expectation on subject.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +

        +

        Expect the message foo to receive bar, then call +it

        +

        + +
        RSpec::Mocks.expect_message(bar, :foo)
        +bar.foo
        + +
        +

        Parameters:

        +
          + +
        • + + subject + + + + + + + — +
          +

          the subject on which the message will be expected

          +
          + +
        • + +
        • + + message + + + + + + + — +
          +

          a symbol, representing the message that will be expected.

          +
          + +
        • + +
        • + + opts + + + + + + (defaults to: {}) + + + — +
          +

          a hash of options, :expected_from is used to set the original call site

          +
          + +
        • + +
        • + + block + + + + + + + — +
          +

          an optional implementation for the expectation

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/mocks.rb', line 78
        +
        +def expect_message(subject, message, opts={}, &block)
        +  orig_caller = opts.fetch(:expected_from) {
        +    CallerFilter.first_non_rspec_line
        +  }
        +  ::RSpec::Mocks.proxy_for(subject).
        +    add_message_expectation(orig_caller, message.to_sym, opts, &block)
        +end
        +
        +
        + +
        +

        + + + (Object) method_handle_for(object, method_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Used internally to get a method handle for a particular object and method +name.

        + +

        Includes handling for a few special cases:

        +
        • +

          Objects that redefine #method (e.g. an HTTPRequest struct)

          +
        • +

          BasicObject subclasses that mixin a Kernel dup (e.g. SimpleDelegator)

          +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/mocks.rb', line 97
        +
        +def method_handle_for(object, method_name)
        +  if ::Kernel === object
        +    KERNEL_METHOD_METHOD.bind(object).call(method_name)
        +  else
        +    object.method(method_name)
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) proxies_of(klass) + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/mocks.rb', line 39
        +
        +def proxies_of(klass)
        +  space.proxies_of(klass)
        +end
        +
        +
        + +
        +

        + + + (Object) proxy_for(object) + + + + + +

        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/mocks.rb', line 35
        +
        +def proxy_for(object)
        +  space.proxy_for(object)
        +end
        +
        +
        + +
        +

        + + + (Object) setup(host = nil) + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/mocks.rb', line 9
        +
        +def setup(host=nil)
        +  host_is_from_rspec_core = defined?(::RSpec::Core::ExampleGroup) && host.is_a?(::RSpec::Core::ExampleGroup)
        +  if host
        +    unless host_is_from_rspec_core
        +      RSpec.deprecate(
        +        "The host argument to `RSpec::Mocks.setup`",
        +        :replacement => "`include RSpec::Mocks::ExampleMethods` in #{host.inspect}"
        +      )
        +    end
        +
        +    (class << host; self; end).class_eval do
        +      include RSpec::Mocks::ExampleMethods
        +    end
        +  end
        +  space.outside_example = false
        +end
        +
        +
        + +
        +

        + + + (Object) teardown + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/mocks.rb', line 30
        +
        +def teardown
        +  space.reset_all
        +  space.outside_example = true
        +end
        +
        +
        + +
        +

        + + + (Object) verify + + + + + +

        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/mocks.rb', line 26
        +
        +def verify
        +  space.verify_all
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AllowanceTarget.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AllowanceTarget.html new file mode 100644 index 000000000..373ea2e0f --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AllowanceTarget.html @@ -0,0 +1,151 @@ + + + + + + Class: RSpec::Mocks::AllowanceTarget + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AllowanceTarget + + + +

        + +
        + +
        Inherits:
        +
        + TargetBase + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        EXPRESSION = + +
        +
        :allow
        + +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from TargetBase

        +

        delegate_to, disallow_negation, #initialize

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::TargetBase

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance.html new file mode 100644 index 000000000..98b94aa6f --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::AnyInstance + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::AnyInstance + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/chain.rb,
        + lib/rspec/mocks/any_instance/recorder.rb,
        lib/rspec/mocks/any_instance/stub_chain.rb,
        lib/rspec/mocks/any_instance/message_chains.rb,
        lib/rspec/mocks/any_instance/stub_chain_chain.rb,
        lib/rspec/mocks/any_instance/expectation_chain.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: Chain, ExpectationChain, Recorder + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Chain.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Chain.html new file mode 100644 index 000000000..a59a9f06f --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Chain.html @@ -0,0 +1,299 @@ + + + + + + Class: RSpec::Mocks::AnyInstance::Chain + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstance::Chain + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Customizations
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/chain.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        ExpectationChain

        +
        +

        Defined Under Namespace

        +

        + + + Modules: Customizations + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Customizations

        +

        #and_call_original, #and_raise, #and_return, #and_throw, #and_yield, #any_number_of_times, #at_least, #at_most, #exactly, #once, record, #times, #twice, #with

        +
        +

        Constructor Details

        + +
        +

        + + - (Chain) initialize(recorder, *args, &block) + + + + + +

        +
        + +

        Returns a new instance of Chain

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 5
        +
        +def initialize(recorder, *args, &block)
        +  @recorder          = recorder
        +  @expectation_args  = args
        +  @expectation_block = block
        +  @source_line       = CallerFilter.first_non_rspec_line
        +  ensure_expectation_block_has_source_location
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) never + + + + + +

        + + + + +
        +
        +
        +
        +69
        +70
        +71
        +72
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 69
        +
        +def never
        +  ErrorGenerator.raise_double_negation_error("expect_any_instance_of(MyClass)") if negated?
        +  super
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Chain/Customizations.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Chain/Customizations.html new file mode 100644 index 000000000..03a8c6c7b --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Chain/Customizations.html @@ -0,0 +1,1187 @@ + + + + + + Module: RSpec::Mocks::AnyInstance::Chain::Customizations + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::AnyInstance::Chain::Customizations + + + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec::Mocks::AnyInstance::Chain
        + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/chain.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) and_call_original(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_call_original message for playback against an +instance that invokes a method stubbed or mocked using +any_instance.

          +
          + +
        • + + +
        • + + + - (Object) and_raise(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_raise message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) and_return(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_return message for playback against an +instance that invokes a method stubbed or mocked using +any_instance.

          +
          + +
        • + + +
        • + + + - (Object) and_throw(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_throw message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) and_yield(*args, &block) + + + + + + + + + + + + + +
          +

          Records the and_yield message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) any_number_of_times(*args, &block) + + + + + + + + + + + + + +
          +

          Records the any_number_of_times message for playback against +an instance that invokes a method stubbed or mocked using +any_instance.

          +
          + +
        • + + +
        • + + + - (Object) at_least(*args, &block) + + + + + + + + + + + + + +
          +

          Records the at_least message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) at_most(*args, &block) + + + + + + + + + + + + + +
          +

          Records the at_most message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) exactly(*args, &block) + + + + + + + + + + + + + +
          +

          Records the exactly message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) never(*args, &block) + + + + + + + + + + + + + +
          +

          Records the never message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) once(*args, &block) + + + + + + + + + + + + + +
          +

          Records the once message for playback against an instance that +invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) times(*args, &block) + + + + + + + + + + + + + +
          +

          Records the times message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) twice(*args, &block) + + + + + + + + + + + + + +
          +

          Records the twice message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        • + + + - (Object) with(*args, &block) + + + + + + + + + + + + + +
          +

          Records the with message for playback against an instance that +invokes a method stubbed or mocked using any_instance.

          +
          + +
        • + + +
        + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) record(method_name) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 21
        +
        +def self.record(method_name)
        +  class_eval(<<-EOM, __FILE__, __LINE__ + 1)
        +    def #{method_name}(*args, &block)
        +      record(:#{method_name}, *args, &block)
        +    end
        +  EOM
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) and_call_original(*args, &block) + + + + + +

        +
        + +

        Records the and_call_original message for playback against an +instance that invokes a method stubbed or mocked using +any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +33
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 33
        +
        +record :and_call_original
        +
        +
        + +
        +

        + + - (Object) and_raise(*args, &block) + + + + + +

        +
        + +

        Records the and_raise message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +30
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 30
        +
        +record :and_raise
        +
        +
        + +
        +

        + + - (Object) and_return(*args, &block) + + + + + +

        +
        + +

        Records the and_return message for playback against an +instance that invokes a method stubbed or mocked using +any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +29
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 29
        +
        +record :and_return
        +
        +
        + +
        +

        + + - (Object) and_throw(*args, &block) + + + + + +

        +
        + +

        Records the and_throw message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +31
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 31
        +
        +record :and_throw
        +
        +
        + +
        +

        + + - (Object) and_yield(*args, &block) + + + + + +

        +
        + +

        Records the and_yield message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +32
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 32
        +
        +record :and_yield
        +
        +
        + +
        +

        + + - (Object) any_number_of_times(*args, &block) + + + + + +

        +
        + +

        Records the any_number_of_times message for playback against +an instance that invokes a method stubbed or mocked using +any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +37
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 37
        +
        +record :any_number_of_times
        +
        +
        + +
        +

        + + - (Object) at_least(*args, &block) + + + + + +

        +
        + +

        Records the at_least message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +41
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 41
        +
        +record :at_least
        +
        +
        + +
        +

        + + - (Object) at_most(*args, &block) + + + + + +

        +
        + +

        Records the at_most message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +42
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 42
        +
        +record :at_most
        +
        +
        + +
        +

        + + - (Object) exactly(*args, &block) + + + + + +

        +
        + +

        Records the exactly message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +38
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 38
        +
        +record :exactly
        +
        +
        + +
        +

        + + - (Object) never(*args, &block) + + + + + +

        +
        + +

        Records the never message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +40
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 40
        +
        +record :never
        +
        +
        + +
        +

        + + - (Object) once(*args, &block) + + + + + +

        +
        + +

        Records the once message for playback against an instance that +invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +35
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 35
        +
        +record :once
        +
        +
        + +
        +

        + + - (Object) times(*args, &block) + + + + + +

        +
        + +

        Records the times message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +39
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 39
        +
        +record :times
        +
        +
        + +
        +

        + + - (Object) twice(*args, &block) + + + + + +

        +
        + +

        Records the twice message for playback against an instance +that invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +36
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 36
        +
        +record :twice
        +
        +
        + +
        +

        + + - (Object) with(*args, &block) + + + + + +

        +
        + +

        Records the with message for playback against an instance that +invokes a method stubbed or mocked using any_instance.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +34
        +
        +
        # File 'lib/rspec/mocks/any_instance/chain.rb', line 34
        +
        +record :with
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/ExpectationChain.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/ExpectationChain.html new file mode 100644 index 000000000..fdab6f499 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/ExpectationChain.html @@ -0,0 +1,329 @@ + + + + + + Class: RSpec::Mocks::AnyInstance::ExpectationChain + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstance::ExpectationChain + + + Private +

        + +
        + +
        Inherits:
        +
        + Chain + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/expectation_chain.rb
        + +
        +
        + +
        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Chain

        +

        #never

        + + + + + + + + + +

        Methods included from Chain::Customizations

        +

        #and_call_original, #and_raise, #and_return, #and_throw, #and_yield, #any_number_of_times, #at_least, #at_most, #exactly, #never, #once, record, #times, #twice, #with

        +
        +

        Constructor Details

        + +
        +

        + + - (ExpectationChain) initialize(*args, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of ExpectationChain

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/mocks/any_instance/expectation_chain.rb', line 10
        +
        +def initialize(*args, &block)
        +  @expectation_fulfilled = false
        +  super
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) expectation_fulfilled? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/mocks/any_instance/expectation_chain.rb', line 6
        +
        +def expectation_fulfilled?
        +  @expectation_fulfilled || constrained_to_any_of?(:never, :any_number_of_times)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder.html new file mode 100644 index 000000000..076669038 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder.html @@ -0,0 +1,831 @@ + + + + + + Class: RSpec::Mocks::AnyInstance::Recorder + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstance::Recorder + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/any_instance/recorder.rb
        + +
        +
        + +

        Overview

        +
        + +

        Given a class TheClass, TheClass.any_instance +returns a Recorder, which records stubs and message +expectations for later playback on instances of TheClass.

        + +

        Further constraints are stored in instances of Chain.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Recorder) initialize(klass) + + + + + +

        +
        + +

        Returns a new instance of Recorder

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 16
        +
        +def initialize(klass)
        +  @message_chains = MessageChains.new
        +  @stubs = Hash.new { |hash,key| hash[key] = [] }
        +  @observed_methods = []
        +  @played_methods = {}
        +  @klass = klass
        +  @expectation_set = false
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) already_observing?(method_name) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +125
        +126
        +127
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 125
        +
        +def already_observing?(method_name)
        +  @observed_methods.include?(method_name)
        +end
        +
        +
        + +
        +

        + + - (Object) build_alias_method_name(method_name) + + + + + +

        + + + + +
        +
        +
        +
        +121
        +122
        +123
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 121
        +
        +def build_alias_method_name(method_name)
        +  "__#{method_name}_without_any_instance__"
        +end
        +
        +
        + +
        +

        + + - (Object) should_not_receive(method_name, &block) + + + + + +

        + + + + +
        +
        +
        +
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 63
        +
        +def should_not_receive(method_name, &block)
        +  should_receive(method_name, &block).never
        +end
        +
        +
        + +
        +

        + + - (Object) should_receive(method_name, &block) + + + + + +

        +
        + +

        Initializes the recording a message expectation to be played back against +any instance of this object that invokes the submitted method.

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Methods#should_receive
        • + +
        + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 57
        +
        +def should_receive(method_name, &block)
        +  @expectation_set = true
        +  observe!(method_name)
        +  message_chains.add(method_name, ExpectationChain.new(self, method_name, &block))
        +end
        +
        +
        + +
        +

        + + - (Object) stub(method_name_or_method_map, &block) + + + + + +

        +
        + +

        Initializes the recording a stub to be played back against any instance of +this object that invokes the submitted method.

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Methods#stub
        • + +
        + +
        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 29
        +
        +def stub(method_name_or_method_map, &block)
        +  if method_name_or_method_map.is_a?(Hash)
        +    method_name_or_method_map.each do |method_name, return_value|
        +      stub(method_name).and_return(return_value)
        +    end
        +  else
        +    observe!(method_name_or_method_map)
        +    message_chains.add(method_name_or_method_map, StubChain.new(self, method_name_or_method_map, &block))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) stub_chain(*method_names_and_optional_return_values, &block) + + + + + +

        +
        + +

        Initializes the recording a stub chain to be played back against any +instance of this object that invokes the method matching the first +argument.

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Methods#stub_chain
        • + +
        + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 45
        +
        +def stub_chain(*method_names_and_optional_return_values, &block)
        +  normalize_chain(*method_names_and_optional_return_values) do |method_name, args|
        +    observe!(method_name)
        +    message_chains.add(method_name, StubChainChain.new(self, *args, &block))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) unstub(method_name) + + + + + +

        +
        + +

        Removes any previously recorded stubs, stub_chains or message expectations +that use method_name.

        + + +
        +
        +
        + + +

        See Also:

        +
          + +
        • Methods#unstub
        • + +
        + +
        + + + + +
        +
        +
        +
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 71
        +
        +def unstub(method_name)
        +  unless @observed_methods.include?(method_name.to_sym)
        +    raise RSpec::Mocks::MockExpectationError, "The method `#{method_name}` was not stubbed or was already unstubbed"
        +  end
        +  message_chains.remove_stub_chains_for!(method_name)
        +  ::RSpec::Mocks.proxies_of(@klass).each do |proxy|
        +    stubs[method_name].each { |stub| proxy.remove_single_stub(method_name, stub) }
        +  end
        +  stubs[method_name].clear
        +  stop_observing!(method_name) unless message_chains.has_expectation?(method_name)
        +end
        +
        +
        + +
        +

        + + - (Object) verify + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Used internally to verify that message expectations have been fulfilled.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/mocks/any_instance/recorder.rb', line 87
        +
        +def verify
        +  if @expectation_set && !message_chains.all_expectations_fulfilled?
        +    raise RSpec::Mocks::MockExpectationError, "Exactly one instance should have received the following message(s) but didn't: #{message_chains.unfulfilled_expectations.sort.join(', ')}"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstanceAllowanceTarget.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstanceAllowanceTarget.html new file mode 100644 index 000000000..1f5b019a4 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstanceAllowanceTarget.html @@ -0,0 +1,151 @@ + + + + + + Class: RSpec::Mocks::AnyInstanceAllowanceTarget + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstanceAllowanceTarget + + + +

        + +
        + +
        Inherits:
        +
        + TargetBase + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        EXPRESSION = + +
        +
        :expect_any_instance_of
        + +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from TargetBase

        +

        delegate_to, disallow_negation, #initialize

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::TargetBase

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstanceExpectationTarget.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstanceExpectationTarget.html new file mode 100644 index 000000000..4b139d6de --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/AnyInstanceExpectationTarget.html @@ -0,0 +1,151 @@ + + + + + + Class: RSpec::Mocks::AnyInstanceExpectationTarget + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::AnyInstanceExpectationTarget + + + +

        + +
        + +
        Inherits:
        +
        + TargetBase + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        EXPRESSION = + +
        +
        :expect_any_instance_of
        + +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from TargetBase

        +

        delegate_to, disallow_negation, #initialize

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::TargetBase

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html new file mode 100644 index 000000000..3f1c7c331 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentListMatcher.html @@ -0,0 +1,422 @@ + + + + + + Class: RSpec::Mocks::ArgumentListMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentListMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_list_matcher.rb
        + +
        +
        + +

        Overview

        +
        + +

        Wrapper for matching arguments against a list of expected values. Used by +the with method on a MessageExpectation:

        + +
        object.should_receive(:message).with(:a, 'b', 3)
        +object.message(:a, 'b', 3)
        + +

        Values passed to with can be literal values or argument +matchers that match against the real objects .e.g.

        + +
        object.should_receive(:message).with(hash_including(:a => 'b'))
        +
        + +

        Can also be used directly to match the contents of any Array. +This enables 3rd party mocking libs to take advantage of rspec's +argument matching without using the rest of rspec-mocks.

        + +
        require 'rspec/mocks/argument_list_matcher'
        +include RSpec::Mocks::ArgumentMatchers
        +
        +arg_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(123, hash_including(:a => 'b'))
        +arg_list_matcher.args_match?(123, :a => 'b')
        +
        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Boolean) args_match?(*args) + + + + + + + + + + + + + +
          +

          Matches each element in the expected_args against the element +in the same position of the arguments passed to new.

          +
          + +
        • + + +
        • + + + - (ArgumentListMatcher) initialize(*expected_args, &block) + + + + + + + constructor + + + + + + + + +
          +

          Initializes an ArgumentListMatcher with a collection of +literal values and/or argument matchers, or a block that handles the +evaluation for you.

          +
          + +
        • + + +
        + + +
        +

        Constructor Details

        + +
        +

        + + - (ArgumentListMatcher) initialize(*expected_args, &block) + + + + + +

        +
        + +

        Initializes an ArgumentListMatcher with a collection of +literal values and/or argument matchers, or a block that handles the +evaluation for you.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + *expected_args + + + (Array) + + + + — +
          +

          a list of expected literals and/or argument matchers

          +
          + +
        • + +
        • + + block + + + (Block) + + + + — +
          +

          a block with arity matching the expected

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/mocks/argument_list_matcher.rb', line 41
        +
        +def initialize(*expected_args, &block)
        +  @expected_args = expected_args
        +  @block = expected_args.empty? ? block : nil
        +  @match_any_args = false
        +  @matchers = nil
        +
        +  case expected_args.first
        +  when ArgumentMatchers::AnyArgsMatcher
        +    @match_any_args = true
        +  when ArgumentMatchers::NoArgsMatcher
        +    @matchers = []
        +  else
        +    @matchers = expected_args.collect {|arg| matcher_for(arg)}
        +  end
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) args_match?(*args) + + + + + +

        +
        + +

        Matches each element in the expected_args against the element +in the same position of the arguments passed to new.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + *args + + + (Array) + + + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/mocks/argument_list_matcher.rb', line 64
        +
        +def args_match?(*args)
        +  match_any_args? || block_passes?(*args) || matchers_match?(*args)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html new file mode 100644 index 000000000..0c9ee8806 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html @@ -0,0 +1,850 @@ + + + + + + Module: RSpec::Mocks::ArgumentMatchers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ArgumentMatchers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        ExampleMethods
        + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + +

        Overview

        +
        + +

        ArgumentMatchers are placeholders that you can include in message +expectations to match arguments against a broader check than simple +equality.

        + +

        With the exception of any_args and no_args, they +all match against the arg in same position in the argument list.

        + + +
        +
        +
        + + +

        See Also:

        + + +

        Defined Under Namespace

        +

        + + + + + Classes: AnyArgMatcher, AnyArgsMatcher, BooleanMatcher, DuckTypeMatcher, EqualityProxy, HashExcludingMatcher, HashIncludingMatcher, InstanceOf, KindOf, MatcherMatcher, NoArgsMatcher, RegexpMatcher + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) any_args + + + + + +

        +
        + +

        Matches any args at all. Supports a more explicit variation of +object.should_receive(:message)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(any_args)
        + +
        + + +
        + + + + +
        +
        +
        +
        +154
        +155
        +156
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 154
        +
        +def any_args
        +  AnyArgsMatcher.new
        +end
        +
        +
        + +
        +

        + + - (Object) anything + + + + + +

        +
        + +

        Matches any argument at all.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(anything)
        + +
        + + +
        + + + + +
        +
        +
        +
        +163
        +164
        +165
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 163
        +
        +def anything
        +  AnyArgMatcher.new(nil)
        +end
        +
        +
        + +
        +

        + + - (Object) boolean + + + + + +

        +
        + +

        Matches a boolean value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(boolean())
        + +
        + + +
        + + + + +
        +
        +
        +
        +191
        +192
        +193
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 191
        +
        +def boolean
        +  BooleanMatcher.new(nil)
        +end
        +
        +
        + +
        +

        + + - (Object) duck_type(*args) + + + + + +

        +
        + +

        Matches if the actual argument responds to the specified messages.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(duck_type(:hello))
        +object.should_receive(:message).with(duck_type(:hello, :goodbye))
        + +
        + + +
        + + + + +
        +
        +
        +
        +182
        +183
        +184
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 182
        +
        +def duck_type(*args)
        +  DuckTypeMatcher.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) hash_excluding(*args) + + + + Also known as: + hash_not_including + + + + +

        +
        + +

        Matches a hash that doesn't include the specified key(s) or key/value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(hash_excluding(:key => val))
        +object.should_receive(:message).with(hash_excluding(:key))
        +object.should_receive(:message).with(hash_excluding(:key, :key2 => :val2))
        + +
        + + +
        + + + + +
        +
        +
        +
        +214
        +215
        +216
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 214
        +
        +def hash_excluding(*args)
        +  HashExcludingMatcher.new(anythingize_lonely_keys(*args))
        +end
        +
        +
        + +
        +

        + + - (Object) hash_including(*args) + + + + + +

        +
        + +

        Matches a hash that includes the specified key(s) or key/value pairs. +Ignores any additional keys.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(hash_including(:key => val))
        +object.should_receive(:message).with(hash_including(:key))
        +object.should_receive(:message).with(hash_including(:key, :key2 => val2))
        + +
        + + +
        + + + + +
        +
        +
        +
        +203
        +204
        +205
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 203
        +
        +def hash_including(*args)
        +  HashIncludingMatcher.new(anythingize_lonely_keys(*args))
        +end
        +
        +
        + +
        +

        + + - (Object) instance_of(klass) + + + + Also known as: + an_instance_of + + + + +

        +
        + +

        Matches if arg.instance_of?(klass)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(instance_of(Thing))
        + +
        + + +
        + + + + +
        +
        +
        +
        +225
        +226
        +227
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 225
        +
        +def instance_of(klass)
        +  InstanceOf.new(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) kind_of(klass) + + + + Also known as: + a_kind_of + + + + +

        +
        + +

        Matches if arg.kind_of?(klass)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(kind_of(Thing))
        + +
        + + +
        + + + + +
        +
        +
        +
        +235
        +236
        +237
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 235
        +
        +def kind_of(klass)
        +  KindOf.new(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) no_args + + + + + +

        +
        + +

        Matches no arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +object.should_receive(:message).with(no_args)
        + +
        + + +
        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 172
        +
        +def no_args
        +  NoArgsMatcher.new
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgMatcher.html new file mode 100644 index 000000000..56c25c99e --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgMatcher.html @@ -0,0 +1,258 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::AnyArgMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::AnyArgMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (AnyArgMatcher) initialize(ignore) + + + + + +

        +
        + +

        Returns a new instance of AnyArgMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 21
        +
        +def initialize(ignore)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(other) + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 24
        +
        +def ==(other)
        +  true
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgsMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgsMatcher.html new file mode 100644 index 000000000..afadd5d28 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/AnyArgsMatcher.html @@ -0,0 +1,189 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::AnyArgsMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::AnyArgsMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 15
        +
        +def description
        +  "any args"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/BooleanMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/BooleanMatcher.html new file mode 100644 index 000000000..d11d8c871 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/BooleanMatcher.html @@ -0,0 +1,258 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::BooleanMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::BooleanMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (BooleanMatcher) initialize(ignore) + + + + + +

        +
        + +

        Returns a new instance of BooleanMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +46
        +47
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 46
        +
        +def initialize(ignore)
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(value) + + + + + +

        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 49
        +
        +def ==(value)
        +  [true,false].include?(value)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/DuckTypeMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/DuckTypeMatcher.html new file mode 100644 index 000000000..37c5ab998 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/DuckTypeMatcher.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::DuckTypeMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::DuckTypeMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (DuckTypeMatcher) initialize(*methods_to_respond_to) + + + + + +

        +
        + +

        Returns a new instance of DuckTypeMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 87
        +
        +def initialize(*methods_to_respond_to)
        +  @methods_to_respond_to = methods_to_respond_to
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(value) + + + + + +

        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 91
        +
        +def ==(value)
        +  @methods_to_respond_to.all? {|message| value.respond_to?(message)}
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/EqualityProxy.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/EqualityProxy.html new file mode 100644 index 000000000..07474ed73 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/EqualityProxy.html @@ -0,0 +1,284 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::EqualityProxy + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::EqualityProxy + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (EqualityProxy) initialize(given) + + + + + +

        +
        + +

        Returns a new instance of EqualityProxy

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 107
        +
        +def initialize(given)
        +  @given = given
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(expected) + + + + + +

        + + + + +
        +
        +
        +
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 111
        +
        +def ==(expected)
        +  if defined?(DateTime) && DateTime === expected
        +    RSpec.warn_deprecation <<-WARN.gsub(/^\s*\|/,'')
        +      |In RSpec 3.0.0 matchers use `#===` (the match operator) to perform
        +      |comparision between expected and actual arguments. Due to strange
        +      |behaviour with `DateTime#===` (which ignores the time of the object
        +      |when performing a comparison) this may result in undesired
        +      |behaviour. We recommend you switch to a `Date` or `Time` object
        +      |instead.
        +      |
        +      |Called from: #{RSpec::CallerFilter.first_non_rspec_line}
        +    WARN
        +  end
        +  @given == expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashExcludingMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashExcludingMatcher.html new file mode 100644 index 000000000..123098739 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashExcludingMatcher.html @@ -0,0 +1,316 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (HashExcludingMatcher) initialize(expected) + + + + + +

        +
        + +

        Returns a new instance of HashExcludingMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +71
        +72
        +73
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 71
        +
        +def initialize(expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(actual) + + + + + +

        + + + + +
        +
        +
        +
        +75
        +76
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 75
        +
        +def ==(actual)
        +  @expected.none? {|k,v| actual.has_key?(k) && v == actual[k]}
        +rescue NoMethodError
        +  false
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 81
        +
        +def description
        +  "hash_not_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashIncludingMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashIncludingMatcher.html new file mode 100644 index 000000000..ac5103a46 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/HashIncludingMatcher.html @@ -0,0 +1,316 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (HashIncludingMatcher) initialize(expected) + + + + + +

        +
        + +

        Returns a new instance of HashIncludingMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 55
        +
        +def initialize(expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(actual) + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 59
        +
        +def ==(actual)
        +  @expected.all? {|k,v| actual.has_key?(k) && v == actual[k]}
        +rescue NoMethodError
        +  false
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 65
        +
        +def description
        +  "hash_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/InstanceOf.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/InstanceOf.html new file mode 100644 index 000000000..f6c846b69 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/InstanceOf.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::InstanceOf + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::InstanceOf + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (InstanceOf) initialize(klass) + + + + + +

        +
        + +

        Returns a new instance of InstanceOf

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +129
        +130
        +131
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 129
        +
        +def initialize(klass)
        +  @klass = klass
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(actual) + + + + + +

        + + + + +
        +
        +
        +
        +133
        +134
        +135
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 133
        +
        +def ==(actual)
        +  actual.instance_of?(@klass)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/KindOf.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/KindOf.html new file mode 100644 index 000000000..2664acbcb --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/KindOf.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::KindOf + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::KindOf + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (KindOf) initialize(klass) + + + + + +

        +
        + +

        Returns a new instance of KindOf

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 139
        +
        +def initialize(klass)
        +  @klass = klass
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(actual) + + + + + +

        + + + + +
        +
        +
        +
        +143
        +144
        +145
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 143
        +
        +def ==(actual)
        +  actual.kind_of?(@klass)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/MatcherMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/MatcherMatcher.html new file mode 100644 index 000000000..49507dd28 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/MatcherMatcher.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::MatcherMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::MatcherMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (MatcherMatcher) initialize(matcher) + + + + + +

        +
        + +

        Returns a new instance of MatcherMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 97
        +
        +def initialize(matcher)
        +  @matcher = matcher
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(value) + + + + + +

        + + + + +
        +
        +
        +
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 101
        +
        +def ==(value)
        +  @matcher.matches?(value)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/NoArgsMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/NoArgsMatcher.html new file mode 100644 index 000000000..d21ce5c45 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/NoArgsMatcher.html @@ -0,0 +1,189 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::NoArgsMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::NoArgsMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 30
        +
        +def description
        +  "no args"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/RegexpMatcher.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/RegexpMatcher.html new file mode 100644 index 000000000..080b8ea87 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ArgumentMatchers/RegexpMatcher.html @@ -0,0 +1,260 @@ + + + + + + Class: RSpec::Mocks::ArgumentMatchers::RegexpMatcher + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ArgumentMatchers::RegexpMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/argument_matchers.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (RegexpMatcher) initialize(regexp) + + + + + +

        +
        + +

        Returns a new instance of RegexpMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 36
        +
        +def initialize(regexp)
        +  @regexp = regexp
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(value) + + + + + +

        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +
        +
        # File 'lib/rspec/mocks/argument_matchers.rb', line 40
        +
        +def ==(value)
        +  Regexp === value ? value == @regexp : value =~ @regexp
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Configuration.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Configuration.html new file mode 100644 index 000000000..bd5409383 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Configuration.html @@ -0,0 +1,768 @@ + + + + + + Class: RSpec::Mocks::Configuration + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/configuration.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides configuration options for rspec-mocks.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Configuration) initialize + + + + + +

        +
        + +

        Returns a new instance of Configuration

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 6
        +
        +def initialize
        +  @yield_receiver_to_any_instance_implementation_blocks = false
        +  @should_warn_about_any_instance_blocks = true
        +  @marshal_patched = false
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_stub_and_should_receive_to(*modules) + + + + + +

        +
        + +

        Adds stub and should_receive to the given modules +or classes. This is usually only necessary if you application uses some +proxy classes that “strip themselves down” to a bare minimum set of methods +and remove stub and should_receive in the +process.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec.configure do |rspec|
        +  rspec.mock_with :rspec do |mocks|
        +    mocks.add_stub_and_should_receive_to Delegator
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 40
        +
        +def add_stub_and_should_receive_to(*modules)
        +  modules.each do |mod|
        +    Syntax.enable_should(mod)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) marshal_patched? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +71
        +72
        +73
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 71
        +
        +def marshal_patched?
        +  @marshal_patched
        +end
        +
        +
        + +
        +

        + + - (Object) patch_marshal_to_support_partial_doubles=(val) + + + + + +

        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 67
        +
        +def patch_marshal_to_support_partial_doubles=(val)
        +  @marshal_patched = val
        +end
        +
        +
        + +
        +

        + + - (Boolean) should_warn_about_any_instance_blocks? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 21
        +
        +def should_warn_about_any_instance_blocks?
        +  @should_warn_about_any_instance_blocks
        +end
        +
        +
        + +
        +

        + + - (Object) syntax + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 60
        +
        +def syntax
        +  syntaxes = []
        +  syntaxes << :should  if Syntax.should_enabled?
        +  syntaxes << :expect if Syntax.expect_enabled?
        +  syntaxes
        +end
        +
        +
        + +
        +

        + + - (Object) syntax=(values) + + + + + +

        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 46
        +
        +def syntax=(values)
        +  if Array(values).include?(:expect)
        +    Syntax.enable_expect
        +  else
        +    Syntax.disable_expect
        +  end
        +
        +  if Array(values).include?(:should)
        +    Syntax.enable_should
        +  else
        +    Syntax.disable_should
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) yield_receiver_to_any_instance_implementation_blocks=(arg) + + + + + +

        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 16
        +
        +def yield_receiver_to_any_instance_implementation_blocks=(arg)
        +  @should_warn_about_any_instance_blocks = false
        +  @yield_receiver_to_any_instance_implementation_blocks = arg
        +end
        +
        +
        + +
        +

        + + - (Boolean) yield_receiver_to_any_instance_implementation_blocks? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/mocks/configuration.rb', line 12
        +
        +def yield_receiver_to_any_instance_implementation_blocks?
        +  @yield_receiver_to_any_instance_implementation_blocks
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Constant.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Constant.html new file mode 100644 index 000000000..cea076a10 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Constant.html @@ -0,0 +1,1163 @@ + + + + + + Class: RSpec::Mocks::Constant + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Constant + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        RecursiveConstMethods
        + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides information about constants that may (or may not) have been +mutated by rspec-mocks.

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) hidden + + + + + + + + + + writeonly + + + + + + private + + +
          + +
        • + + +
        • + + + - (String) name + + + + + + + + + readonly + + + + + + + + + +
          +

          The fully qualified name of the constant.

          +
          + +
        • + + +
        • + + + - (Object?) original_value + + + + + + + + + + + + + + + + +
          +

          The original value (e.g. before it was mutated by rspec-mocks) of the +constant, or nil if the constant was not previously defined.

          +
          + +
        • + + +
        • + + + - (Object) previously_defined + + + + + + + + + + writeonly + + + + + + private + + +
          + +
        • + + +
        • + + + - (Object) stubbed + + + + + + + + + + writeonly + + + + + + private + + +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + +
          + +
        • + + + + (Constant) original(name) + + + + + + + + + + + + + +
          +

          Queries rspec-mocks to find out information about the named constant.

          +
          + +
        • + + +
        + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Boolean) hidden? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has hidden this constant.

          +
          + +
        • + + +
        • + + + - (Constant) initialize(name) + + + + + + + constructor + + + + + + private + + +
          +

          A new instance of Constant.

          +
          + +
        • + + +
        • + + + - (Boolean) mutated? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has mutated (stubbed or hidden) this constant.

          +
          + +
        • + + +
        • + + + - (Boolean) previously_defined? + + + + + + + + + + + + + +
          +

          Whether or not the constant was defined before the current example.

          +
          + +
        • + + +
        • + + + - (Boolean) stubbed? + + + + + + + + + + + + + +
          +

          Whether or not rspec-mocks has stubbed this constant.

          +
          + +
        • + + +
        • + + + - (Object) to_s + + + + (also: #inspect) + + + + + + + + + + + +
          + +
        • + + +
        + + + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        const_defined_on?, constants_defined_on, get_const_defined_on, normalize_const_name, recursive_const_defined?, recursive_const_get

        +
        +

        Constructor Details

        + +
        +

        + + - (Constant) initialize(name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of Constant

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +84
        +85
        +86
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 84
        +
        +def initialize(name)
        +  @name = name
        +  @previously_defined = false
        +  @stubbed = false
        +  @hidden = false
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) hidden=(value) (writeonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 100
        +
        +def hidden=(value)
        +  @hidden = value
        +end
        +
        +
        + + + +
        +

        + + - (String) name (readonly) + + + + + +

        +
        + +

        Returns The fully qualified name of the constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (String) + + + + — +
          +

          The fully qualified name of the constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 92
        +
        +def name
        +  @name
        +end
        +
        +
        + + + +
        +

        + + - (Object?) original_value + + + + + +

        +
        + +

        Returns The original value (e.g. before it was mutated by rspec-mocks) of +the constant, or nil if the constant was not previously defined.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Object, nil) + + + + — +
          +

          The original value (e.g. before it was mutated by rspec-mocks) of the +constant, or nil if the constant was not previously defined.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +97
        +98
        +99
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 97
        +
        +def original_value
        +  @original_value
        +end
        +
        +
        + + + +
        +

        + + - (Object) previously_defined=(value) (writeonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 100
        +
        +def previously_defined=(value)
        +  @previously_defined = value
        +end
        +
        +
        + + + +
        +

        + + - (Object) stubbed=(value) (writeonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 100
        +
        +def stubbed=(value)
        +  @stubbed = value
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Constant) original(name) + + + + + +

        +
        + +

        Queries rspec-mocks to find out information about the named constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + name + + + (String) + + + + — +
          +

          the name of the constant

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Constant) + + + + — +
          +

          an object contaning information about the named constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +148
        +149
        +150
        +151
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 148
        +
        +def self.original(name)
        +  mutator = ConstantMutator.find(name)
        +  mutator ? mutator.to_constant : unmutated(name)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) hidden? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has hidden this constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has hidden this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +122
        +123
        +124
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 122
        +
        +def hidden?
        +  @hidden
        +end
        +
        +
        + +
        +

        + + - (Boolean) mutated? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has mutated (stubbed or hidden) this +constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has mutated (stubbed or hidden) this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 110
        +
        +def mutated?
        +  @stubbed || @hidden
        +end
        +
        +
        + +
        +

        + + - (Boolean) previously_defined? + + + + + +

        +
        + +

        Returns Whether or not the constant was defined before the current example.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not the constant was defined before the current example.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 104
        +
        +def previously_defined?
        +  @previously_defined
        +end
        +
        +
        + +
        +

        + + - (Boolean) stubbed? + + + + + +

        +
        + +

        Returns Whether or not rspec-mocks has stubbed this constant.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +
          +

          Whether or not rspec-mocks has stubbed this constant.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +116
        +117
        +118
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 116
        +
        +def stubbed?
        +  @stubbed
        +end
        +
        +
        + +
        +

        + + - (Object) to_s + + + + Also known as: + inspect + + + + +

        + + + + +
        +
        +
        +
        +126
        +127
        +128
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 126
        +
        +def to_s
        +  "#<#{self.class.name} #{name}>"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator.html new file mode 100644 index 000000000..24ccf715c --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator.html @@ -0,0 +1,912 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + +
        Extended by:
        +
        RecursiveConstMethods
        + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        + +

        Provides a means to stub constants.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + + + Classes: BaseMutator, ConstantHider, DefinedConstantReplacer, UndefinedConstantSetter + + +

        + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        const_defined_on?, constants_defined_on, get_const_defined_on, normalize_const_name, recursive_const_defined?, recursive_const_get

        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) find(name) + + + + + +

        + + + + +
        +
        +
        +
        +385
        +386
        +387
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 385
        +
        +def self.find(name)
        +  mutators.find { |s| s.full_constant_name == name }
        +end
        +
        +
        + +
        +

        + + + (Object) hide(constant_name) + + + + + +

        +
        + +
        + Note: +
        +

        It's recommended that you use hide_const in your examples. +This is an alternate public API that is provided so you can hide constants +in other contexts (e.g. helper classes).

        +
        +
        + + +

        Hides a constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +192
        +193
        +194
        +195
        +196
        +197
        +198
        +199
        +200
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 192
        +
        +def self.hide(constant_name)
        +  space = RSpec::Mocks.space
        +  space.print_out_of_example_deprecation if space.outside_example
        +
        +  return unless recursive_const_defined?(constant_name)
        +
        +  mutate(ConstantHider.new(constant_name, nil, { }))
        +  nil
        +end
        +
        +
        + +
        +

        + + + (Object) mutate(mutator) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Uses the mutator to mutate (stub or hide) a constant. Ensures that the +mutator is correctly registered so it can be backed out at the end of the +test.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +354
        +355
        +356
        +357
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 354
        +
        +def self.mutate(mutator)
        +  register_mutator(mutator)
        +  mutator.mutate
        +end
        +
        +
        + +
        +

        + + + (Object) mutators + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        The list of constant mutators that have been used for the current example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +376
        +377
        +378
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 376
        +
        +def self.mutators
        +  @mutators ||= []
        +end
        +
        +
        + +
        +

        + + + (Object) raise_on_invalid_const + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Used internally by the constant stubbing to raise a helpful error when a +constant like “A::B::C” is stubbed and A::B is not a module (and thus, +it's impossible to define “A::B::C” since only modules can have nested +constants).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +395
        +396
        +397
        +398
        +399
        +400
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 395
        +
        +def self.raise_on_invalid_const
        +  lambda do |const_name, failed_name|
        +    raise "Cannot stub constant #{failed_name} on #{const_name} " +
        +          "since #{const_name} is not a module."
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) register_mutator(mutator) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +381
        +382
        +383
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 381
        +
        +def self.register_mutator(mutator)
        +  mutators << mutator
        +end
        +
        +
        + +
        +

        + + + (Object) reset_all + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Resets all stubbed constants. This is called automatically by rspec-mocks +when an example finishes.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +363
        +364
        +365
        +366
        +367
        +368
        +369
        +370
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 363
        +
        +def self.reset_all
        +  # We use reverse order so that if the same constant
        +  # was stubbed multiple times, the original value gets
        +  # properly restored.
        +  mutators.reverse.each { |s| s.rspec_reset }
        +
        +  mutators.clear
        +end
        +
        +
        + +
        +

        + + + (Object) stub(constant_name, value, options = {}) + + + + + +

        +
        + +
        + Note: +
        +

        It's recommended that you use stub_const in your examples. +This is an alternate public API that is provided so you can stub constants +in other contexts (e.g. helper classes).

        +
        +
        + + +

        Stubs a constant.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        • + + value + + + (Object) + + + + — +
          +

          The value to make the constant refer to. When the example completes, the +constant will be restored to its prior state.

          +
          + +
        • + +
        • + + options + + + (Hash) + + + (defaults to: {}) + + + — +
          +

          Stubbing options.

          +
          + +
        • + +
        + + + + + + + + +

        Options Hash (options):

        +
          + +
        • + :transfer_nested_constants + (Boolean, Array<Symbol>) + + + + + —
          +

          Determines what nested constants, if any, will be transferred from the +original value of the constant to the new value of the constant. This only +works if both the original and new values are modules (or classes).

          +
          + +
        • + +
        + + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +
          +

          the stubbed value of the constant

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +169
        +170
        +171
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 169
        +
        +def self.stub(constant_name, value, options = {})
        +  space = RSpec::Mocks.space
        +  space.print_out_of_example_deprecation if space.outside_example
        +
        +  mutator = if recursive_const_defined?(constant_name, &raise_on_invalid_const)
        +    DefinedConstantReplacer
        +  else
        +    UndefinedConstantSetter
        +  end
        +
        +  mutate(mutator.new(constant_name, value, options[:transfer_nested_constants]))
        +  value
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/BaseMutator.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/BaseMutator.html new file mode 100644 index 000000000..6efaf4df9 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/BaseMutator.html @@ -0,0 +1,479 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator::BaseMutator + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator::BaseMutator + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        RecursiveConstMethods
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Contains common functionality used by all of the constant mutators.

        + + +
        +
        +
        + + +
        + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        #const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get

        +
        +

        Constructor Details

        + +
        +

        + + - (BaseMutator) initialize(full_constant_name, mutated_value, transfer_nested_constants) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of BaseMutator

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +210
        +211
        +212
        +213
        +214
        +215
        +216
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 210
        +
        +def initialize(full_constant_name, mutated_value, transfer_nested_constants)
        +  @full_constant_name        = normalize_const_name(full_constant_name)
        +  @mutated_value             = mutated_value
        +  @transfer_nested_constants = transfer_nested_constants
        +  @context_parts             = @full_constant_name.split('::')
        +  @const_name                = @context_parts.pop
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) full_constant_name (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +208
        +209
        +210
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 208
        +
        +def full_constant_name
        +  @full_constant_name
        +end
        +
        +
        + + + +
        +

        + + - (Object) original_value (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +208
        +209
        +210
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 208
        +
        +def original_value
        +  @original_value
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) to_constant + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +218
        +219
        +220
        +221
        +222
        +223
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 218
        +
        +def to_constant
        +  const = Constant.new(full_constant_name)
        +  const.original_value = original_value
        +
        +  const
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/ConstantHider.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/ConstantHider.html new file mode 100644 index 000000000..08611e5af --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/ConstantHider.html @@ -0,0 +1,396 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator::ConstantHider + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator::ConstantHider + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMutator + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Hides a defined constant for the duration of an example.

        + + +
        +
        +
        + + +
        + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMutator

        +

        #full_constant_name, #original_value

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMutator

        +

        #initialize

        + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        #const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::ConstantMutator::BaseMutator

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) mutate + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +230
        +231
        +232
        +233
        +234
        +235
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 230
        +
        +def mutate
        +  @context = recursive_const_get(@context_parts.join('::'))
        +  @original_value = get_const_defined_on(@context, @const_name)
        +
        +  @context.__send__(:remove_const, @const_name)
        +end
        +
        +
        + +
        +

        + + - (Object) rspec_reset + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +245
        +246
        +247
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 245
        +
        +def rspec_reset
        +  @context.const_set(@const_name, @original_value)
        +end
        +
        +
        + +
        +

        + + - (Object) to_constant + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +237
        +238
        +239
        +240
        +241
        +242
        +243
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 237
        +
        +def to_constant
        +  const = super
        +  const.hidden = true
        +  const.previously_defined = true
        +
        +  const
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/DefinedConstantReplacer.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/DefinedConstantReplacer.html new file mode 100644 index 000000000..389a3c04d --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/DefinedConstantReplacer.html @@ -0,0 +1,594 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator::DefinedConstantReplacer + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator::DefinedConstantReplacer + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMutator + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Replaces a defined constant for the duration of an example.

        + + +
        +
        +
        + + +
        + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMutator

        +

        #full_constant_name, #original_value

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMutator

        +

        #initialize

        + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        #const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::ConstantMutator::BaseMutator

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) mutate + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +254
        +255
        +256
        +257
        +258
        +259
        +260
        +261
        +262
        +263
        +264
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 254
        +
        +def mutate
        +  @context = recursive_const_get(@context_parts.join('::'))
        +  @original_value = get_const_defined_on(@context, @const_name)
        +
        +  constants_to_transfer = verify_constants_to_transfer!
        +
        +  @context.__send__(:remove_const, @const_name)
        +  @context.const_set(@const_name, @mutated_value)
        +
        +  transfer_nested_constants(constants_to_transfer)
        +end
        +
        +
        + +
        +

        + + - (Object) rspec_reset + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +274
        +275
        +276
        +277
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 274
        +
        +def rspec_reset
        +  @context.__send__(:remove_const, @const_name)
        +  @context.const_set(@const_name, @original_value)
        +end
        +
        +
        + +
        +

        + + - (Object) to_constant + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +266
        +267
        +268
        +269
        +270
        +271
        +272
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 266
        +
        +def to_constant
        +  const = super
        +  const.stubbed = true
        +  const.previously_defined = true
        +
        +  const
        +end
        +
        +
        + +
        +

        + + - (Object) transfer_nested_constants(constants) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +279
        +280
        +281
        +282
        +283
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 279
        +
        +def transfer_nested_constants(constants)
        +  constants.each do |const|
        +    @mutated_value.const_set(const, get_const_defined_on(original_value, const))
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) verify_constants_to_transfer! + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +285
        +286
        +287
        +288
        +289
        +290
        +291
        +292
        +293
        +294
        +295
        +296
        +297
        +298
        +299
        +300
        +301
        +302
        +303
        +304
        +305
        +306
        +307
        +308
        +309
        +310
        +311
        +312
        +313
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 285
        +
        +def verify_constants_to_transfer!
        +  return [] unless @transfer_nested_constants
        +
        +  { @original_value => "the original value", @mutated_value => "the stubbed value" }.each do |value, description|
        +    unless value.respond_to?(:constants)
        +      raise ArgumentError,
        +        "Cannot transfer nested constants for #{@full_constant_name} " +
        +        "since #{description} is not a class or module and only classes " +
        +        "and modules support nested constants."
        +    end
        +  end
        +
        +  if @transfer_nested_constants.is_a?(Array)
        +    @transfer_nested_constants = @transfer_nested_constants.map(&:to_s) if RUBY_VERSION == '1.8.7'
        +    undefined_constants = @transfer_nested_constants - constants_defined_on(@original_value)
        +
        +    if undefined_constants.any?
        +      available_constants = constants_defined_on(@original_value) - @transfer_nested_constants
        +      raise ArgumentError,
        +        "Cannot transfer nested constant(s) #{undefined_constants.join(' and ')} " +
        +        "for #{@full_constant_name} since they are not defined. Did you mean " +
        +        "#{available_constants.join(' or ')}?"
        +    end
        +
        +    @transfer_nested_constants
        +  else
        +    constants_defined_on(@original_value)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/UndefinedConstantSetter.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/UndefinedConstantSetter.html new file mode 100644 index 000000000..9024a354d --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ConstantMutator/UndefinedConstantSetter.html @@ -0,0 +1,414 @@ + + + + + + Class: RSpec::Mocks::ConstantMutator::UndefinedConstantSetter + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ConstantMutator::UndefinedConstantSetter + + + Private +

        + +
        + +
        Inherits:
        +
        + BaseMutator + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + +

        Sets an undefined constant for the duration of an example.

        + + +
        +
        +
        + + +
        + + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMutator

        +

        #full_constant_name, #original_value

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMutator

        +

        #initialize

        + + + + + + + + + +

        Methods included from RecursiveConstMethods

        +

        #const_defined_on?, #constants_defined_on, #get_const_defined_on, #normalize_const_name, #recursive_const_defined?, #recursive_const_get

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::ConstantMutator::BaseMutator

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) mutate + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +320
        +321
        +322
        +323
        +324
        +325
        +326
        +327
        +328
        +329
        +330
        +331
        +332
        +333
        +334
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 320
        +
        +def mutate
        +  remaining_parts = @context_parts.dup
        +  @deepest_defined_const = @context_parts.inject(Object) do |klass, name|
        +    break klass unless const_defined_on?(klass, name)
        +    remaining_parts.shift
        +    get_const_defined_on(klass, name)
        +  end
        +
        +  context = remaining_parts.inject(@deepest_defined_const) do |klass, name|
        +    klass.const_set(name, Module.new)
        +  end
        +
        +  @const_to_remove = remaining_parts.first || @const_name
        +  context.const_set(@const_name, @mutated_value)
        +end
        +
        +
        + +
        +

        + + - (Object) rspec_reset + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +344
        +345
        +346
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 344
        +
        +def rspec_reset
        +  @deepest_defined_const.__send__(:remove_const, @const_to_remove)
        +end
        +
        +
        + +
        +

        + + - (Object) to_constant + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +336
        +337
        +338
        +339
        +340
        +341
        +342
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 336
        +
        +def to_constant
        +  const = super
        +  const.stubbed = true
        +  const.previously_defined = false
        +
        +  const
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Deprecation.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Deprecation.html new file mode 100644 index 000000000..b554c22a8 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Deprecation.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Mocks::Deprecation + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Deprecation + + + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec
        + + + +
        Defined in:
        +
        lib/rspec/mocks/deprecation.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Double.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Double.html new file mode 100644 index 000000000..daa958365 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Double.html @@ -0,0 +1,145 @@ + + + + + + Class: RSpec::Mocks::Double + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Double + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        TestDouble
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/mock.rb
        + +
        +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from TestDouble

        +

        #==, #__warn_if_used_further!, #as_null_object, extend_onto, #freeze, #initialize, #null_object?

        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + + in the class RSpec::Mocks::TestDouble + +

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExampleMethods.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExampleMethods.html new file mode 100644 index 000000000..2704cd806 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExampleMethods.html @@ -0,0 +1,898 @@ + + + + + + Module: RSpec::Mocks::ExampleMethods + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ExampleMethods + + + +

        + +
        + + + + + +
        Includes:
        +
        ArgumentMatchers
        + + + + + +
        Defined in:
        +
        lib/rspec/mocks/example_methods.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: ExpectHost + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from ArgumentMatchers

        +

        #any_args, #anything, #boolean, #duck_type, #hash_excluding, #hash_including, #instance_of, #kind_of, #no_args

        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) allow_message_expectations_on_nil + + + + + +

        +
        + +

        Disables warning messages about expectations being set on nil.

        + +

        By default warning messages are issued when expectations are set on nil. +This is to prevent false-positives and to catch potential bugs early on.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 51
        +
        +def allow_message_expectations_on_nil
        +  RSpec::Mocks.space.proxy_for(nil).warn_about_expectations = false
        +end
        +
        +
        + +
        +

        + + + - (Mock) double + + - (Mock) double(name) + + - (Mock) double(stubs) + + - (Mock) double(name, stubs) + + + + + + +

        +
        + +

        Constructs an instance of :Mocks::Mock +configured with an optional name, used for reporting in failure messages, +and an optional hash of method/return-value pairs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +book = double("book", :title => "The RSpec Book")
        +book.title #=> "The RSpec Book"
        +
        +card = double("card", :suit => "Spades", :rank => "A")
        +card.suit  #=> "Spades"
        +card.rank  #=> "A"
        + +
        +

        Parameters:

        +
          + +
        • + + name + + + (String/Symbol) + + + + — +
          +

          (optional) used in clarify intent

          +
          + +
        • + +
        • + + stubs + + + (Hash) + + + + — +
          +

          (optional) hash of method/return-value pairs

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Mock) + + + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 30
        +
        +def double(*args)
        +  declare_double('Double', *args)
        +end
        +
        +
        + +
        +

        + + - (Object) have_received(method_name) + + + + + +

        +
        + +

        Verifies that the given object received the expected message during the +course of the test. The method must have previously been stubbed in order +for messages to be verified.

        + +

        Stubbing and verifying messages received in this way implements the Test +Spy pattern.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +invitation = double('invitation', accept: true)
        +user.accept_invitation(invitation)
        +expect(invitation).to have_received(:accept)
        +
        +# You can also use most message expectations:
        +expect(invitation).to have_received(:accept).with(mailer).once
        + +
        +

        Parameters:

        +
          + +
        • + + method_name + + + (Symbol) + + + + — +
          +

          name of the method expected to have been called.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +130
        +131
        +132
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 130
        +
        +def have_received(method_name)
        +  Matchers::HaveReceived.new(method_name)
        +end
        +
        +
        + +
        +

        + + - (Object) hide_const(constant_name) + + + + + +

        +
        + +

        Hides the named constant with the given value. The constant will be +undefined for the duration of the test.

        + +

        Like method stubs, the constant will be restored to its original value when +the example completes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +hide_const("MyClass") # => MyClass is now an undefined constant
        + +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 108
        +
        +def hide_const(constant_name)
        +  ConstantMutator.hide(constant_name)
        +end
        +
        +
        + +
        +

        + + - (Object) mock(*args) + + + + + +

        +
        + +

        Deprecated: Use double.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 35
        +
        +def mock(*args)
        +  RSpec.deprecate "mock", :replacement => "double"
        +  declare_double('Mock', *args)
        +end
        +
        +
        + +
        +

        + + - (Object) stub(*args) + + + + + +

        +
        + +

        Deprecated: Use double.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 41
        +
        +def stub(*args)
        +  RSpec.deprecate "stub", :replacement => "double"
        +  declare_double('Stub', *args)
        +end
        +
        +
        + +
        +

        + + - (Object) stub_const(constant_name, value, options = {}) + + + + + +

        +
        + +

        Stubs the named constant with the given value. Like method stubs, the +constant will be restored to its original value (or lack of one, if it was +undefined) when the example completes.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +stub_const("MyClass", Class.new) # => Replaces (or defines) MyClass with a new class object.
        +stub_const("SomeModel::PER_PAGE", 5) # => Sets SomeModel::PER_PAGE to 5.
        +
        +class CardDeck
        +  SUITS = [:Spades, :Diamonds, :Clubs, :Hearts]
        +  NUM_CARDS = 52
        +end
        +
        +stub_const("CardDeck", Class.new)
        +CardDeck::SUITS # => uninitialized constant error
        +CardDeck::NUM_CARDS # => uninitialized constant error
        +
        +stub_const("CardDeck", Class.new, :transfer_nested_constants => true)
        +CardDeck::SUITS # => our suits array
        +CardDeck::NUM_CARDS # => 52
        +
        +stub_const("CardDeck", Class.new, :transfer_nested_constants => [:SUITS])
        +CardDeck::SUITS # => our suits array
        +CardDeck::NUM_CARDS # => uninitialized constant error
        + +
        +

        Parameters:

        +
          + +
        • + + constant_name + + + (String) + + + + — +
          +

          The fully qualified name of the constant. The current constant scoping at +the point of call is not considered.

          +
          + +
        • + +
        • + + value + + + (Object) + + + + — +
          +

          The value to make the constant refer to. When the example completes, the +constant will be restored to its prior state.

          +
          + +
        • + +
        • + + options + + + (Hash) + + + (defaults to: {}) + + + — +
          +

          Stubbing options.

          +
          + +
        • + +
        + + + + + + + + +

        Options Hash (options):

        +
          + +
        • + :transfer_nested_constants + (Boolean, Array<Symbol>) + + + + + —
          +

          Determines what nested constants, if any, will be transferred from the +original value of the constant to the new value of the constant. This only +works if both the original and new values are modules (or classes).

          +
          + +
        • + +
        + + +

        Returns:

        +
          + +
        • + + + (Object) + + + + — +
          +

          the stubbed value of the constant

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +92
        +93
        +94
        +
        +
        # File 'lib/rspec/mocks/example_methods.rb', line 92
        +
        +def stub_const(constant_name, value, options = {})
        +  ConstantMutator.stub(constant_name, value, options)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html new file mode 100644 index 000000000..e118fdb6c --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExampleMethods/ExpectHost.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::ExampleMethods::ExpectHost + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::ExampleMethods::ExpectHost + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/example_methods.rb
        + +
        +
        + +

        Overview

        +
        + +

        This module exists to host the expect method for cases where +rspec-mocks is used w/o rspec-expectations.

        + + +
        +
        +
        + + +
        + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExpectationTarget.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExpectationTarget.html new file mode 100644 index 000000000..54ab8412e --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/ExpectationTarget.html @@ -0,0 +1,151 @@ + + + + + + Class: RSpec::Mocks::ExpectationTarget + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::ExpectationTarget + + + +

        + +
        + +
        Inherits:
        +
        + TargetBase + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        EXPRESSION = + +
        +
        :expect
        + +
        + + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods inherited from TargetBase

        +

        delegate_to, disallow_negation, #initialize

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Mocks::TargetBase

        + +
        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers.html new file mode 100644 index 000000000..74f18432f --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::Matchers + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Matchers + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/matchers/receive.rb,
        + lib/rspec/mocks/matchers/have_received.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: HaveReceived, Receive + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/HaveReceived.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/HaveReceived.html new file mode 100644 index 000000000..aa1a599c9 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/HaveReceived.html @@ -0,0 +1,548 @@ + + + + + + Class: RSpec::Mocks::Matchers::HaveReceived + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Matchers::HaveReceived + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/matchers/have_received.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        COUNT_CONSTRAINTS = + +
        +
        %w(exactly at_least at_most times once twice)
        + +
        ARGS_CONSTRAINTS = + +
        +
        %w(with)
        + +
        CONSTRAINTS = + +
        +
        COUNT_CONSTRAINTS + ARGS_CONSTRAINTS
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (HaveReceived) initialize(method_name) + + + + + +

        +
        + +

        Returns a new instance of HaveReceived

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 9
        +
        +def initialize(method_name)
        +  @method_name = method_name
        +  @constraints = []
        +  @subject = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 36
        +
        +def description
        +  expect.description
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(subject) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 21
        +
        +def does_not_match?(subject)
        +  @subject = subject
        +  ensure_count_unconstrained
        +  @expectation = expect.never
        +  expected_messages_received?
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message + + + + + +

        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 28
        +
        +def failure_message
        +  generate_failure_message
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(subject) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 15
        +
        +def matches?(subject)
        +  @subject = subject
        +  @expectation = expect
        +  expected_messages_received?
        +end
        +
        +
        + +
        +

        + + - (Object) negative_failure_message + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/mocks/matchers/have_received.rb', line 32
        +
        +def negative_failure_message
        +  generate_failure_message
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/Receive.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/Receive.html new file mode 100644 index 000000000..875f13b0c --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/Receive.html @@ -0,0 +1,556 @@ + + + + + + Class: RSpec::Mocks::Matchers::Receive + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Matchers::Receive + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/matchers/receive.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: Customization + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Receive) initialize(message, block) + + + + + +

        +
        + +

        Returns a new instance of Receive

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 5
        +
        +def initialize(message, block)
        +  @message                 = message
        +  @block                   = block
        +  @recorded_customizations = []
        +  @backtrace_line          = CallerFilter.first_non_rspec_line
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) setup_allowance(subject, &block) + + + + + +

        + + + + +
        +
        +
        +
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 26
        +
        +def setup_allowance(subject, &block)
        +  setup_mock_proxy_method_substitute(subject, :add_stub, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_any_instance_allowance(subject, &block) + + + + + +

        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 38
        +
        +def setup_any_instance_allowance(subject, &block)
        +  setup_any_instance_method_substitute(subject, :stub, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_any_instance_expectation(subject, &block) + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 30
        +
        +def setup_any_instance_expectation(subject, &block)
        +  setup_any_instance_method_substitute(subject, :should_receive, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_any_instance_negative_expectation(subject, &block) + + + + + +

        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 34
        +
        +def setup_any_instance_negative_expectation(subject, &block)
        +  setup_any_instance_method_substitute(subject, :should_not_receive, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_expectation(subject, &block) + + + + Also known as: + matches? + + + + +

        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 12
        +
        +def setup_expectation(subject, &block)
        +  setup_mock_proxy_method_substitute(subject, :add_message_expectation, block)
        +end
        +
        +
        + +
        +

        + + - (Object) setup_negative_expectation(subject, &block) + + + + Also known as: + does_not_match? + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 17
        +
        +def setup_negative_expectation(subject, &block)
        +  # ensure `never` goes first for cases like `never.and_return(5)`,
        +  # where `and_return` is meant to raise an error
        +  @recorded_customizations.unshift Customization.new(:never, [], nil)
        +
        +  setup_expectation(subject, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/Receive/Customization.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/Receive/Customization.html new file mode 100644 index 000000000..51c421714 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Matchers/Receive/Customization.html @@ -0,0 +1,264 @@ + + + + + + Class: RSpec::Mocks::Matchers::Receive::Customization + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Matchers::Receive::Customization + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/matchers/receive.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Customization) initialize(method_name, args, block) + + + + + +

        +
        + +

        Returns a new instance of Customization

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +79
        +80
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 76
        +
        +def initialize(method_name, args, block)
        +  @method_name = method_name
        +  @args        = args
        +  @block       = block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) playback_onto(expectation) + + + + + +

        + + + + +
        +
        +
        +
        +82
        +83
        +84
        +
        +
        # File 'lib/rspec/mocks/matchers/receive.rb', line 82
        +
        +def playback_onto(expectation)
        +  expectation.__send__(@method_name, *@args, &@block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/MessageExpectation.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/MessageExpectation.html new file mode 100644 index 000000000..87c7945cd --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/MessageExpectation.html @@ -0,0 +1,2242 @@ + + + + + + Class: RSpec::Mocks::MessageExpectation + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::MessageExpectation + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/message_expectation.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) argument_list_matcher=(value) (writeonly) + + + + + +

        +
        + +

        Sets the attribute argument_list_matcher

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + value + + + + + + + — +
          +

          the value to set the attribute argument_list_matcher to.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 10
        +
        +def argument_list_matcher=(value)
        +  @argument_list_matcher = value
        +end
        +
        +
        + + + +
        +

        + + - (Object) message (readonly) + + + + + +

        +
        + +

        Returns the value of attribute message

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 8
        +
        +def message
        +  @message
        +end
        +
        +
        + + + +
        +

        + + - (Object) orig_object (readonly) + + + + + +

        +
        + +

        Returns the value of attribute orig_object

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 9
        +
        +def orig_object
        +  @orig_object
        +end
        +
        +
        + + + +
        +

        + + - (Object) warn_about_yielding_receiver_to_implementation_block + + + + + +

        +
        + +

        Returns the value of attribute +warn_about_yielding_receiver_to_implementation_block

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 7
        +
        +def warn_about_yielding_receiver_to_implementation_block
        +  @warn_about_yielding_receiver_to_implementation_block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) and_call_original + + + + + +

        +
        + +
        + Note: +
        +

        This is only available on partial mock objects.

        +
        +
        + + +

        Tells the object to delegate to the original unmodified method when it +receives the message.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +counter.should_receive(:increment).and_call_original
        +original_count = counter.count
        +counter.increment
        +expect(counter.count).to eq(original_count + 1)
        + +
        + + +
        + + + + +
        +
        +
        +
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 123
        +
        +def and_call_original
        +  if @method_double.object.is_a?(RSpec::Mocks::TestDouble)
        +    @error_generator.raise_only_valid_on_a_partial_mock(:and_call_original)
        +  else
        +    @implementation = AndCallOriginalImplementation.new(@method_double.original_method)
        +    @yield_receiver_to_implementation_block = false
        +  end
        +end
        +
        +
        + +
        +

        + + + - (Object) and_raise + + - (Object) and_raise(ExceptionClass) + + - (Object) and_raise(ExceptionClass, message) + + - (Object) and_raise(exception_instance) + + + + + + +

        +
        + +
        + Note: +
        +

        When you pass an exception class, the MessageExpectation will raise an +instance of it, creating it with exception and passing +message if specified. If the exception class initializer +requires more than one parameters, you must pass in an instance and not the +class, otherwise this method will raise an ArgumentError exception.

        +
        +
        + + +

        Tells the object to raise an exception when the message is received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.stub(:go).and_raise
        +car.stub(:go).and_raise(OutOfGas)
        +car.stub(:go).and_raise(OutOfGas, "At least 2 oz of gas needed to drive")
        +car.stub(:go).and_raise(OutOfGas.new(2, :oz))
        + +
        + + +
        + + + + +
        +
        +
        +
        +153
        +154
        +155
        +156
        +157
        +158
        +159
        +160
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 153
        +
        +def and_raise(exception = RuntimeError, message = nil)
        +  if exception.respond_to?(:exception)
        +    exception = message ? exception.exception(message) : exception.exception
        +  end
        +
        +  self.terminal_implementation_action = Proc.new { raise exception }
        +  nil
        +end
        +
        +
        + +
        +

        + + + - (Object) and_return(value) + + - (Object) and_return(first_value, second_value) + + - (Object) and_return(&block) + + + + + + +

        +
        + +

        Tells the object to return a value when it receives the message. Given more +than one value, the first value is returned the first time the message is +received, the second value is returned the next time, etc, etc.

        + +

        If the message is received more times than there are values, the last value +is received for every subsequent call.

        + +

        The block format is deprecated in favor of just passing a block to the stub +method.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +counter.stub(:count).and_return(1)
        +counter.count # => 1
        +counter.count # => 1
        +
        +counter.stub(:count).and_return(1,2,3)
        +counter.count # => 1
        +counter.count # => 2
        +counter.count # => 3
        +counter.count # => 3
        +counter.count # => 3
        +# etc
        +
        +# Deprecated ...
        +counter.stub(:count).and_return { 1 }
        +counter.count # => 1
        +
        +# ... use this instead
        +counter.stub(:count) { 1 }
        +counter.count # => 1
        + +
        + + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 79
        +
        +def and_return(*values, &implementation)
        +  if negative?
        +    RSpec.deprecate "`and_return` on a negative message expectation"
        +  end
        +
        +  @expected_received_count = [@expected_received_count, values.size].max unless ignoring_args? || (@expected_received_count == 0 and @at_least)
        +
        +  if implementation
        +    RSpec.deprecate('`and_return { value }`',
        +                    :replacement => '`and_return(value)` or an implementation block without `and_return`')
        +    self.inner_implementation_action = implementation
        +  else
        +    if values.empty?
        +      RSpec.warn_deprecation('`and_return` without arguments is deprecated. ' +
        +                             'Remove the `and_return`. ' +
        +                             "Called from #{CallerFilter.first_non_rspec_line}.")
        +    end
        +
        +    self.terminal_implementation_action = AndReturnImplementation.new(values)
        +  end
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + + - (Object) and_throw(symbol) + + - (Object) and_throw(symbol, object) + + + + + + +

        +
        + +

        Tells the object to throw a symbol (with the object if that form is used) +when the message is received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.stub(:go).and_throw(:out_of_gas)
        +car.stub(:go).and_throw(:out_of_gas, :level => 0.1)
        + +
        + + +
        + + + + +
        +
        +
        +
        +172
        +173
        +174
        +175
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 172
        +
        +def and_throw(*args)
        +  self.terminal_implementation_action = Proc.new { throw(*args) }
        +  nil
        +end
        +
        +
        + +
        +

        + + - (Object) and_yield(*args) {|@eval_context = Object.new.extend(RSpec::Mocks::InstanceExec)| ... } + + + + + +

        +
        + +

        Tells the object to yield one or more args to a block when the message is +received.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +stream.stub(:open).and_yield(StringIO.new)
        + +
        + +

        Yields:

        +
          + +
        • + + + (@eval_context = Object.new.extend(RSpec::Mocks::InstanceExec)) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +183
        +184
        +185
        +186
        +187
        +188
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 183
        +
        +def and_yield(*args, &block)
        +  yield @eval_context = Object.new.extend(RSpec::Mocks::InstanceExec) if block
        +  @args_to_yield << args
        +  self.initial_implementation_action = AndYieldImplementation.new(@args_to_yield, @eval_context, @error_generator)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) and_yield_receiver_to_implementation + + + + + +

        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 103
        +
        +def and_yield_receiver_to_implementation
        +  @yield_receiver_to_implementation_block = true
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) any_number_of_times(&block) + + + + + +

        +
        + +

        Allows an expected message to be received any number of times.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +421
        +422
        +423
        +424
        +425
        +426
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 421
        +
        +def any_number_of_times(&block)
        +  RSpec.deprecate "any_number_of_times", :replacement => "stub"
        +  self.inner_implementation_action = block
        +  @expected_received_count = :any
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) at_least(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received at least a specific number +of times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +dealer.should_receive(:deal_card).at_least(9).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +385
        +386
        +387
        +388
        +389
        +390
        +391
        +392
        +393
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 385
        +
        +def at_least(n, &block)
        +  if n == 0
        +    RSpec.deprecate "at_least(0) with should_receive", :replacement => "stub"
        +  end
        +
        +  self.inner_implementation_action = block
        +  set_expected_received_count :at_least, n
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) at_most(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received at most a specific number of +times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +dealer.should_receive(:deal_card).at_most(10).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +401
        +402
        +403
        +404
        +405
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 401
        +
        +def at_most(n, &block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :at_most, n
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) display_any_instance_deprecation_warning(block_source_line) + + + + + +

        + + + + +
        +
        +
        +
        +500
        +501
        +502
        +503
        +504
        +505
        +506
        +507
        +508
        +509
        +510
        +511
        +512
        +513
        +514
        +515
        +516
        +517
        +518
        +519
        +520
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 500
        +
        +def display_any_instance_deprecation_warning(block_source_line)
        +  RSpec.warn_deprecation(<<MSG
        +In RSpec 3, `any_instance` implementation blocks will be yielded the receiving
        +instance as the first block argument to allow the implementation block to use
        +the state of the receiver.  To maintain compatibility with RSpec 3 you need to
        +either set rspec-mocks' `yield_receiver_to_any_instance_implementation_blocks`
        +config option to `false` OR set it to `true` and update your `any_instance`
        +implementation blocks to account for the first block argument being the receiving instance.
        +
        +To set the config option, use a snippet like:
        +
        +RSpec.configure do |rspec|
        +  rspec.mock_with :rspec do |mocks|
        +    mocks.yield_receiver_to_any_instance_implementation_blocks = false
        +  end
        +end
        +
        +Your `any_instance` implementation block is declared at: #{block_source_line}
        +MSG
        +)
        +end
        +
        +
        + +
        +

        + + - (Object) exactly(n, &block) + + + + + +

        +
        + +

        Constrain a message expectation to be received a specific number of times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +dealer.should_receive(:deal_card).exactly(10).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +373
        +374
        +375
        +376
        +377
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 373
        +
        +def exactly(n, &block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, n
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) expectation_count_type + + + + + +

        + + + + +
        +
        +
        +
        +314
        +315
        +316
        +317
        +318
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 314
        +
        +def expectation_count_type
        +  return :at_least if @at_least
        +  return :at_most if @at_most
        +  return nil
        +end
        +
        +
        + +
        +

        + + - (Object) never + + + + + +

        +
        + +

        Expect a message not to be received at all.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.should_receive(:stop).never
        + +
        + + +
        + + + + +
        +
        +
        +
        +433
        +434
        +435
        +436
        +437
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 433
        +
        +def never
        +  ErrorGenerator.raise_double_negation_error("expect(obj)") if negative?
        +  @expected_received_count = 0
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) once(&block) + + + + + +

        +
        + +

        Expect a message to be received exactly one time.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.should_receive(:go).once
        + +
        + + +
        + + + + +
        +
        +
        +
        +444
        +445
        +446
        +447
        +448
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 444
        +
        +def once(&block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, 1
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) ordered(&block) + + + + + +

        +
        + +

        Expect messages to be received in a specific order.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +api.should_receive(:prepare).ordered
        +api.should_receive(:run).ordered
        +api.should_receive(:finish).ordered
        + +
        + + +
        + + + + +
        +
        +
        +
        +468
        +469
        +470
        +471
        +472
        +473
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 468
        +
        +def ordered(&block)
        +  self.inner_implementation_action = block
        +  @order_group.register(self)
        +  @ordered = true
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) raise_out_of_order_error + + + + + +

        + + + + +
        +
        +
        +
        +325
        +326
        +327
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 325
        +
        +def raise_out_of_order_error
        +  @error_generator.raise_out_of_order_error @message
        +end
        +
        +
        + +
        +

        + + - (Object) should_display_any_instance_deprecation_warning + + + + + +

        + + + + +
        +
        +
        +
        +495
        +496
        +497
        +498
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 495
        +
        +def should_display_any_instance_deprecation_warning
        +  warn_about_yielding_receiver_to_implementation_block &&
        +    !@have_warned_about_yielding_receiver
        +end
        +
        +
        + +
        +

        + + - (Object) times(&block) + + + + + +

        +
        + +

        Syntactic sugar for exactly, at_least and +at_most

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +dealer.should_receive(:deal_card).exactly(10).times
        +dealer.should_receive(:deal_card).at_least(10).times
        +dealer.should_receive(:deal_card).at_most(10).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +414
        +415
        +416
        +417
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 414
        +
        +def times(&block)
        +  self.inner_implementation_action = block
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) twice(&block) + + + + + +

        +
        + +

        Expect a message to be received exactly two times.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +car.should_receive(:go).twice
        + +
        + + +
        + + + + +
        +
        +
        +
        +455
        +456
        +457
        +458
        +459
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 455
        +
        +def twice(&block)
        +  self.inner_implementation_action = block
        +  set_expected_received_count :exactly, 2
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) warn_about_receiver_passing(any_instance_source_line) + + + + + +

        + + + + +
        +
        +
        +
        +490
        +491
        +492
        +493
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 490
        +
        +def warn_about_receiver_passing(any_instance_source_line)
        +  @any_instance_source_line = any_instance_source_line
        +  @warn_about_yielding_receiver_to_implementation_block = true
        +end
        +
        +
        + +
        +

        + + - (Object) with(*args, &block) + + + + + +

        +
        + +

        Constrains a stub or message expectation to invocations with specific +arguments.

        + +

        With a stub, if the message might be received with other args as well, you +should stub a default value first, and then stub or mock the same message +using with to constrain to specific arguments.

        + +

        A message expectation will fail if the message is received with different +arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +cart.stub(:add) { :failure }
        +cart.stub(:add).with(Book.new(:isbn => 1934356379)) { :success }
        +cart.add(Book.new(:isbn => 1234567890))
        +# => :failure
        +cart.add(Book.new(:isbn => 1934356379))
        +# => :success
        +
        +cart.should_receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
        +cart.add(Book.new(:isbn => 1234567890))
        +# => failed expectation
        +cart.add(Book.new(:isbn => 1934356379))
        +# => passes
        + +
        + + +
        + + + + +
        +
        +
        +
        +353
        +354
        +355
        +356
        +357
        +358
        +359
        +360
        +361
        +362
        +363
        +364
        +365
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 353
        +
        +def with(*args, &block)
        +  if block_given?
        +    if args.empty?
        +      RSpec.deprecate "Using the return value of a `with` block to validate passed arguments rather than as an implementation",
        +        :replacement => "the `satisfy` matcher, a custom matcher or validate the arguments in an implementation block"
        +    else
        +      self.inner_implementation_action = block
        +    end
        +  end
        +
        +  @argument_list_matcher = ArgumentListMatcher.new(*args, &block)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Boolean) yield_receiver_to_implementation_block? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +
        +
        # File 'lib/rspec/mocks/message_expectation.rb', line 108
        +
        +def yield_receiver_to_implementation_block?
        +  @yield_receiver_to_implementation_block
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/RecursiveConstMethods.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/RecursiveConstMethods.html new file mode 100644 index 000000000..efdda24e4 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/RecursiveConstMethods.html @@ -0,0 +1,590 @@ + + + + + + Module: RSpec::Mocks::RecursiveConstMethods + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::RecursiveConstMethods + + + Private +

        + +
        + + + + + + + +
        Included in:
        +
        Constant, ConstantMutator, ConstantMutator::BaseMutator
        + + + +
        Defined in:
        +
        lib/rspec/mocks/mutate_const.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        + +

        Provides recursive constant lookup methods useful for constant stubbing.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) const_defined_on?(mod, const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 30
        +
        +def const_defined_on?(mod, const_name)
        +  mod.const_defined?(const_name)
        +end
        +
        +
        + +
        +

        + + - (Object) constants_defined_on(mod) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 42
        +
        +def constants_defined_on(mod)
        +  mod.constants.select { |c| const_defined_on?(mod, c) }
        +end
        +
        +
        + +
        +

        + + - (Object) get_const_defined_on(mod, const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Raises:

        +
          + +
        • + + + (NameError) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 34
        +
        +def get_const_defined_on(mod, const_name)
        +  if const_defined_on?(mod, const_name)
        +    return mod.const_get(const_name)
        +  end
        +
        +  raise NameError, "uninitialized constant #{mod.name}::#{const_name}"
        +end
        +
        +
        + +
        +

        + + - (Object) normalize_const_name(const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 73
        +
        +def normalize_const_name(const_name)
        +  const_name.sub(/\A::/, '')
        +end
        +
        +
        + +
        +

        + + - (Boolean) recursive_const_defined?(const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 65
        +
        +def recursive_const_defined?(const_name)
        +  normalize_const_name(const_name).split('::').inject([Object, '']) do |(mod, full_name), name|
        +    yield(full_name, name) if block_given? && !mod.is_a?(Module)
        +    return false unless const_defined_on?(mod, name)
        +    [get_const_defined_on(mod, name), [mod, name].join('::')]
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) recursive_const_get(const_name) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +63
        +
        +
        # File 'lib/rspec/mocks/mutate_const.rb', line 59
        +
        +def recursive_const_get(const_name)
        +  normalize_const_name(const_name).split('::').inject(Object) do |mod, name|
        +    get_const_defined_on(mod, name)
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Space.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Space.html new file mode 100644 index 000000000..9a9847800 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Space.html @@ -0,0 +1,1135 @@ + + + + + + Class: RSpec::Mocks::Space + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::Space + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/space.rb
        + +
        +
        + +
        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Space) initialize + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Returns a new instance of Space

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 8
        +
        +def initialize
        +  @proxies                 = {}
        +  @any_instance_recorders  = {}
        +  self.outside_example     = true
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) any_instance_recorders (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 5
        +
        +def any_instance_recorders
        +  @any_instance_recorders
        +end
        +
        +
        + + + +
        +

        + + - (Object) outside_example + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 6
        +
        +def outside_example
        +  @outside_example
        +end
        +
        +
        + + + +
        +

        + + - (Object) proxies (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 5
        +
        +def proxies
        +  @proxies
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) any_instance_recorder_for(klass) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 45
        +
        +def any_instance_recorder_for(klass)
        +  print_out_of_example_deprecation if outside_example
        +  id = klass.__id__
        +  any_instance_recorders.fetch(id) do
        +    any_instance_recorders[id] = AnyInstance::Recorder.new(klass)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) expectation_ordering + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 41
        +
        +def expectation_ordering
        +  @expectation_ordering ||= OrderGroup.new
        +end
        +
        +
        + +
        +

        + + - (Object) id_for(object) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 83
        +
        +def id_for(object)
        +  id = object.__id__
        +
        +  return id if object.equal?(::ObjectSpace._id2ref(id))
        +  # this suggests that object.__id__ is proxying through to some wrapped object
        +
        +  object.instance_eval do
        +    @__id_for_rspec_mocks_space ||= ::SecureRandom.uuid
        +  end
        +end
        +
        +
        + +
        +
        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +76
        +77
        +78
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 76
        +
        +def print_out_of_example_deprecation
        +  RSpec.deprecate("Using rspec-mocks doubles or partial doubles outside the per-test lifecycle (such as in a `before(:all)` hook)")
        +end
        +
        +
        + +
        +

        + + - (Object) proxies_of(klass) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +53
        +54
        +55
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 53
        +
        +def proxies_of(klass)
        +  proxies.values.select { |proxy| klass === proxy.object }
        +end
        +
        +
        + +
        +

        + + - (Object) proxy_for(object) + + + + Also known as: + ensure_registered + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 57
        +
        +def proxy_for(object)
        +  print_out_of_example_deprecation if outside_example
        +  id = id_for(object)
        +  proxies.fetch(id) do
        +    proxies[id] = case object
        +                  when NilClass   then ProxyForNil.new
        +                  when TestDouble then object.__build_mock_proxy
        +                  else
        +                    Proxy.new(object)
        +                  end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) registered?(object) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 72
        +
        +def registered?(object)
        +  proxies.has_key?(id_for object)
        +end
        +
        +
        + +
        +

        + + - (Object) reset_all + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 24
        +
        +def reset_all
        +  ConstantMutator.reset_all
        +
        +  proxies.each_value do |object|
        +    object.reset
        +  end
        +
        +  proxies.clear
        +
        +  any_instance_recorders.each_value do |recorder|
        +    recorder.stop_all_observation!
        +  end
        +
        +  any_instance_recorders.clear
        +  expectation_ordering.clear
        +end
        +
        +
        + +
        +

        + + - (Object) verify_all + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/mocks/space.rb', line 14
        +
        +def verify_all
        +  proxies.each_value do |object|
        +    object.verify
        +  end
        +
        +  any_instance_recorders.each_value do |recorder|
        +    recorder.verify
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Syntax.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Syntax.html new file mode 100644 index 000000000..f62102cdf --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Syntax.html @@ -0,0 +1,2059 @@ + + + + + + Module: RSpec::Mocks::Syntax + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Syntax + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        + +

        Provides methods for enabling and disabling the available syntaxes provided +by rspec-mocks.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + +
          + +
        • + + + - (Object) allow + + + + + + + + + + + + + +
          +

          Used to wrap an object in preparation for stubbing a method on it.

          +
          + +
        • + + +
        • + + + - (Object) allow_any_instance_of + + + + + + + + + + + + + +
          +

          Used to wrap a class in preparation for stubbing a method on instances of +it.

          +
          + +
        • + + +
        • + + + - (Recorder) any_instance + + + + + + + + + + + + + +
          +

          Used to set stubs and message expectations on any instance of a given +class.

          +
          + +
        • + + +
        • + + + - (Object) as_null_object + + + + + + + + + + + + + +
          +

          Tells the object to respond to all messages.

          +
          + +
        • + + +
        • + + + - (Object) expect + + + + + + + + + + + + + +
          +

          Used to wrap an object in preparation for setting a mock expectation on it.

          +
          + +
        • + + +
        • + + + - (Object) expect_any_instance_of + + + + + + + + + + + + + +
          +

          Used to wrap a class in preparation for setting a mock expectation on +instances of it.

          +
          + +
        • + + +
        • + + + - (Object) null_object? + + + + + + + + + + + + + +
          +

          Returns true if this object has received as_null_object.

          +
          + +
        • + + +
        • + + + - (Object) receive + + + + + + + + + + + + + +
          +

          Used to specify a message that you expect or allow an object to receive.

          +
          + +
        • + + +
        • + + + - (Object) should_not_receive + + + + + + + + + + + + + +
          +

          Sets and expectation that this object should not receive a message +during this example.

          +
          + +
        • + + +
        • + + + - (Object) should_receive + + + + + + + + + + + + + +
          +

          Sets an expectation that this object should receive a message before the +end of the example.

          +
          + +
        • + + +
        • + + + - (Object) stub + + + + + + + + + + + + + +
          +

          Tells the object to respond to the message with the specified value.

          +
          + +
        • + + +
        • + + + - (Object) stub_chain + + + + + + + + + + + + + +
          +

          Stubs a chain of methods.

          +
          + +
        • + + +
        • + + + - (Object) unstub + + + + + + + + + + + + + +
          +

          Removes a stub.

          +
          + +
        • + + +
        + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) default_should_syntax_host + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Determines where the methods like should_receive, and +stub are added.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +168
        +169
        +170
        +171
        +172
        +173
        +174
        +175
        +176
        +177
        +178
        +179
        +180
        +181
        +182
        +183
        +184
        +185
        +186
        +187
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 168
        +
        +def self.default_should_syntax_host
        +  # JRuby 1.7.4 introduces a regression whereby `defined?(::BasicObject) => nil`
        +  # yet `BasicObject` still exists and patching onto ::Object breaks things
        +  # e.g. SimpleDelegator expectations won't work
        +  #
        +  # See: https://github.com/jruby/jruby/issues/814
        +  if defined?(JRUBY_VERSION) && JRUBY_VERSION == '1.7.4' && RUBY_VERSION.to_f > 1.8
        +    return ::BasicObject
        +  end
        +
        +  # On 1.8.7, Object.ancestors.last == Kernel but
        +  # things blow up if we include `RSpec::Mocks::Methods`
        +  # into Kernel...not sure why.
        +  return Object unless defined?(::BasicObject)
        +
        +  # MacRuby has BasicObject but it's not the root class.
        +  return Object unless Object.ancestors.last == ::BasicObject
        +
        +  ::BasicObject
        +end
        +
        +
        + +
        +

        + + + (Object) disable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Disables the expect syntax (expect(dbl).to receive, +allow(dbl).to receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 139
        +
        +def self.disable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods)
        +  return unless expect_enabled?(syntax_host)
        +
        +  syntax_host.class_eval do
        +    undef receive
        +    undef allow
        +    undef expect_any_instance_of
        +    undef allow_any_instance_of
        +  end
        +
        +  RSpec::Mocks::ExampleMethods::ExpectHost.class_eval do
        +    undef expect
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) disable_should(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Disables the should syntax (dbl.stub, +dbl.should_receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +93
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +104
        +105
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 86
        +
        +def self.disable_should(syntax_host = default_should_syntax_host)
        +  return unless should_enabled?(syntax_host)
        +
        +  syntax_host.class_eval do
        +    undef should_receive
        +    undef should_not_receive
        +    undef stub
        +    undef unstub
        +    undef stub!
        +    undef unstub!
        +    undef stub_chain
        +    undef as_null_object
        +    undef null_object?
        +    undef received_message?
        +  end
        +
        +  Class.class_eval do
        +    undef any_instance
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) enable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Enables the expect syntax (expect(dbl).to receive, +allow(dbl).to receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +123
        +124
        +125
        +126
        +127
        +128
        +129
        +130
        +131
        +132
        +133
        +134
        +135
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 109
        +
        +def self.enable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods)
        +  return if expect_enabled?(syntax_host)
        +
        +  syntax_host.class_eval do
        +    def receive(method_name, &block)
        +      Matchers::Receive.new(method_name, block)
        +    end
        +
        +    def allow(target)
        +      AllowanceTarget.new(target)
        +    end
        +
        +    def expect_any_instance_of(klass)
        +      AnyInstanceExpectationTarget.new(klass)
        +    end
        +
        +    def allow_any_instance_of(klass)
        +      AnyInstanceAllowanceTarget.new(klass)
        +    end
        +  end
        +
        +  RSpec::Mocks::ExampleMethods::ExpectHost.class_eval do
        +    def expect(target)
        +      ExpectationTarget.new(target)
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Object) enable_should(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Enables the should syntax (dbl.stub, +dbl.should_receive, etc).

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 25
        +
        +def self.enable_should(syntax_host = default_should_syntax_host)
        +  return if should_enabled?(syntax_host)
        +
        +  syntax_host.class_eval do
        +    def should_receive(message, opts={}, &block)
        +      opts[:expected_from] ||= CallerFilter.first_non_rspec_line
        +      ::RSpec::Mocks.expect_message(self, message.to_sym, opts, &block)
        +    end
        +
        +    def should_not_receive(message, &block)
        +      opts = { :expected_from => CallerFilter.first_non_rspec_line }
        +      ::RSpec::Mocks.expect_message(self, message.to_sym, opts, &block).never
        +    end
        +
        +    def stub(message_or_hash, opts={}, &block)
        +      ::RSpec::Mocks::Syntax.stub_object(self, message_or_hash, opts, &block)
        +    end
        +
        +    def unstub(message)
        +      ::RSpec::Mocks.space.proxy_for(self).remove_stub(message)
        +    end
        +
        +    def stub!(message_or_hash, opts={}, &block)
        +      ::RSpec.deprecate "stub!", :replacement => "stub"
        +      ::RSpec::Mocks::Syntax.stub_object(self, message_or_hash, opts, &block)
        +    end
        +
        +    def unstub!(message)
        +      ::RSpec.deprecate "unstub!", :replacement => "unstub"
        +      unstub(message)
        +    end
        +
        +    def stub_chain(*chain, &blk)
        +      ::RSpec::Mocks::StubChain.stub_chain_on(self, *chain, &blk)
        +    end
        +
        +    def as_null_object
        +      @_null_object = true
        +      ::RSpec::Mocks.proxy_for(self).as_null_object
        +    end
        +
        +    def null_object?
        +      defined?(@_null_object)
        +    end
        +
        +    def received_message?(message, *args, &block)
        +      ::RSpec::Mocks.proxy_for(self).received_message?(message, *args, &block)
        +    end
        +
        +    unless Class.respond_to? :any_instance
        +      Class.class_eval do
        +        def any_instance
        +          ::RSpec::Mocks.any_instance_recorder_for(self)
        +        end
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + + (Boolean) expect_enabled?(syntax_host = ::RSpec::Mocks::ExampleMethods) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Indicates whether or not the expect syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +162
        +163
        +164
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 162
        +
        +def self.expect_enabled?(syntax_host = ::RSpec::Mocks::ExampleMethods)
        +  syntax_host.method_defined?(:allow)
        +end
        +
        +
        + +
        +

        + + + (Boolean) should_enabled?(syntax_host = default_should_syntax_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Indicates whether or not the should syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +156
        +157
        +158
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 156
        +
        +def self.should_enabled?(syntax_host = default_should_syntax_host)
        +  syntax_host.method_defined?(:should_receive)
        +end
        +
        +
        + +
        +

        + + + (Object) stub_object(object, message_or_hash, opts = {}, &block) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + +

        Common stubbing logic for both stub and stub!. +This used to live in stub, and stub! delegated to +stub, but we discovered that stub! was delegating +to RSpec::Mocks::ExampleMethods#stub (which declares a test +double) when called with an implicit receiver, which was a regression in +2.14.0.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 14
        +
        +def self.stub_object(object, message_or_hash, opts = {}, &block)
        +  if ::Hash === message_or_hash
        +    message_or_hash.each {|message, value| stub_object(object, message).and_return value }
        +  else
        +    opts[:expected_from] = CallerFilter.first_non_rspec_line
        +    ::RSpec::Mocks.allow_message(object, message_or_hash, opts, &block)
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) allow + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to wrap an object in preparation for stubbing a method on it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +allow(dbl).to receive(:foo).with(5).and_return(:return_value)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 304
        +
        +
        +
        +
        + +
        +

        + + - (Object) allow_any_instance_of + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to wrap a class in preparation for stubbing a method on instances of +it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +allow_any_instance_of(MyClass).to receive(:foo)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 324
        +
        +
        +
        +
        + +
        +

        + + - (Recorder) any_instance + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Used to set stubs and message expectations on any instance of a given +class. Returns a Recorder, which records messages +like stub and should_receive for later playback +on instances of the class.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +Car.any_instance.should_receive(:go)
        +race = Race.new
        +race.cars << Car.new
        +race.go # assuming this delegates to all of its cars
        +        # this example would pass
        +
        +Account.any_instance.stub(:balance) { Money.new(:USD, 25) }
        +Account.new.balance # => Money.new(:USD, 25))
        + +
        + +

        Returns:

        +
          + +
        • + + + (Recorder) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 271
        +
        +
        +
        +
        + +
        +

        + + - (Object) as_null_object + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Tells the object to respond to all messages. If specific stub values are +declared, they'll work as expected. If not, the receiver is returned.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 259
        +
        +
        +
        +
        + +
        +

        + + - (Object) expect + + + + + +

        +
        + +
        + Note: +
        +

        This method is usually provided by rspec-expectations, unless you are using +rspec-mocks w/o rspec-expectations, in which case it is only made available +if you enable the expect syntax.

        +
        +
        + + +

        Used to wrap an object in preparation for setting a mock expectation on it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(obj).to receive(:foo).with(5).and_return(:return_value)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 292
        +
        +
        +
        +
        + +
        +

        + + - (Object) expect_any_instance_of + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to wrap a class in preparation for setting a mock expectation on +instances of it.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect_any_instance_of(MyClass).to receive(:foo)
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 314
        +
        +
        +
        +
        + +
        +

        + + - (Object) null_object? + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Returns true if this object has received as_null_object

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 266
        +
        +
        +
        +
        + +
        +

        + + - (Object) receive + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the expect +syntax.

        +
        +
        + + +

        Used to specify a message that you expect or allow an object to receive. +The object returned by receive supports the same fluent +interface that should_receive and stub have +always supported, allowing you to constrain the arguments or number of +times, and configure how the object should respond to the message.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(obj).to receive(:hello).with("world").exactly(3).times
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 334
        +
        +
        +
        +
        + +
        +

        + + - (Object) should_not_receive + + + + + +

        +
        + +

        Sets and expectation that this object should not receive a message +during this example.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 202
        +
        +
        +
        +
        + +
        +

        + + - (Object) should_receive + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Sets an expectation that this object should receive a message before the +end of the example.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +logger = double('logger')
        +thing_that_logs = ThingThatLogs.new(logger)
        +logger.should_receive(:log)
        +thing_that_logs.do_something_that_logs_a_message
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 189
        +
        +
        +
        +
        + +
        +

        + + - (Object) stub + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Tells the object to respond to the message with the specified value.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +counter.stub(:count).and_return(37)
        +counter.stub(:count => 37)
        +counter.stub(:count) { 37 }
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 206
        +
        +
        +
        +
        + +
        +

        + + + - (Object) stub_chain(method1, method2) + + - (Object) stub_chain("method1.method2") + + - (Object) stub_chain(method1, method_to_value_hash) + + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Stubs a chain of methods.

        + +

        Warning:

        + +

        Chains can be arbitrarily long, which makes it quite painless to violate +the Law of Demeter in violent ways, so you should consider any use of +stub_chain a code smell. Even though not all code smells +indicate real problems (think fluent interfaces), stub_chain +still results in brittle examples. For example, if you write +foo.stub_chain(:bar, :baz => 37) in a spec and then the +implementation calls foo.baz.bar, the stub will not work.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +double.stub_chain("foo.bar") { :baz }
        +double.stub_chain(:foo, :bar => :baz)
        +double.stub_chain(:foo, :bar) { :baz }
        +
        +# Given any of ^^ these three forms ^^:
        +double.foo.bar # => :baz
        +
        +# Common use in Rails/ActiveRecord:
        +Article.stub_chain("recent.published") { [Article.new] }
        + +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 228
        +
        +
        +
        +
        + +
        +

        + + - (Object) unstub + + + + + +

        +
        + +
        + Note: +
        +

        This is only available when you have enabled the should +syntax.

        +
        +
        + + +

        Removes a stub. On a double, the object will no longer respond to +message. On a real object, the original method (if it exists) +is restored.

        + +

        This is rarely used, but can be useful when a stub is set up during a +shared before hook for the common case, but you want to +replace it for a special case.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/mocks/syntax.rb', line 217
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TargetBase.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TargetBase.html new file mode 100644 index 000000000..e0c078f30 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TargetBase.html @@ -0,0 +1,353 @@ + + + + + + Class: RSpec::Mocks::TargetBase + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::TargetBase + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/targets.rb
        + +
        +
        + + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (TargetBase) initialize(target) + + + + + +

        +
        + +

        Returns a new instance of TargetBase

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/mocks/targets.rb', line 7
        +
        +def initialize(target)
        +  @target = target
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) delegate_to(matcher_method, options = {}) + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/mocks/targets.rb', line 11
        +
        +def self.delegate_to(matcher_method, options = {})
        +  method_name = options.fetch(:from) { :to }
        +  class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
        +  def #{method_name}(matcher, &block)
        +    unless Matchers::Receive === matcher
        +      raise UnsupportedMatcherError, "only the `receive` matcher is supported " +
        +        "with `\#{expression}(...).\#{#{method_name.inspect}}`, but you have provided: \#{matcher}"
        +    end
        +
        +    matcher.__send__(#{matcher_method.inspect}, @target, &block)
        +  end
        +  RUBY
        +end
        +
        +
        + +
        +

        + + + (Object) disallow_negation(method) + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/mocks/targets.rb', line 25
        +
        +def self.disallow_negation(method)
        +  define_method method do |*args|
        +    raise NegationUnsupportedError,
        +      "`#{expression}(...).#{method} receive` is not supported since it " +
        +      "doesn't really make sense. What would it even mean?"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TestDouble.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TestDouble.html new file mode 100644 index 000000000..3214e0d62 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TestDouble.html @@ -0,0 +1,693 @@ + + + + + + Module: RSpec::Mocks::TestDouble + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::TestDouble + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Double
        + + + +
        Defined in:
        +
        lib/rspec/mocks/test_double.rb
        + +
        +
        + +

        Overview

        +
        + +

        Implements the methods needed for a pure test double. RSpec::Mocks::Mock +includes this module, and it is provided for cases where you want a pure +test double without subclassing RSpec::Mocks::Mock.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(message, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +103
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 100
        +
        +def method_missing(message, *args, &block)
        +  if __mock_proxy.null_object?
        +    case message
        +    when :to_int        then return 0
        +    when :to_a, :to_ary then return nil
        +    end
        +  end
        +  __mock_proxy.record_message_received(message, *args, &block)
        +
        +  begin
        +    __mock_proxy.null_object? ? self : super
        +  rescue NameError
        +    # Required wrapping doubles in an Array on Ruby 1.9.2
        +    raise NoMethodError if [:to_a, :to_ary].include? message
        +    __mock_proxy.raise_unexpected_message_error(message, *args)
        +  end
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) extend_onto(object, name = nil, stubs_and_options = {}) + + + + + +

        +
        + +

        Extends the TestDouble module onto the given object and initializes it as a +test double.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +module = Module.new
        +RSpec::Mocks::TestDouble.extend_onto(module, "MyMixin", :foo => "bar")
        +module.foo  #=> "bar"
        + +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 15
        +
        +def self.extend_onto(object, name=nil, stubs_and_options={})
        +  RSpec.deprecate("`RSpec::Mocks::TestDouble.extend_onto(...)`")
        +  object.extend self
        +  object.send(:__initialize_as_test_double, name, stubs_and_options)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(other) + + + + + +

        +
        + +

        This allows for comparing the mock to other objects that proxy such as +ActiveRecords belongs_to proxy objects. By making the other object run the +comparison, we're sure the call gets delegated to the proxy target.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 46
        +
        +def ==(other)
        +  other == __mock_proxy
        +end
        +
        +
        + +
        +

        + + - (Object) __warn_if_used_further! + + + + + +

        + + + + +
        +
        +
        +
        +80
        +81
        +82
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 80
        +
        +def __warn_if_used_further!
        +  @__unfrozen_attributes[:expired] = true
        +end
        +
        +
        + +
        +

        + + - (Object) as_null_object + + + + + +

        +
        + +

        Tells the object to respond to all messages. If specific stub values are +declared, they'll work as expected. If not, the receiver is returned.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 30
        +
        +def as_null_object
        +  __mock_proxy.as_null_object
        +  @__null_object = true
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) freeze + + + + + +

        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 67
        +
        +def freeze
        +  RSpec.deprecate 'Freezing a test double'
        +  super
        +end
        +
        +
        + +
        +

        + + - (Object) initialize(name = nil, stubs_and_options = {}) + + + + + +

        +
        + +

        Creates a new test double with a name (that will be used in +error messages only)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 23
        +
        +def initialize(name=nil, stubs_and_options={})
        +  __initialize_as_test_double(name, stubs_and_options)
        +end
        +
        +
        + +
        +

        + + - (Boolean) null_object? + + + + + +

        +
        + +

        Returns true if this object has received as_null_object

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/mocks/test_double.rb', line 37
        +
        +def null_object?
        +  __warn_of_expired_use_if_expired
        +  @__null_object
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TestDoubleProxy.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TestDoubleProxy.html new file mode 100644 index 000000000..0c9314d2e --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/TestDoubleProxy.html @@ -0,0 +1,199 @@ + + + + + + Class: RSpec::Mocks::TestDoubleProxy + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Mocks::TestDoubleProxy + + + +

        + +
        + +
        Inherits:
        +
        + Proxy + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/proxy.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) reset + + + + + +

        + + + + +
        +
        +
        +
        +224
        +225
        +226
        +227
        +
        +
        # File 'lib/rspec/mocks/proxy.rb', line 224
        +
        +def reset
        +  object.__warn_if_used_further!
        +  super
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Version.html b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Version.html new file mode 100644 index 000000000..4866a3fe2 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/RSpec/Mocks/Version.html @@ -0,0 +1,117 @@ + + + + + + Module: RSpec::Mocks::Version + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Mocks::Version + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/mocks/version.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        STRING = + +
        +
        '2.99.2'
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/_index.html b/source/documentation/2.14/rspec-mocks/_index.html new file mode 100644 index 000000000..9c901043c --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/_index.html @@ -0,0 +1,603 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.6

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + + + + + + + + + + + + + + + + + + + +
          +
        • I
        • +
            + +
          • + InstanceOf + + (RSpec::Mocks::ArgumentMatchers) + +
          • + +
          +
        + + +
        + + +
          +
        • K
        • +
            + +
          • + Kernel + +
          • + +
          • + KindOf + + (RSpec::Mocks::ArgumentMatchers) + +
          • + +
          +
        + + + + + +
          +
        • N
        • +
            + +
          • + NoArgsMatcher + + (RSpec::Mocks::ArgumentMatchers) + +
          • + +
          +
        + + +
          +
        • P
        • +
            + +
          • + Proc + +
          • + +
          +
        + + + + + +
          +
        • S
        • +
            + +
          • + Space + + (RSpec::Mocks) + +
          • + +
          • + Syntax + + (RSpec::Mocks) + +
          • + +
          +
        + + + + + + + + +
        + + +
          +
        • V
        • +
            + +
          • + Version + + (RSpec::Mocks) + +
          • + +
          +
        + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/class_list.html b/source/documentation/2.14/rspec-mocks/class_list.html new file mode 100644 index 000000000..0a1c846a9 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/class_list.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-mocks/file.Changelog.html b/source/documentation/2.14/rspec-mocks/file.Changelog.html new file mode 100644 index 000000000..db3e9fdbe --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/file.Changelog.html @@ -0,0 +1,837 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        2.99.3 Development

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix regression that caused an error when a test double was deserialized +from YAML. (Yuji Nakayama, #777)

          +
        + +

        2.99.2 / 2014-07-21

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Warn about upcoming change to #=== matching and +DateTime#=== behaviour. (Jon Rowe, #735)

          +
        + +

        2.99.1 / 2014-06-12

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix bug that caused errors at the end of each example when a +double.as_null_object had been frozen. (Yuji Nakayama, #698)

          +
        + +

        Deprecations:

        +
        • +

          Deprecate freezing a test double. (Yuji Nakayama, #698)

          +
        + +

        2.99.0 / 2014-06-01

        + +

        Full +Changelog

        + +

        No changes. Just taking it out of pre-release.

        + +

        2.99.0.rc1 / 2014-05-18

        + +

        Full +Changelog

        + +

        Deprecations:

        +
        • +

          Deprecate RSpec::Mocks::TestDouble.extend_onto. (Myron +Marston)

          +
        • +

          Deprecate RSpec::Mocks::ConstantStubber. (Jon Rowe)

          +
        • +

          Deprecate Marshal.dump monkey-patch without opt-in. (Xavier +Shay)

          +
        + +

        2.99.0.beta2 / 2014-02-17

        + +

        Full +Changelog

        + +

        Deprecations:

        +
        • +

          Deprecate RSpec::Mocks::Mock in favor of +RSpec::Mocks::Double. (Myron Marston)

          +
        • +

          Deprecate the host argument of +RSpec::Mocks.setup. Instead +RSpec::Mocks::ExampleMethods should be included directly in +the scope where RSpec's mocking capabilities are used. (Sam Phippen)

          +
        • +

          Deprecate using any of rspec-mocks' features outside the per-test +lifecycle (e.g. from a before(:all) hook). (Myron Marston)

          +
        • +

          Deprecate re-using a test double in another example. (Myron Marston)

          +
        • +

          Deprecate and_return { value } and and_return +without arguments. (Yuji Nakayama)

          +
        + +

        2.99.0.beta1 / 2013-11-07

        + +

        Full +Changelog

        + +

        Deprecations:

        +
        • +

          Expecting to use lambdas or other strong arity implementations for stub +methods with mis-matched arity is deprecated and support for them will be +removed in 3.0. Either provide the right amount of arguments or use a weak +arity implementation (methods with splats or procs). (Jon Rowe)

          +
        • +

          Using the same test double instance in multiple examples is deprecated. +Test doubles are only meant to live for one example. The mocks and stubs +have always been reset between examples; however, in 2.x the +as_null_object state was not reset and some users relied on +this to have a null object double that is used for many examples. This +behavior will be removed in 3.0. (Myron Marston)

          +
        • +

          Print a detailed warning when an any_instance implementation +block is used when the new +yield_receiver_to_any_instance_implementation_blocks config +option is not explicitly set, as RSpec 3.0 will default to enabling this +new feature. (Sam Phippen)

          +
        + +

        Enhancements:

        +
        • +

          Add a config option to yield the receiver to any_instance +implementation blocks. (Sam Phippen)

          +
        + +

        2.14.6 / 2014-02-20

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Ensure any_instance method stubs and expectations are torn +down regardless of expectation failures. (Sam Phippen)

          +
        + +

        2.14.5 / 2014-02-01

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix regression that caused block implementations to not receive all args +on 1.8.7 if the block also receives a block, due to Proc#arity reporting +1 no matter how many args the block receives if it receives a +block, too. (Myron Marston)

          +
        + +

        2.14.4 / 2013-10-15

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix issue where unstubing methods on “any instances” would not remove +stubs on existing instances (Jon Rowe)

          +
        • +

          Fix issue with receive(:message) do … end precedence preventing the usage +of modifications (and_return etc) (Jon Rowe)

          +
        + +

        2.14.3 / 2013-08-08

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix stubbing some instance methods for classes whose hierarchy includes a +prepended Module (Bradley Schaefer)

          +
        + +

        2.14.2 / 2013-07-30

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Fix as_null_object doubles so that they return +nil from to_ary (Jon Rowe).

          +
        • +

          Fix regression in 2.14 that made stub! (with an implicit +receiver) return a test double rather than stub a method (Myron Marston).

          +
        + +

        2.14.1 / 2013-07-07

        + +

        Full +Changelog

        + +

        Bug Fixes:

        +
        • +

          Restore double.as_null_object behavior from 2.13 and earlier: +a double's nullness persisted between examples in earlier examples. +While this is not an intended use case (test doubles are meant to live for +only one example), we don't want to break behavior users rely on in a +minor relase. This will be deprecated in 2.99 and removed in 3.0. (Myron +Marston)

          +
        + +

        2.14.0 / 2013-07-06

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Document test spies in the readme. (Adarsh Pandit)

          +
        • +

          Add an array_including matcher. (Sam Phippen)

          +
        • +

          Add a syntax-agnostic API for mocking or stubbing a method. This is +intended for use by libraries such as rspec-rails that need to mock or +stub a method, and work regardless of the syntax the user has configured +(Paul Annesley, Myron Marston and Sam Phippen).

          +
        + +

        Bug Fixes:

        +
        • +

          Fix double so that it sets up passed stubs correctly +regardless of the configured syntax (Paul Annesley).

          +
        • +

          Allow a block implementation to be used in combination with +and_yield, and_raise, and_return or +and_throw. This got fixed in 2.13.1 but failed to get merged +into master for the 2.14.0.rc1 release (Myron Marston).

          +
        • +

          Marshal.dump does not unnecessarily duplicate objects when +rspec-mocks has not been fully initialized. This could cause errors when +using spork or similar preloading gems (Andy Lindeman).

          +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        Full +Changelog

        + +

        Enhancements:

        +
        • +

          Refactor internals so that the mock proxy methods and state are held +outside of the mocked object rather than inside it. This paves the way for +future syntax enhancements and removes the need for some hacky work +arounds for any_instance dup'ing and YAML +serialization, among other things. Note that the code now relies upon +__id__ returning a unique, consistent value for any object +you want to mock or stub (Myron Marston).

          +
        • +

          Add support for test spies. This allows you to verify a message was +received afterwards using the have_received matcher. Note +that you must first stub the method or use a null double. (Joe Ferris and +Joël Quenneville)

          +
        • +

          Make at_least and at_most style receive +expectations print that they were expecting at least or at most some +number of calls, rather than just the number of calls given in the +expectation (Sam Phippen)

          +
        • +

          Make with style receive expectations print the args they were +expecting, and the args that they got (Sam Phippen)

          +
        • +

          Fix some warnings seen under ruby 2.0.0p0 (Sam Phippen).

          +
        • +

          Add a new :expect syntax for message expectations (Myron +Marston and Sam Phippen).

          +
        + +

        Bug fixes

        +
        • +

          Fix any_instance so that a frozen object can be +dup'd when methods have been stubbed on that type using +any_instance (Jon Rowe).

          +
        • +

          Fix and_call_original so that it properly raises an +ArgumentError when the wrong number of args are passed (Jon +Rowe).

          +
        • +

          Fix double on 1.9.2 so you can wrap them in an Array using +Array(my_double) (Jon Rowe).

          +
        • +

          Fix stub_const and hide_const to handle constants +that redefine send (Sam Phippen).

          +
        • +

          Fix Marshal.dump extension so that it correctly handles nil. +(Luke Imhoff, Jon Rowe)

          +
        • +

          Fix isolation of allow_message_expectations_on_nil (Jon Rowe)

          +
        • +

          Use inspect to format actual arguments on expectations in failure messages +(#280, Ben Langfeld)

          +
        + +

        Deprecations

        +
        • +

          Deprecate stub and mock as aliases for +double. double is the best term for creating a +test double, and it reduces confusion to have only one term (Michi Huber).

          +
        • +

          Deprecate stub! and unstub! in favor of +stub and unstub (Jon Rowe).

          +
        • +

          Deprecate at_least(0).times and +any_number_of_times (Michi Huber).

          +
        + +

        2.13.1 / 2013-04-06

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Allow a block implementation to be used in combination with +and_yield, and_raise, and_return or +and_throw (Myron Marston).

          +
        + +

        2.13.0 / 2013-02-23

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix bug that caused weird behavior when a method that had previously been +stubbed with multiple return values (e.g. +obj.stub(:foo).and_return(1, 2)) was later mocked with a +single return value (e.g. +obj.should_receive(:foo).once.and_return(1)). (Myron Marston)

          +
        • +

          Fix bug related to a mock expectation for a method that already had +multiple stubs with different with constraints. Previously, +the first stub was used, even though it may not have matched the passed +args. The fix defers this decision until the message is received so that +the proper stub response can be chosen based on the passed arguments +(Myron Marston).

          +
        • +

          Do not call nil? extra times on a mocked object, in case +nil? itself is expected a set number of times (Myron +Marston).

          +
        • +

          Fix missing_default_stub_error message so array args are +handled properly (Myron Marston).

          +
        • +

          Explicitly disallow any_instance.unstub! (Ryan Jones).

          +
        • +

          Fix any_instance stubbing so that it works with +Delegator subclasses (Myron Marston).

          +
        • +

          Fix and_call_original so that it works with +Delegator subclasses (Myron Marston).

          +
        • +

          Fix any_instance.should_not_receive when +any_instance.should_receive is used on the same class in the +same example. Previously it would wrongly report a failure even when the +message was not received (Myron Marston).

          +
        + +

        2.12.2 / 2013-01-27

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix and_call_original to work properly for methods defined on +a module extended onto an object instance (Myron Marston).

          +
        • +

          Fix stub_const with an undefined constnat name to work +properly with constant strings that are prefixed with :: – +and edge case I missed in the bug fix in the 2.12.1 release (Myron +Marston).

          +
        • +

          Ensure method visibility on a partial mock is restored after reseting +method stubs, even on a singleton module (created via extend +self) when the method visibility differs between the instance and +singleton versions (Andy Lindeman).

          +
        + +

        2.12.1 / 2012-12-21

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix any_instance to support and_call_original. +(Myron Marston)

          +
        • +

          Properly restore stubbed aliased methods on rubies that report the +incorrect owner (Myron Marston and Andy Lindeman).

          +
        • +

          Fix hide_const and stub_const with a defined +constnat name to work properly with constant strings that are prefixed +with :: (Myron Marston).

          +
        + +

        2.12.0 / 2012-11-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          and_raise can accept an exception class and message, more +closely matching Kernel#raise (e.g., +foo.stub(:bar).and_raise(RuntimeError, "message")) +(Bas Vodde)

          +
        • +

          Add and_call_original, which will delegate the message to the +original method (Myron Marston).

          +
        + +

        Deprecations:

        +
        • +

          Add deprecation warning when using and_return with +should_not_receive (Neha Kumari)

          +
        + +

        2.11.3 / 2012-09-19

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix :transfer_nested_constants option of +stub_const so that it doesn't blow up when there are +inherited constants. (Myron Marston)

          +
        • +

          any_instance stubs can be used on classes that override +Object#method. (Andy Lindeman)

          +
        • +

          Methods stubbed with any_instance are unstubbed after the test +finishes. (Andy Lindeman)

          +
        • +

          Fix confusing error message when calling a mocked class method an extra +time with the wrong arguments (Myron Marston).

          +
        + +

        2.11.2 / 2012-08-11

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Don't modify dup on classes that don't support +dup (David Chelimsky)

          +
        • +

          Fix any_instance so that it works properly with methods +defined on a superclass. (Daniel Eguzkiza)

          +
        • +

          Fix stub_const so that it works properly for nested constants +that share a name with a top-level constant (e.g. “MyGem::Hash”). (Myron +Marston)

          +
        + +

        2.11.1 / 2012-07-09

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix should_receive so that when it is called on an +as_null_object double with no implementation, and there is a +previous explicit stub for the same method, the explicit stub remains +(rather than being overriden with the null object +implementation–return self). (Myron Marston)

          +
        + +

        2.11.0 / 2012-07-07

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Expose ArgumentListMatcher as a formal API

          +
          • +

            supports use by 3rd party mock frameworks like Surrogate

            +
          +
        • +

          Add stub_const API to stub constants for the duration of an +example (Myron Marston).

          +
        + +

        Bug fixes

        +
        • +

          Fix regression of edge case behavior. double.should_receive(:foo) { a +} was causing a NoMethodError when +double.stub(:foo).and_return(a, b) had been setup before +(Myron Marston).

          +
        • +

          Infinite loop generated by using any_instance and +dup. (Sidu Ponnappa @kaiwren)

          +
        • +

          double.should_receive(:foo).at_least(:once).and_return(a) +always returns a even if :foo is already stubbed.

          +
        • +

          Prevent infinite loop when interpolating a null double into a string as an +integer ("%i" % double.as_null_object). (Myron +Marston)

          +
        • +

          Fix should_receive so that null object behavior (e.g. +returning self) is preserved if no implementation is given (Myron +Marston).

          +
        • +

          Fix and_raise so that it raises RuntimeError +rather than Exception by default, just like ruby does. +(Andrew Marshall)

          +
        + +

        2.10.1 / 2012-05-05

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fix regression of edge case behavior (github.com/rspec/rspec-mocks/issues/132)

          +
          • +

            fixed failure of +object.should_receive(:message).at_least(0).times.and_return +value

            +
          • +

            fixed failure of object.should_not_receive(:message).and_return +value

            +
          +
        + +

        2.10.0 / 2012-05-03

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fail fast when an exactly or at_most expectation +is exceeded

          +
        + +

        2.9.0 / 2012-03-17

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Support order constraints across objects (preethiramdev)

          +
        + +

        Bug fixes

        +
        • +

          Allow a as_null_object to be passed to with

          +
        • +

          Pass proc to block passed to stub (Aubrey Rhodes)

          +
        • +

          Initialize child message expectation args to match any args (#109 - +preethiramdev)

          +
        + +

        2.8.0 / 2012-01-04

        + +

        Full +Changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc2 / 2011-12-19

        + +

        Full +Changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc1 / 2011-11-06

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Eliminate Ruby warnings (Matijs van Zuijlen)

          +
        + +

        2.7.0 / 2011-10-16

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Use __send__ rather than send (alextk)

          +
        • +

          Add support for any_instance.stub_chain (Sidu Ponnappa)

          +
        • +

          Add support for any_instance argument matching based on +with (Sidu Ponnappa and Andy Lindeman)

          +
        + +

        Changes

        +
        • +

          Check for failure_message_for_should or +failure_message instead of description to detect +a matcher (Tibor Claassen)

          +
        + +

        Bug fixes

        +
        • +

          pass a hash to any_instance.stub. (Justin Ko)

          +
        • +

          allow to_ary to be called without raising +NoMethodError (Mikhail Dieterle)

          +
        • +

          any_instance properly restores private methods (Sidu Ponnappa)

          +
        + +

        2.6.0 / 2011-05-12

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Add support for any_instance.stub and +any_instance.should_receive (Sidu Ponnappa and Andy Lindeman)

          +
        + +

        Bug fixes

        +
        • +

          fix bug in which multiple chains with shared messages ending in hashes +failed to return the correct value

          +
        + +

        2.5.0 / 2011-02-05

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          message expectation counts now work in combination with a stub (Damian +Nurzynski)

          +
        • +

          fix failure message when message received with incorrect args (Josep M. +Bach)

          +
        + +

        2.4.0 / 2011-01-02

        + +

        Full +Changelog

        + +

        No functional changes in this release, which was made to align with the +rspec-core-2.4.0 release.

        + +

        2.3.0 / 2010-12-12

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix our Marshal extension so that it does not interfere with objects that +have their own @mock_proxy instance variable. (Myron Marston)

          +
        + +

        2.2.0 / 2010-11-28

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          Added “rspec/mocks/standalone” for exploring the rspec-mocks in irb.

          +
        + +

        Bug fix

        +
        • +

          Eliminate warning on splat args without parens (Gioele Barabucci)

          +
        • +

          Fix bug where +obj.should_receive(:foo).with(stub.as_null_object) would pass +with a false positive.

          +
        + +

        2.1.0 / 2010-11-07

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          Fix serialization of stubbed object (Josep M Bach)

          +
        + +

        2.0.0 / 2010-10-10

        + +

        Full +Changelog

        + +

        2.0.0.rc / 2010-10-05

        + +

        Full +Changelog

        + +

        Enhancements

        +
        • +

          support passing a block to an expectation block (Nicolas Braem)

          +
          • +

            obj.should_receive(:msg) {|&block| ... }

            +
          +
        + +

        Bug fixes

        +
        • +

          Fix YAML serialization of stub (Myron Marston)

          +
        • +

          Fix rdoc rake task (Hans de Graaff)

          +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        Full +Changelog

        + +

        Bug fixes

        +
        • +

          fixed regression that broke obj.stub_chain(:a, :b => :c)

          +
        • +

          fixed regression that broke obj.stub_chain(:a, :b) { :c }

          +
        • +

          respond_to? always returns true when using +as_null_object

          +
        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/file.License.html b/source/documentation/2.14/rspec-mocks/file.License.html new file mode 100644 index 000000000..1b1eee421 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/file.README.html b/source/documentation/2.14/rspec-mocks/file.README.html new file mode 100644 index 000000000..550fe0c9f --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/file.README.html @@ -0,0 +1,385 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        RSpec Mocks

        + +

        rspec-mocks is a test-double framework for rspec with support for method +stubs, fakes, and message expectations on generated test-doubles and real +objects alike.

        + +

        Install

        + +
        gem install rspec       # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-mocks # for rspec-mocks only
        + +

        Test Doubles

        + +

        A Test Double is an object that stands in for a real object in a test. +RSpec creates test doubles that support method stubs and message +expectations.

        + +
        book = double("book")
        +
        + +

        Method Stubs

        + +

        A method stub is an implementation that returns a pre-determined value. +Method stubs can be declared on test doubles or real objects using the same +syntax. rspec-mocks supports 3 forms for declaring method stubs:

        + +
        book.stub(:title) { "The RSpec Book" }
        +book.stub(:title => "The RSpec Book")
        +book.stub(:title).and_return("The RSpec Book")
        +
        + +

        You can also use this shortcut, which creates a test double and declares a +method stub in one statement:

        + +
        book = double("book", :title => "The RSpec Book")
        +
        + +

        The first argument is a name, which is used for documentation and appears +in failure messages. If you don't care about the name, you can leave it +out, making the combined instantiation/stub declaration very terse:

        + +
        double(:foo => 'bar')
        +
        + +

        This is particularly nice when providing a list of test doubles to a method +that iterates through them:

        + +
        order.calculate_total_price(double(:price => 1.99),double(:price => 2.99))
        +
        + +

        Consecutive return values

        + +

        When a stub might be invoked more than once, you can provide additional +arguments to and_return. The invocations cycle through the +list. The last value is returned for any subsequent invocations:

        + +
        die.stub(:roll).and_return(1,2,3)
        +die.roll # => 1
        +die.roll # => 2
        +die.roll # => 3
        +die.roll # => 3
        +die.roll # => 3
        +
        + +

        To return an array in a single invocation, declare an array:

        + +
        team.stub(:players).and_return([stub(:name => "David")])
        +
        + +

        Message Expectations

        + +

        A message expectation is an expectation that the test double will receive a +message some time before the example ends. If the message is received, the +expectation is satisfied. If not, the example fails.

        + +
        validator = double("validator")
        +validator.should_receive(:validate).with("02134")
        +zipcode = Zipcode.new("02134", validator)
        +zipcode.valid?
        +
        + +

        Nomenclature

        + +

        Mock Objects and Test Stubs

        + +

        The names Mock Object and Test Stub suggest specialized Test Doubles. i.e. +a Test Stub is a Test Double that only supports method stubs, and a Mock +Object is a Test Double that supports message expectations and method +stubs.

        + +

        There is a lot of overlapping nomenclature here, and there are many +variations of these patterns (fakes, spies, etc). Keep in mind that most of +the time we're talking about method-level concepts that are variations +of method stubs and message expectations, and we're applying to them to +one generic kind of object: a Test Double.

        + +

        Test-Specific Extension

        + +

        a.k.a. Partial Stub/Mock, a Test-Specific Extension is an extension of a +real object in a system that is instrumented with test-double like +behaviour in the context of a test. This technique is very common in Ruby +because we often see class objects acting as global namespaces for methods. +For example, in Rails:

        + +
        person = double("person")
        +Person.stub(:find) { person }
        +
        + +

        In this case we're instrumenting Person to return the person object +we've defined whenever it receives the find message. We +can also set a message expectation so that the example fails if +find is not called:

        + +
        person = double("person")
        +Person.should_receive(:find) { person }
        +
        + +

        We can do this with any object in a system because rspec-mocks adds the +stub and should_receive methods to every object, +including class objects. When we use either, RSpec replaces the method +we're stubbing or mocking with its own test-double-like method. At the +end of the example, RSpec verifies any message expectations, and then +restores the original methods.

        + +

        Expecting Arguments

        + +
        double.should_receive(:msg).with(*args)
        +double.should_not_receive(:msg).with(*args)
        +
        + +

        You can set multiple expectations for the same message if you need to:

        + +
        double.should_receive(:msg).with("A", 1, 3)
        +double.should_receive(:msg).with("B", 2, 4)
        +
        + +

        Argument Matchers

        + +

        Arguments that are passed to with are compared with actual +arguments received using ==. In cases in which you want to specify things +about the arguments rather than the arguments themselves, you can use any +of the matchers that ship with rspec-expectations. They don't all make +syntactic sense (they were primarily designed for use with +RSpec::Expectations), but you are free to create your own custom +RSpec::Matchers.

        + +

        rspec-mocks also adds some keyword Symbols that you can use to specify +certain kinds of arguments:

        + +
        double.should_receive(:msg).with(no_args())
        +double.should_receive(:msg).with(any_args())
        +double.should_receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can be any kind of Numeric
        +double.should_receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
        +double.should_receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
        +double.should_receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
        +double.should_receive(:msg).with(1, duck_type(:abs, :div), "b")
        +                    #2nd argument can be object that responds to #abs and #div
        +
        + +

        Receive Counts

        + +
        double.should_receive(:msg).once
        +double.should_receive(:msg).twice
        +double.should_receive(:msg).exactly(n).times
        +double.should_receive(:msg).at_least(:once)
        +double.should_receive(:msg).at_least(:twice)
        +double.should_receive(:msg).at_least(n).times
        +double.should_receive(:msg).at_most(:once)
        +double.should_receive(:msg).at_most(:twice)
        +double.should_receive(:msg).at_most(n).times
        +double.should_receive(:msg).any_number_of_times
        +
        + +

        Ordering

        + +
        double.should_receive(:msg).ordered
        +double.should_receive(:other_msg).ordered
        +  #This will fail if the messages are received out of order
        +
        + +

        This can include the same message with different arguments:

        + +
        double.should_receive(:msg).with("A", 1, 3).ordered
        +double.should_receive(:msg).with("B", 2, 4).ordered
        +
        + +

        Setting Responses

        + +

        Whether you are setting a message expectation or a method stub, you can +tell the object precisely how to respond. The most generic way is to pass a +block to stub or should_receive:

        + +
        double.should_receive(:msg) { value }
        +
        + +

        When the double receives the msg message, it evaluates the +block and returns the result.

        + +
        double.should_receive(:msg).and_return(value)
        +double.should_receive(:msg).exactly(3).times.and_return(value1, value2, value3)
        +  # returns value1 the first time, value2 the second, etc
        +double.should_receive(:msg).and_raise(error)
        +  #error can be an instantiated object or a class
        +  #if it is a class, it must be instantiable with no args
        +double.should_receive(:msg).and_throw(:msg)
        +double.should_receive(:msg).and_yield(values,to,yield)
        +double.should_receive(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
        +  # for methods that yield to a block multiple times
        +
        + +

        Any of these responses can be applied to a stub as well

        + +
        double.stub(:msg).and_return(value)
        +double.stub(:msg).and_return(value1, value2, value3)
        +double.stub(:msg).and_raise(error)
        +double.stub(:msg).and_throw(:msg)
        +double.stub(:msg).and_yield(values,to,yield)
        +double.stub(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
        +
        + +

        Arbitrary Handling

        + +

        Once in a while you'll find that the available expectations don't +solve the particular problem you are trying to solve. Imagine that you +expect the message to come with an Array argument that has a specific +length, but you don't care what is in it. You could do this:

        + +
        double.should_receive(:msg) do |arg|
        +  arg.size.should eq(7)
        +end
        +
        + +

        If the method being stubbed itself takes a block, and you need to yield to +it in some special way, you can use this:

        + +
        double.should_receive(:msg) do |&arg|
        +  begin
        +    arg.call
        +  ensure
        +    # cleanup
        +  end
        +end
        +
        + +

        Delegating to the Original Implementation

        + +

        When working with a partial mock object, you may occasionally want to set a +message expecation without interfering with how the object responds to the +message. You can use and_call_original to achieve this:

        + +
        Person.should_receive(:find).and_call_original
        +Person.find # => executes the original find method and returns the result
        +
        + +

        Combining Expectation Details

        + +

        Combining the message name with specific arguments, receive counts and +responses you can get quite a bit of detail in your expectations:

        + +
        double.should_receive(:<<).with("illegal value").once.and_raise(ArgumentError)
        +
        + +

        While this is a good thing when you really need it, you probably don't +really need it! Take care to specify only the things that matter to the +behavior of your code.

        + +

        Stubbing and Hiding Constants

        + +

        See the mutating +constants README for info on this feature.

        + +

        Use before(:each), not before(:all)

        + +

        Stubs in before(:all) are not supported. The reason is that +all stubs and mocks get cleared out after each example, so any stub that is +set in before(:all) would work in the first example that +happens to run in that group, but not for any others.

        + +

        Instead of before(:all), use before(:each).

        + +

        Further Reading

        + +

        There are many different viewpoints about the meaning of mocks and stubs. +If you are interested in learning more, here is some recommended reading:

        + + +

        Also see

        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/file_list.html b/source/documentation/2.14/rspec-mocks/file_list.html new file mode 100644 index 000000000..4fbe39987 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/file_list.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-mocks/frames.html b/source/documentation/2.14/rspec-mocks/frames.html new file mode 100644 index 000000000..87a4a6df1 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.6 + + + + diff --git a/source/documentation/2.14/rspec-mocks/index.html b/source/documentation/2.14/rspec-mocks/index.html new file mode 100644 index 000000000..20ab406c7 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/index.html @@ -0,0 +1,385 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +
        +

        RSpec Mocks

        + +

        rspec-mocks is a test-double framework for rspec with support for method +stubs, fakes, and message expectations on generated test-doubles and real +objects alike.

        + +

        Install

        + +
        gem install rspec       # for rspec-core, rspec-expectations, rspec-mocks
        +gem install rspec-mocks # for rspec-mocks only
        + +

        Test Doubles

        + +

        A Test Double is an object that stands in for a real object in a test. +RSpec creates test doubles that support method stubs and message +expectations.

        + +
        book = double("book")
        +
        + +

        Method Stubs

        + +

        A method stub is an implementation that returns a pre-determined value. +Method stubs can be declared on test doubles or real objects using the same +syntax. rspec-mocks supports 3 forms for declaring method stubs:

        + +
        book.stub(:title) { "The RSpec Book" }
        +book.stub(:title => "The RSpec Book")
        +book.stub(:title).and_return("The RSpec Book")
        +
        + +

        You can also use this shortcut, which creates a test double and declares a +method stub in one statement:

        + +
        book = double("book", :title => "The RSpec Book")
        +
        + +

        The first argument is a name, which is used for documentation and appears +in failure messages. If you don't care about the name, you can leave it +out, making the combined instantiation/stub declaration very terse:

        + +
        double(:foo => 'bar')
        +
        + +

        This is particularly nice when providing a list of test doubles to a method +that iterates through them:

        + +
        order.calculate_total_price(double(:price => 1.99),double(:price => 2.99))
        +
        + +

        Consecutive return values

        + +

        When a stub might be invoked more than once, you can provide additional +arguments to and_return. The invocations cycle through the +list. The last value is returned for any subsequent invocations:

        + +
        die.stub(:roll).and_return(1,2,3)
        +die.roll # => 1
        +die.roll # => 2
        +die.roll # => 3
        +die.roll # => 3
        +die.roll # => 3
        +
        + +

        To return an array in a single invocation, declare an array:

        + +
        team.stub(:players).and_return([stub(:name => "David")])
        +
        + +

        Message Expectations

        + +

        A message expectation is an expectation that the test double will receive a +message some time before the example ends. If the message is received, the +expectation is satisfied. If not, the example fails.

        + +
        validator = double("validator")
        +validator.should_receive(:validate).with("02134")
        +zipcode = Zipcode.new("02134", validator)
        +zipcode.valid?
        +
        + +

        Nomenclature

        + +

        Mock Objects and Test Stubs

        + +

        The names Mock Object and Test Stub suggest specialized Test Doubles. i.e. +a Test Stub is a Test Double that only supports method stubs, and a Mock +Object is a Test Double that supports message expectations and method +stubs.

        + +

        There is a lot of overlapping nomenclature here, and there are many +variations of these patterns (fakes, spies, etc). Keep in mind that most of +the time we're talking about method-level concepts that are variations +of method stubs and message expectations, and we're applying to them to +one generic kind of object: a Test Double.

        + +

        Test-Specific Extension

        + +

        a.k.a. Partial Stub/Mock, a Test-Specific Extension is an extension of a +real object in a system that is instrumented with test-double like +behaviour in the context of a test. This technique is very common in Ruby +because we often see class objects acting as global namespaces for methods. +For example, in Rails:

        + +
        person = double("person")
        +Person.stub(:find) { person }
        +
        + +

        In this case we're instrumenting Person to return the person object +we've defined whenever it receives the find message. We +can also set a message expectation so that the example fails if +find is not called:

        + +
        person = double("person")
        +Person.should_receive(:find) { person }
        +
        + +

        We can do this with any object in a system because rspec-mocks adds the +stub and should_receive methods to every object, +including class objects. When we use either, RSpec replaces the method +we're stubbing or mocking with its own test-double-like method. At the +end of the example, RSpec verifies any message expectations, and then +restores the original methods.

        + +

        Expecting Arguments

        + +
        double.should_receive(:msg).with(*args)
        +double.should_not_receive(:msg).with(*args)
        +
        + +

        You can set multiple expectations for the same message if you need to:

        + +
        double.should_receive(:msg).with("A", 1, 3)
        +double.should_receive(:msg).with("B", 2, 4)
        +
        + +

        Argument Matchers

        + +

        Arguments that are passed to with are compared with actual +arguments received using ==. In cases in which you want to specify things +about the arguments rather than the arguments themselves, you can use any +of the matchers that ship with rspec-expectations. They don't all make +syntactic sense (they were primarily designed for use with +RSpec::Expectations), but you are free to create your own custom +RSpec::Matchers.

        + +

        rspec-mocks also adds some keyword Symbols that you can use to specify +certain kinds of arguments:

        + +
        double.should_receive(:msg).with(no_args())
        +double.should_receive(:msg).with(any_args())
        +double.should_receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can be any kind of Numeric
        +double.should_receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
        +double.should_receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
        +double.should_receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
        +double.should_receive(:msg).with(1, duck_type(:abs, :div), "b")
        +                    #2nd argument can be object that responds to #abs and #div
        +
        + +

        Receive Counts

        + +
        double.should_receive(:msg).once
        +double.should_receive(:msg).twice
        +double.should_receive(:msg).exactly(n).times
        +double.should_receive(:msg).at_least(:once)
        +double.should_receive(:msg).at_least(:twice)
        +double.should_receive(:msg).at_least(n).times
        +double.should_receive(:msg).at_most(:once)
        +double.should_receive(:msg).at_most(:twice)
        +double.should_receive(:msg).at_most(n).times
        +double.should_receive(:msg).any_number_of_times
        +
        + +

        Ordering

        + +
        double.should_receive(:msg).ordered
        +double.should_receive(:other_msg).ordered
        +  #This will fail if the messages are received out of order
        +
        + +

        This can include the same message with different arguments:

        + +
        double.should_receive(:msg).with("A", 1, 3).ordered
        +double.should_receive(:msg).with("B", 2, 4).ordered
        +
        + +

        Setting Responses

        + +

        Whether you are setting a message expectation or a method stub, you can +tell the object precisely how to respond. The most generic way is to pass a +block to stub or should_receive:

        + +
        double.should_receive(:msg) { value }
        +
        + +

        When the double receives the msg message, it evaluates the +block and returns the result.

        + +
        double.should_receive(:msg).and_return(value)
        +double.should_receive(:msg).exactly(3).times.and_return(value1, value2, value3)
        +  # returns value1 the first time, value2 the second, etc
        +double.should_receive(:msg).and_raise(error)
        +  #error can be an instantiated object or a class
        +  #if it is a class, it must be instantiable with no args
        +double.should_receive(:msg).and_throw(:msg)
        +double.should_receive(:msg).and_yield(values,to,yield)
        +double.should_receive(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
        +  # for methods that yield to a block multiple times
        +
        + +

        Any of these responses can be applied to a stub as well

        + +
        double.stub(:msg).and_return(value)
        +double.stub(:msg).and_return(value1, value2, value3)
        +double.stub(:msg).and_raise(error)
        +double.stub(:msg).and_throw(:msg)
        +double.stub(:msg).and_yield(values,to,yield)
        +double.stub(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
        +
        + +

        Arbitrary Handling

        + +

        Once in a while you'll find that the available expectations don't +solve the particular problem you are trying to solve. Imagine that you +expect the message to come with an Array argument that has a specific +length, but you don't care what is in it. You could do this:

        + +
        double.should_receive(:msg) do |arg|
        +  arg.size.should eq(7)
        +end
        +
        + +

        If the method being stubbed itself takes a block, and you need to yield to +it in some special way, you can use this:

        + +
        double.should_receive(:msg) do |&arg|
        +  begin
        +    arg.call
        +  ensure
        +    # cleanup
        +  end
        +end
        +
        + +

        Delegating to the Original Implementation

        + +

        When working with a partial mock object, you may occasionally want to set a +message expecation without interfering with how the object responds to the +message. You can use and_call_original to achieve this:

        + +
        Person.should_receive(:find).and_call_original
        +Person.find # => executes the original find method and returns the result
        +
        + +

        Combining Expectation Details

        + +

        Combining the message name with specific arguments, receive counts and +responses you can get quite a bit of detail in your expectations:

        + +
        double.should_receive(:<<).with("illegal value").once.and_raise(ArgumentError)
        +
        + +

        While this is a good thing when you really need it, you probably don't +really need it! Take care to specify only the things that matter to the +behavior of your code.

        + +

        Stubbing and Hiding Constants

        + +

        See the mutating +constants README for info on this feature.

        + +

        Use before(:each), not before(:all)

        + +

        Stubs in before(:all) are not supported. The reason is that +all stubs and mocks get cleared out after each example, so any stub that is +set in before(:all) would work in the first example that +happens to run in that group, but not for any others.

        + +

        Instead of before(:all), use before(:each).

        + +

        Further Reading

        + +

        There are many different viewpoints about the meaning of mocks and stubs. +If you are interested in learning more, here is some recommended reading:

        + + +

        Also see

        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-mocks/method_list.html b/source/documentation/2.14/rspec-mocks/method_list.html new file mode 100644 index 000000000..96da252f5 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/method_list.html @@ -0,0 +1,1401 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-mocks/top-level-namespace.html b/source/documentation/2.14/rspec-mocks/top-level-namespace.html new file mode 100644 index 000000000..f7b6bf818 --- /dev/null +++ b/source/documentation/2.14/rspec-mocks/top-level-namespace.html @@ -0,0 +1,114 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Backports, Kernel, Marshal, RSpec + + + + Classes: Method, Proc + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file From b792065c0247d5eda3f26e7fb6ae1bafabc605ea Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Dec 2014 08:31:46 +1100 Subject: [PATCH 14/14] rspec-expectations 2.14 documentation --- .../2.14/rspec-expectations/RSpec.html | 133 + .../RSpec/Expectations.html | 485 +++ .../Expectations/DeprecatedConstants.html | 208 ++ .../RSpec/Expectations/Deprecation.html | 136 + .../RSpec/Expectations/Differ.html | 348 ++ .../Expectations/ExpectationHandler.html | 205 + .../Expectations/ExpectationNotMetError.html | 125 + .../RSpec/Expectations/ExpectationTarget.html | 848 +++++ .../NegativeExpectationHandler.html | 242 ++ .../PositiveExpectationHandler.html | 238 ++ .../RSpec/Expectations/Syntax.html | 1263 +++++++ .../Syntax/ExpectExpressionGenerator.html | 266 ++ .../Syntax/ShouldExpressionGenerator.html | 266 ++ .../rspec-expectations/RSpec/Matchers.html | 3314 +++++++++++++++++ .../RSpec/Matchers/BuiltIn.html | 119 + .../RSpec/Matchers/BuiltIn/BaseMatcher.html | 1000 +++++ .../RSpec/Matchers/BuiltIn/Be.html | 414 ++ .../RSpec/Matchers/BuiltIn/BeAKindOf.html | 233 ++ .../Matchers/BuiltIn/BeAnInstanceOf.html | 285 ++ .../RSpec/Matchers/BuiltIn/BeComparedTo.html | 563 +++ .../RSpec/Matchers/BuiltIn/BeFalse.html | 337 ++ .../RSpec/Matchers/BuiltIn/BeHelpers.html | 109 + .../RSpec/Matchers/BuiltIn/BeNil.html | 337 ++ .../RSpec/Matchers/BuiltIn/BePredicate.html | 516 +++ .../RSpec/Matchers/BuiltIn/BeTrue.html | 337 ++ .../RSpec/Matchers/BuiltIn/BeWithin.html | 564 +++ .../RSpec/Matchers/BuiltIn/Change.html | 950 +++++ .../RSpec/Matchers/BuiltIn/Cover.html | 396 ++ .../RSpec/Matchers/BuiltIn/EndWith.html | 342 ++ .../RSpec/Matchers/BuiltIn/Eq.html | 407 ++ .../RSpec/Matchers/BuiltIn/Eql.html | 411 ++ .../RSpec/Matchers/BuiltIn/Equal.html | 441 +++ .../RSpec/Matchers/BuiltIn/Exist.html | 340 ++ .../RSpec/Matchers/BuiltIn/Has.html | 442 +++ .../RSpec/Matchers/BuiltIn/Have.html | 894 +++++ .../RSpec/Matchers/BuiltIn/Include.html | 526 +++ .../RSpec/Matchers/BuiltIn/Match.html | 307 ++ .../RSpec/Matchers/BuiltIn/MatchArray.html | 413 ++ .../BuiltIn/NegativeOperatorMatcher.html | 210 ++ .../BuiltIn/PositiveOperatorMatcher.html | 220 ++ .../RSpec/Matchers/BuiltIn/RaiseError.html | 730 ++++ .../RSpec/Matchers/BuiltIn/RespondTo.html | 630 ++++ .../RSpec/Matchers/BuiltIn/Satisfy.html | 446 +++ .../Matchers/BuiltIn/StartAndEndWith.html | 436 +++ .../RSpec/Matchers/BuiltIn/StartWith.html | 342 ++ .../RSpec/Matchers/BuiltIn/ThrowSymbol.html | 526 +++ .../RSpec/Matchers/BuiltIn/YieldControl.html | 766 ++++ .../RSpec/Matchers/BuiltIn/YieldProbe.html | 807 ++++ .../Matchers/BuiltIn/YieldSuccessiveArgs.html | 458 +++ .../RSpec/Matchers/BuiltIn/YieldWithArgs.html | 450 +++ .../Matchers/BuiltIn/YieldWithNoArgs.html | 361 ++ .../RSpec/Matchers/Configuration.html | 708 ++++ .../RSpec/Matchers/DSL.html | 220 ++ .../RSpec/Matchers/DSL/Matcher.html | 1769 +++++++++ .../RSpec/Matchers/Extensions.html | 115 + .../Extensions/InstanceEvalWithArgs.html | 239 ++ .../RSpec/Matchers/OperatorMatcher.html | 631 ++++ .../RSpec/Matchers/Pretty.html | 605 +++ .../2.14/rspec-expectations/_index.html | 622 ++++ .../2.14/rspec-expectations/class_list.html | 54 + .../rspec-expectations/file.Changelog.html | 610 +++ .../2.14/rspec-expectations/file.License.html | 73 + .../2.14/rspec-expectations/file.README.html | 248 ++ .../2.14/rspec-expectations/file_list.html | 62 + .../2.14/rspec-expectations/frames.html | 26 + .../2.14/rspec-expectations/index.html | 248 ++ .../2.14/rspec-expectations/method_list.html | 1745 +++++++++ .../top-level-namespace.html | 138 + 68 files changed, 33255 insertions(+) create mode 100644 source/documentation/2.14/rspec-expectations/RSpec.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/DeprecatedConstants.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/Deprecation.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/Differ.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationHandler.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationNotMetError.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationTarget.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/NegativeExpectationHandler.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/PositiveExpectationHandler.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax/ExpectExpressionGenerator.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax/ShouldExpressionGenerator.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalse.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeHelpers.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeTrue.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Have.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/MatchArray.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/NegativeOperatorMatcher.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/PositiveOperatorMatcher.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldProbe.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/Configuration.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/DSL.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/DSL/Matcher.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/Extensions.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/Extensions/InstanceEvalWithArgs.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/OperatorMatcher.html create mode 100644 source/documentation/2.14/rspec-expectations/RSpec/Matchers/Pretty.html create mode 100644 source/documentation/2.14/rspec-expectations/_index.html create mode 100644 source/documentation/2.14/rspec-expectations/class_list.html create mode 100644 source/documentation/2.14/rspec-expectations/file.Changelog.html create mode 100644 source/documentation/2.14/rspec-expectations/file.License.html create mode 100644 source/documentation/2.14/rspec-expectations/file.README.html create mode 100644 source/documentation/2.14/rspec-expectations/file_list.html create mode 100644 source/documentation/2.14/rspec-expectations/frames.html create mode 100644 source/documentation/2.14/rspec-expectations/index.html create mode 100644 source/documentation/2.14/rspec-expectations/method_list.html create mode 100644 source/documentation/2.14/rspec-expectations/top-level-namespace.html diff --git a/source/documentation/2.14/rspec-expectations/RSpec.html b/source/documentation/2.14/rspec-expectations/RSpec.html new file mode 100644 index 000000000..8e0dbe512 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec.html @@ -0,0 +1,133 @@ + + + + + + Module: RSpec + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec + + + +

        + +
        + + + +
        Extended by:
        +
        Expectations::Deprecation
        + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers.rb,
        + lib/rspec/expectations.rb,
        lib/rspec/matchers/dsl.rb,
        lib/rspec/matchers/pretty.rb,
        lib/rspec/matchers/matcher.rb,
        lib/rspec/matchers/be_close.rb,
        lib/rspec/matchers/built_in.rb,
        lib/rspec/expectations/errors.rb,
        lib/rspec/expectations/syntax.rb,
        lib/rspec/expectations/differ.rb,
        lib/rspec/matchers/built_in/be.rb,
        lib/rspec/expectations/version.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/expectations/handler.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/matchers/built_in/have.rb,
        lib/rspec/expectations/fail_with.rb,
        lib/rspec/matchers/configuration.rb,
        lib/rspec/matchers/method_missing.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/expectations/deprecation.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/operator_matcher.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/match_array.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/expectations/extensions/object.rb,
        lib/rspec/expectations/expectation_target.rb,
        lib/rspec/matchers/generated_descriptions.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb,
        lib/rspec/matchers/extensions/instance_eval_with_args.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: Expectations, Matchers + + + + +

        + + + +

        Constant Summary

        + +

        Constants included + from Expectations::Deprecation

        +

        Expectations::Deprecation::ADDITIONAL_TOP_LEVEL_FILES, Expectations::Deprecation::LIB_REGEX, Expectations::Deprecation::RSPEC_LIBS

        + + + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations.html new file mode 100644 index 000000000..891740bb1 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations.html @@ -0,0 +1,485 @@ + + + + + + Module: RSpec::Expectations + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations.rb,
        + lib/rspec/expectations/errors.rb,
        lib/rspec/expectations/syntax.rb,
        lib/rspec/expectations/differ.rb,
        lib/rspec/expectations/version.rb,
        lib/rspec/expectations/handler.rb,
        lib/rspec/expectations/fail_with.rb,
        lib/rspec/expectations/deprecation.rb,
        lib/rspec/expectations/extensions/object.rb,
        lib/rspec/expectations/expectation_target.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        RSpec::Expectations adds two instance methods to every object:

        + +
        should(matcher=nil)
        +should_not(matcher=nil)
        +
        + +

        Both methods take an optional matcher object (See +RSpec::Matchers). When should is invoked with a +matcher, it turns around and calls matcher.matches?(self). For example, +in the expression:

        + +
        order.total.should eq(Money.new(5.55, :USD))
        +
        + +

        the should method invokes the equivalent of eq.matches?(order.total). If +matches? returns true, the expectation is met and execution continues. If +false, then the spec fails with the message returned by +eq.failure_message_for_should.

        + +

        Given the expression:

        + +
        order.entries.should_not include(entry)
        +
        + +

        the should_not method invokes the equivalent of +include.matches?(order.entries), but it interprets false as success, and +true as a failure, using the message generated by +eq.failure_message_for_should_not.

        + +

        rspec-expectations ships with a standard set of useful matchers, and writing +your own matchers is quite simple.

        + +

        See RSpec::Matchers for more information about the +built-in matchers that ship with rspec-expectations, and how to write your +own custom matchers.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: DeprecatedConstants, Deprecation, Syntax + + + + Classes: Differ, ExpectationHandler, ExpectationNotMetError, ExpectationTarget, NegativeExpectationHandler, PositiveExpectationHandler + + +

        + +

        Constant Summary

        + +
        + +
        KERNEL_METHOD_METHOD = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        +
        +
        ::Kernel.instance_method(:method)
        + +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) fail_with(message, expected = nil, actual = nil) + + + + + +

        +
        +

        Raises an RSpec::Expectations::ExpectationNotMetError with message. +Adds a diff to the failure message when expected and actual are +both present.

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + message + + + (String) + + + +
        • + +
        • + + expected + + + (Object) + + + (defaults to: nil) + + +
        • + +
        • + + actual + + + (Object) + + + (defaults to: nil) + + +
        • + +
        + +

        Raises:

        + + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/expectations/fail_with.rb', line 16
        +
        +def fail_with(message, expected=nil, actual=nil)
        +  if !message
        +    raise ArgumentError, "Failure message is nil. Does your matcher define the " +
        +                         "appropriate failure_message_for_* method to return a string?"
        +  end
        +
        +  if actual && expected
        +    if all_strings?(actual, expected)
        +      if any_multiline_strings?(actual, expected)
        +        message << "\nDiff:" << differ.diff_as_string(coerce_to_string(actual), coerce_to_string(expected))
        +      end
        +    elsif no_procs?(actual, expected) && no_numbers?(actual, expected)
        +      message << "\nDiff:" << differ.diff_as_object(actual, expected)
        +    end
        +  end
        +
        +  raise(RSpec::Expectations::ExpectationNotMetError.new(message))
        +end
        +
        +
        + +
        +

        + + + (Object) method_handle_for(object, method_name) + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/expectations.rb', line 60
        +
        +def self.method_handle_for(object, method_name)
        +  KERNEL_METHOD_METHOD.bind(object).call(method_name)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) differ=(ignore) + + + + + +

        +
        +
        Deprecated.

        (no replacement)

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/expectations/extensions/object.rb', line 23
        +
        +def differ=(ignore)
        +  RSpec.deprecate("RSpec::Expectations.differ=(differ)")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/DeprecatedConstants.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/DeprecatedConstants.html new file mode 100644 index 000000000..c0aaf3756 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/DeprecatedConstants.html @@ -0,0 +1,208 @@ + + + + + + Module: RSpec::Expectations::DeprecatedConstants + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::DeprecatedConstants + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/extensions/object.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) const_missing(name) + + + + + +

        +
        +

        Displays deprecation warning when it captures Rspec and Spec. Otherwise +delegates to super.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/expectations/extensions/object.rb', line 6
        +
        +def const_missing(name)
        +  case name
        +  when :Rspec, :Spec
        +    RSpec.deprecate(name.to_s, :replacement => "RSpec")
        +    RSpec
        +  else
        +    begin
        +      super
        +    rescue Exception => e
        +      e.backtrace.reject! {|l| l =~ Regexp.compile(__FILE__) }
        +      raise e
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Deprecation.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Deprecation.html new file mode 100644 index 000000000..62d190cc7 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Deprecation.html @@ -0,0 +1,136 @@ + + + + + + Module: RSpec::Expectations::Deprecation + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Deprecation + + + +

        + +
        + + + + + + + +
        Included in:
        +
        RSpec
        + + + +
        Defined in:
        +
        lib/rspec/expectations/deprecation.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        RSPEC_LIBS = + +
        +
        %w[
        +core
        +mocks
        +expectations
        +matchers
        +rails
        + +
        ADDITIONAL_TOP_LEVEL_FILES = + +
        +
        %w[ autorun ]
        + +
        LIB_REGEX = + +
        +
        %r{/lib/rspec/(#{(RSPEC_LIBS + ADDITIONAL_TOP_LEVEL_FILES).join('|')})(\.rb|/)}
        + +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Differ.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Differ.html new file mode 100644 index 000000000..27f46000c --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Differ.html @@ -0,0 +1,348 @@ + + + + + + Class: RSpec::Expectations::Differ + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::Differ + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/differ.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) diff_as_object(actual, expected) + + + + + +

        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/expectations/differ.rb', line 58
        +
        +def diff_as_object(actual, expected)
        +  actual_as_string = object_to_string(actual)
        +  expected_as_string = object_to_string(expected)
        +  if diff = diff_as_string(actual_as_string, expected_as_string)
        +    color_diff diff
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) diff_as_string(input_data_new, input_data_old) + + + + + +

        +
        +

        This is snagged from diff/lcs/ldiff.rb (which is a commandline tool)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +
        +
        # File 'lib/rspec/expectations/differ.rb', line 10
        +
        +def diff_as_string(input_data_new, input_data_old)
        +  encoding = pick_encoding input_data_new, input_data_old
        +  output = matching_encoding("", encoding)
        +  data_old = input_data_old.split(matching_encoding("\n", encoding)).map! { |e| e.chomp }
        +  data_new = input_data_new.split(matching_encoding("\n", encoding)).map! { |e| e.chomp }
        +  diffs = Diff::LCS.diff(data_old, data_new)
        +  return output if diffs.empty?
        +  oldhunk = hunk = nil
        +  file_length_difference = 0
        +  diffs.each do |piece|
        +    begin
        +      hunk = Diff::LCS::Hunk.new(
        +        data_old, data_new, piece, context_lines, file_length_difference
        +      )
        +      file_length_difference = hunk.file_length_difference
        +      next unless oldhunk
        +      # Hunks may overlap, which is why we need to be careful when our
        +      # diff includes lines of context. Otherwise, we might print
        +      # redundant lines.
        +      if (context_lines > 0) and hunk.overlaps?(oldhunk)
        +        if hunk.respond_to?(:merge)
        +          # diff-lcs 1.2.x
        +          hunk.merge(oldhunk)
        +        else
        +          # diff-lcs 1.1.3
        +          hunk.unshift(oldhunk)
        +        end
        +      else
        +        output << matching_encoding(oldhunk.diff(format).to_s, encoding)
        +      end
        +    ensure
        +      oldhunk = hunk
        +      output << matching_encoding("\n", encoding)
        +    end
        +  end
        +  #Handle the last remaining hunk
        +  output << matching_encoding(oldhunk.diff(format).to_s, encoding)
        +  output << matching_encoding("\n", encoding)
        +  color_diff output
        +rescue Encoding::CompatibilityError
        +  if input_data_new.encoding != input_data_old.encoding
        +    "Could not produce a diff because the encoding of the actual string (#{input_data_old.encoding}) "+
        +    "differs from the encoding of the expected string (#{input_data_new.encoding})"
        +  else
        +    "Could not produce a diff because of the encoding of the string (#{input_data_old.encoding})"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationHandler.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationHandler.html new file mode 100644 index 000000000..a6e13b76a --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationHandler.html @@ -0,0 +1,205 @@ + + + + + + Class: RSpec::Expectations::ExpectationHandler + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::ExpectationHandler + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/handler.rb
        + +
        +
        + + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) check_message(msg) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/expectations/handler.rb', line 5
        +
        +def self.check_message(msg)
        +  unless msg.nil? || msg.respond_to?(:to_str) || msg.respond_to?(:call)
        +    ::Kernel.warn [
        +      "WARNING: ignoring the provided expectation message argument (",
        +      msg.inspect,
        +      ") since it is not a string or a proc."
        +    ].join
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationNotMetError.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationNotMetError.html new file mode 100644 index 000000000..00a0925bb --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationNotMetError.html @@ -0,0 +1,125 @@ + + + + + + Exception: RSpec::Expectations::ExpectationNotMetError + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Exception: RSpec::Expectations::ExpectationNotMetError + + + +

        + +
        + +
        Inherits:
        +
        + StandardError + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/errors.rb,
        + lib/rspec/expectations/errors.rb
        +
        + +
        +
        + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationTarget.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationTarget.html new file mode 100644 index 000000000..6b96a59e3 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/ExpectationTarget.html @@ -0,0 +1,848 @@ + + + + + + Class: RSpec::Expectations::ExpectationTarget + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::ExpectationTarget + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/expectation_target.rb
        + +
        +
        + +

        Overview

        +
        +

        Wraps the target of an expectation.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(something) # => ExpectationTarget wrapping something
        +
        +# used with `to`
        +expect(actual).to eq(3)
        +
        +# with `not_to`
        +expect(actual).not_to eq(3)
        + +
        + + +
        + + + +

        Class Attribute Summary (collapse)

        +
          + +
        • + + + + (Object) deprecated_should_enabled + + + + (also: deprecated_should_enabled?) + + + + + + + + + + + + + + +

          Returns the value of attribute deprecated_should_enabled.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ExpectationTarget) initialize(target) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of ExpectationTarget

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 19
        +
        +def initialize(target)
        +  @target = target
        +end
        +
        +
        + +
        + +
        +

        Class Attribute Details

        + + + +
        +

        + + + (Object) deprecated_should_enabled + + + + Also known as: + deprecated_should_enabled? + + + + +

        +
        +

        Returns the value of attribute deprecated_should_enabled

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 14
        +
        +def deprecated_should_enabled
        +  @deprecated_should_enabled
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) disable_deprecated_should + + + + + +

        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 67
        +
        +def self.disable_deprecated_should
        +  return unless deprecated_should_enabled?
        +
        +  remove_method :should
        +  remove_method :should_not
        +
        +  self.deprecated_should_enabled = false
        +end
        +
        +
        + +
        +

        + + + (Object) enable_deprecated_should + + + + + +

        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 51
        +
        +def self.enable_deprecated_should
        +  return if deprecated_should_enabled?
        +
        +  def should(*args)
        +    RSpec.deprecate "`expect { }.should`", :replacement => "`expect { }.to`"
        +    @target.should(*args)
        +  end
        +
        +  def should_not(*args)
        +    RSpec.deprecate "`expect { }.should_not`", :replacement => "`expect { }.not_to`"
        +    @target.should_not(*args)
        +  end
        +
        +  self.deprecated_should_enabled = true
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) not_to(matcher = nil, message = nil, &block) + + + + Also known as: + to_not + + + + +

        +
        +

        Runs the given expectation, passing if matcher returns false.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(value).not_to eq(5)
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (String) + + + (defaults to: nil) + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          false if the negative expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 45
        +
        +def not_to(matcher=nil, message=nil, &block)
        +  prevent_operator_matchers(:not_to, matcher)
        +  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(@target, matcher, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) should(*args) + + + + + +

        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 54
        +
        +def should(*args)
        +  RSpec.deprecate "`expect { }.should`", :replacement => "`expect { }.to`"
        +  @target.should(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) should_not(*args) + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 59
        +
        +def should_not(*args)
        +  RSpec.deprecate "`expect { }.should_not`", :replacement => "`expect { }.not_to`"
        +  @target.should_not(*args)
        +end
        +
        +
        + +
        +

        + + - (Boolean) to(matcher = nil, message = nil, &block) + + + + + +

        +
        +

        Runs the given expectation, passing if matcher returns true.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(value).to eq(5)
        +expect { perform }.to raise_error
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (String) + + + (defaults to: nil) + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if the expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/expectations/expectation_target.rb', line 32
        +
        +def to(matcher=nil, message=nil, &block)
        +  prevent_operator_matchers(:to, matcher)
        +  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(@target, matcher, message, &block)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/NegativeExpectationHandler.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/NegativeExpectationHandler.html new file mode 100644 index 000000000..3ab3fbd9a --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/NegativeExpectationHandler.html @@ -0,0 +1,242 @@ + + + + + + Class: RSpec::Expectations::NegativeExpectationHandler + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::NegativeExpectationHandler + + + +

        + +
        + +
        Inherits:
        +
        + ExpectationHandler + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/handler.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from ExpectationHandler

        +

        check_message

        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) handle_matcher(actual, matcher, message = nil, &block) + + + + + +

        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/expectations/handler.rb', line 42
        +
        +def self.handle_matcher(actual, matcher, message=nil, &block)
        +  check_message(message)
        +  ::RSpec::Matchers.last_should = :should_not
        +  ::RSpec::Matchers.last_matcher = matcher
        +  return ::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher.new(actual) if matcher.nil?
        +
        +  match = matcher.respond_to?(:does_not_match?) ?
        +          !matcher.does_not_match?(actual, &block) :
        +          matcher.matches?(actual, &block)
        +  return match unless match
        +
        +  message = message.call if message.respond_to?(:call)
        +
        +  message ||= matcher.respond_to?(:failure_message_for_should_not) ?
        +              matcher.failure_message_for_should_not :
        +              matcher.negative_failure_message
        +
        +  if matcher.respond_to?(:diffable?) && matcher.diffable?
        +    ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual
        +  else
        +    ::RSpec::Expectations.fail_with message
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/PositiveExpectationHandler.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/PositiveExpectationHandler.html new file mode 100644 index 000000000..4a1a4b97e --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/PositiveExpectationHandler.html @@ -0,0 +1,238 @@ + + + + + + Class: RSpec::Expectations::PositiveExpectationHandler + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Expectations::PositiveExpectationHandler + + + +

        + +
        + +
        Inherits:
        +
        + ExpectationHandler + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/handler.rb
        + +
        +
        + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from ExpectationHandler

        +

        check_message

        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) handle_matcher(actual, matcher, message = nil, &block) + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/expectations/handler.rb', line 18
        +
        +def self.handle_matcher(actual, matcher, message=nil, &block)
        +  check_message(message)
        +  ::RSpec::Matchers.last_should = :should
        +  ::RSpec::Matchers.last_matcher = matcher
        +  return ::RSpec::Matchers::BuiltIn::PositiveOperatorMatcher.new(actual) if matcher.nil?
        +
        +  match = matcher.matches?(actual, &block)
        +  return match if match
        +
        +  message = message.call if message.respond_to?(:call)
        +
        +  message ||= matcher.respond_to?(:failure_message_for_should) ?
        +              matcher.failure_message_for_should :
        +              matcher.failure_message
        +
        +  if matcher.respond_to?(:diffable?) && matcher.diffable?
        +    ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual
        +  else
        +    ::RSpec::Expectations.fail_with message
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax.html new file mode 100644 index 000000000..83308550a --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax.html @@ -0,0 +1,1263 @@ + + + + + + Module: RSpec::Expectations::Syntax + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Syntax + + + Private +

        + +
        + + + +
        Extended by:
        +
        Syntax
        + + + + + + +
        Included in:
        +
        Syntax
        + + + +
        Defined in:
        +
        lib/rspec/expectations/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Provides methods for enabling and disabling the available +syntaxes provided by rspec-expectations.

        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: ExpectExpressionGenerator, ShouldExpressionGenerator + + + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) default_should_host + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Determines where we add should and should_not.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 42
        +
        +def default_should_host
        +  @default_should_host ||= ::Object.ancestors.last
        +end
        +
        +
        + +
        +

        + + - (Object) disable_expect(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Disables the expect syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +103
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 95
        +
        +def disable_expect(syntax_host = ::RSpec::Matchers)
        +  return unless expect_enabled?(syntax_host)
        +
        +  syntax_host.module_eval do
        +    undef expect
        +  end
        +
        +  ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should
        +end
        +
        +
        + +
        +

        + + - (Object) disable_should(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Disables the should syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +66
        +67
        +68
        +69
        +70
        +71
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 66
        +
        +def disable_should(syntax_host = default_should_host)
        +  return unless should_enabled?(syntax_host)
        +
        +  syntax_host.module_eval do
        +    undef should
        +    undef should_not
        +  end
        +
        +  ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should
        +end
        +
        +
        + +
        +

        + + - (Object) enable_expect(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Enables the expect syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 79
        +
        +def enable_expect(syntax_host = ::RSpec::Matchers)
        +  return if expect_enabled?(syntax_host)
        +
        +  syntax_host.module_eval do
        +    def expect(*target, &target_block)
        +      target << target_block if block_given?
        +      raise ArgumentError.new("You must pass an argument or a block to #expect but not both.") unless target.size == 1
        +      ::RSpec::Expectations::ExpectationTarget.new(target.first)
        +    end
        +  end
        +
        +  ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if should_enabled?
        +end
        +
        +
        + +
        +

        + + - (Object) enable_should(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Enables the should syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 48
        +
        +def enable_should(syntax_host = default_should_host)
        +  return if should_enabled?(syntax_host)
        +
        +  syntax_host.module_eval do
        +    def should(matcher=nil, message=nil, &block)
        +      ::RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
        +    end
        +
        +    def should_not(matcher=nil, message=nil, &block)
        +      ::RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
        +    end
        +  end
        +
        +  ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if expect_enabled?
        +end
        +
        +
        + +
        +

        + + - (ExpectationTarget) expect + + + + + +

        +
        +

        Supports expect(actual).to matcher syntax by wrapping actual in an +ExpectationTarget.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(actual).to eq(expected)
        +expect(actual).not_to eq(expected)
        + +
        + +

        Returns:

        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 30
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) expect_enabled?(syntax_host = ::RSpec::Matchers) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates whether or not the expect syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 113
        +
        +def expect_enabled?(syntax_host = ::RSpec::Matchers)
        +  syntax_host.method_defined?(:expect)
        +end
        +
        +
        + +
        +

        + + - (Object) expression_generator + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Selects which expression generator to use based on the configured syntax.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +131
        +132
        +133
        +134
        +135
        +136
        +137
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 131
        +
        +def expression_generator
        +  if expect_enabled?
        +    ExpectExpressionGenerator
        +  else
        +    ShouldExpressionGenerator
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) negative_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Generates a negative expectation expression.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +125
        +126
        +127
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 125
        +
        +def negative_expression(target_expression, matcher_expression)
        +  expression_generator.negative_expression(target_expression, matcher_expression)
        +end
        +
        +
        + +
        +

        + + - (Object) positive_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Generates a positive expectation expression.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +119
        +120
        +121
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 119
        +
        +def positive_expression(target_expression, matcher_expression)
        +  expression_generator.positive_expression(target_expression, matcher_expression)
        +end
        +
        +
        + +
        +

        + + - (Boolean) should + + + + + +

        +
        +

        Passes if matcher returns true. Available on every Object.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        actual.should eq expected
        +actual.should match /expression/
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + +
        • + +
        • + + message + + + (String) + + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          true if the expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 9
        +
        +
        +
        +
        + +
        +

        + + - (Boolean) should_enabled?(syntax_host = default_should_host) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Indicates whether or not the should syntax is enabled.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 107
        +
        +def should_enabled?(syntax_host = default_should_host)
        +  syntax_host.method_defined?(:should)
        +end
        +
        +
        + +
        +

        + + - (Boolean) should_not + + + + + +

        +
        +

        Passes if matcher returns false. Available on every Object.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        actual.should_not eq expected
        + +
        +

        Parameters:

        +
          + +
        • + + matcher + + + (Matcher) + + + +
        • + +
        • + + message + + + (String) + + + + — +

          optional message to display when the expectation fails

          +
          + +
        • + +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + + — +

          false if the negative expectation succeeds (else raises)

          +
          + +
        • + +
        + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 20
        +
        +
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax/ExpectExpressionGenerator.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax/ExpectExpressionGenerator.html new file mode 100644 index 000000000..44aec8841 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax/ExpectExpressionGenerator.html @@ -0,0 +1,266 @@ + + + + + + Module: RSpec::Expectations::Syntax::ExpectExpressionGenerator + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Syntax::ExpectExpressionGenerator + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Generates expectation expressions for the expect syntax.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) negative_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +158
        +159
        +160
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 158
        +
        +def self.negative_expression(target_expression, matcher_expression)
        +  "expect(#{target_expression}).not_to #{matcher_expression}"
        +end
        +
        +
        + +
        +

        + + + (Object) positive_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +154
        +155
        +156
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 154
        +
        +def self.positive_expression(target_expression, matcher_expression)
        +  "expect(#{target_expression}).to #{matcher_expression}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax/ShouldExpressionGenerator.html b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax/ShouldExpressionGenerator.html new file mode 100644 index 000000000..9eb70df4f --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Expectations/Syntax/ShouldExpressionGenerator.html @@ -0,0 +1,266 @@ + + + + + + Module: RSpec::Expectations::Syntax::ShouldExpressionGenerator + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Expectations::Syntax::ShouldExpressionGenerator + + + Private +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/expectations/syntax.rb
        + +
        +
        + +

        Overview

        +
        +

        + This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

        +

        Generates expectation expressions for the should syntax.

        + + +
        +
        +
        + + +
        + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + + + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) negative_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +146
        +147
        +148
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 146
        +
        +def self.negative_expression(target_expression, matcher_expression)
        +  "#{target_expression}.should_not #{matcher_expression}"
        +end
        +
        +
        + +
        +

        + + + (Object) positive_expression(target_expression, matcher_expression) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +142
        +143
        +144
        +
        +
        # File 'lib/rspec/expectations/syntax.rb', line 142
        +
        +def self.positive_expression(target_expression, matcher_expression)
        +  "#{target_expression}.should #{matcher_expression}"
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers.html new file mode 100644 index 000000000..bba85ace1 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers.html @@ -0,0 +1,3314 @@ + + + + + + Module: RSpec::Matchers + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers.rb,
        + lib/rspec/matchers/dsl.rb,
        lib/rspec/matchers/pretty.rb,
        lib/rspec/matchers/matcher.rb,
        lib/rspec/matchers/be_close.rb,
        lib/rspec/matchers/built_in.rb,
        lib/rspec/matchers/built_in/be.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/matchers/built_in/have.rb,
        lib/rspec/matchers/configuration.rb,
        lib/rspec/matchers/method_missing.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/operator_matcher.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/match_array.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/matchers/generated_descriptions.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb,
        lib/rspec/matchers/extensions/instance_eval_with_args.rb
        +
        + +
        +
        + +

        Overview

        +
        +

        RSpec::Matchers provides a number of useful matchers we use to define +expectations. A matcher is any object that responds to the following:

        + +
        matches?(actual)
        +failure_message_for_should
        +
        + +

        These methods are also part of the matcher protocol, but are optional:

        + +
        does_not_match?(actual)
        +failure_message_for_should_not
        +description
        +
        + +

        Predicates

        + +

        In addition to matchers that are defined explicitly, RSpec will create +custom matchers on the fly for any arbitrary predicate, giving your specs a +much more natural language feel.

        + +

        A Ruby predicate is a method that ends with a "?" and returns true or false. +Common examples are empty?, nil?, and instance_of?.

        + +

        All you need to do is write expect(..).to be_ followed by the predicate +without the question mark, and RSpec will figure it out from there. +For example:

        + +
        expect([]).to be_empty     # => [].empty?() | passes
        +expect([]).not_to be_empty # => [].empty?() | fails
        +
        + +

        In addtion to prefixing the predicate matchers with "be", you can also use "be_a" +and "bean", making your specs read much more naturally:

        + +
        expect("a string").to be_an_instance_of(String) # =>"a string".instance_of?(String) # passes
        +
        +expect(3).to be_a_kind_of(Fixnum)        # => 3.kind_of?(Numeric)     | passes
        +expect(3).to be_a_kind_of(Numeric)       # => 3.kind_of?(Numeric)     | passes
        +expect(3).to be_an_instance_of(Fixnum)   # => 3.instance_of?(Fixnum)  | passes
        +expect(3).not_to be_an_instance_of(Numeric) # => 3.instance_of?(Numeric) | fails
        +
        + +

        RSpec will also create custom matchers for predicates like has_key?. To +use this feature, just state that the object should have_key(:key) and RSpec will +call has_key?(:key) on the target. For example:

        + +
        expect(:a => "A").to have_key(:a)
        +expect(:a => "A").to have_key(:b) # fails
        +
        + +

        You can use this feature to invoke any predicate that begins with "has_", whether it is +part of the Ruby libraries (like Hash#has_key?) or a method you wrote on your own class.

        + +

        Custom Matchers

        + +

        When you find that none of the stock matchers provide a natural feeling +expectation, you can very easily write your own using RSpec's matcher DSL +or writing one from scratch.

        + +

        Matcher DSL

        + +

        Imagine that you are writing a game in which players can be in various +zones on a virtual board. To specify that bob should be in zone 4, you +could say:

        + +
        expect(bob.current_zone).to eql(Zone.new("4"))
        +
        + +

        But you might find it more expressive to say:

        + +
        expect(bob).to be_in_zone("4")
        +
        + +

        and/or

        + +
        expect(bob).not_to be_in_zone("3")
        +
        + +

        You can create such a matcher like so:

        + +
        RSpec::Matchers.define :be_in_zone do |zone|
        +  match do |player|
        +    player.in_zone?(zone)
        +  end
        +end
        +
        + +

        This will generate a be_in_zone method that returns a matcher +with logical default messages for failures. You can override the failure +messages and the generated description as follows:

        + +
        RSpec::Matchers.define :be_in_zone do |zone|
        +  match do |player|
        +    player.in_zone?(zone)
        +  end
        +
        +  failure_message_for_should do |player|
        +    # generate and return the appropriate string.
        +  end
        +
        +  failure_message_for_should_not do |player|
        +    # generate and return the appropriate string.
        +  end
        +
        +  description do
        +    # generate and return the appropriate string.
        +  end
        +end
        +
        + +

        Each of the message-generation methods has access to the block arguments +passed to the create method (in this case, zone). The +failure message methods (failure_message_for_should and +failure_message_for_should_not) are passed the actual value (the +receiver of expect(..) or expect(..).not_to).

        + +

        Custom Matcher from scratch

        + +

        You could also write a custom matcher from scratch, as follows:

        + +
        class BeInZone
        +  def initialize(expected)
        +    @expected = expected
        +  end
        +
        +  def matches?(target)
        +    @target = target
        +    @target.current_zone.eql?(Zone.new(@expected))
        +  end
        +
        +  def failure_message_for_should
        +    "expected #{@target.inspect} to be in Zone #{@expected}"
        +  end
        +
        +  def failure_message_for_should_not
        +    "expected #{@target.inspect} not to be in Zone #{@expected}"
        +  end
        +end
        +
        + +

        ... and a method like this:

        + +
        def be_in_zone(expected)
        +  BeInZone.new(expected)
        +end
        +
        + +

        And then expose the method to your specs. This is normally done +by including the method and the class in a module, which is then +included in your spec:

        + +
        module CustomGameMatchers
        +  class BeInZone
        +    # ...
        +  end
        +
        +  def be_in_zone(expected)
        +    # ...
        +  end
        +end
        +
        +describe "Player behaviour" do
        +  include CustomGameMatchers
        +  # ...
        +end
        +
        + +

        or you can include in globally in a spec_helper.rb file required +from your spec file(s):

        + +
        RSpec::configure do |config|
        +  config.include(CustomGameMatchers)
        +end
        +
        + + +
        +
        +
        + + +

        Defined Under Namespace

        +

        + + + Modules: BuiltIn, DSL, Extensions, Pretty + + + + Classes: Configuration, OperatorMatcher + + +

        + + + + +

        Class Attribute Summary (collapse)

        +
          + +
        • + + + + (Object) last_matcher + + + + + + + + + + + + + + + + +

          Returns the value of attribute last_matcher.

          +
          + +
        • + + +
        • + + + + (Object) last_should + + + + + + + + + + + + + + + + +

          Returns the value of attribute last_should.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(method, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/method_missing.rb', line 6
        +
        +def method_missing(method, *args, &block)
        +  return Matchers::BuiltIn::BePredicate.new(method, *args, &block) if method.to_s =~ /^be_/
        +  return Matchers::BuiltIn::Has.new(method, *args, &block) if method.to_s =~ /^have_/
        +  super
        +end
        +
        +
        + +
        + +
        +

        Class Attribute Details

        + + + +
        +

        + + + (Object) last_matcher + + + + + +

        +
        +

        Returns the value of attribute last_matcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 4
        +
        +def last_matcher
        +  @last_matcher
        +end
        +
        +
        + + + +
        +

        + + + (Object) last_should + + + + + +

        +
        +

        Returns the value of attribute last_should

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 4
        +
        +def last_should
        +  @last_should
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) clear_generated_description + + + + + +

        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 7
        +
        +def self.clear_generated_description
        +  self.last_matcher = nil
        +  self.last_should = nil
        +end
        +
        +
        + +
        +

        + + + (RSpec::Matchers::Configuration) configuration + + + + + +

        +
        +

        The configuration object

        + + +
        +
        +
        + +

        Returns:

        + + +
        + + + + +
        +
        +
        +
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/matchers/configuration.rb', line 100
        +
        +def self.configuration
        +  @configuration ||= Configuration.new
        +end
        +
        +
        + +
        +

        + + + (Object) generated_description + + + + + +

        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/generated_descriptions.rb', line 12
        +
        +def self.generated_description
        +  return nil if last_should.nil?
        +  "#{last_should.to_s.gsub('_',' ')} #{last_description}"
        +end
        +
        +
        + +
        +

        + + + (Boolean) is_a_matcher?(obj) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +178
        +179
        +180
        +181
        +182
        +183
        +184
        +
        +
        # File 'lib/rspec/matchers.rb', line 178
        +
        +def self.is_a_matcher?(obj)
        +  return true  if ::RSpec::Matchers::BuiltIn::BaseMatcher === obj
        +  return false if obj.respond_to?(:i_respond_to_everything_so_im_not_really_a_matcher)
        +  return false unless obj.respond_to?(:matches?)
        +
        +  obj.respond_to?(:failure_message_for_should) || obj.respond_to?(:failure_message)
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) be(*args) + + + + + +

        +
        +

        Given true, false, or nil, will pass if actual value is true, false or +nil (respectively). Given no args means the caller should satisfy an if +condition (to be or not to be).

        + +

        Predicates are any Ruby method that ends in a "?" and returns true or +false. Given be_ followed by arbitrary_predicate (without the "?"), +RSpec will match convert that into a query against the target object.

        + +

        The arbitrarypredicate feature will handle any predicate prefixed with +"be_an" (e.g. bean_instance_of), "be_a" (e.g. bea_kind_of) or "be" +(e.g. be_empty), letting you choose the prefix that best suits the +predicate.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(actual).to     be_true
        +expect(actual).to     be_false
        +expect(actual).to     be_nil
        +expect(actual).to     be_[arbitrary_predicate](*args)
        +expect(actual).not_to be_nil
        +expect(actual).not_to be_[arbitrary_predicate](*args)
        + +
        + + +
        + + + + +
        +
        +
        +
        +221
        +222
        +223
        +224
        +
        +
        # File 'lib/rspec/matchers.rb', line 221
        +
        +def be(*args)
        +  args.empty? ?
        +    Matchers::BuiltIn::Be.new : equal(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) be_a(klass) + + + + Also known as: + be_an + + + + +

        +
        +

        passes if target.kind_of?(klass)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +227
        +228
        +229
        +
        +
        # File 'lib/rspec/matchers.rb', line 227
        +
        +def be_a(klass)
        +  be_a_kind_of(klass)
        +end
        +
        +
        + +
        +

        + + - (Object) be_a_kind_of(expected) + + + + Also known as: + be_kind_of + + + + +

        +
        +

        Passes if actual.kind_of?(expected)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     be_a_kind_of(Fixnum)
        +expect(5).to     be_a_kind_of(Numeric)
        +expect(5).not_to be_a_kind_of(Float)
        + +
        + + +
        + + + + +
        +
        +
        +
        +253
        +254
        +255
        +
        +
        # File 'lib/rspec/matchers.rb', line 253
        +
        +def be_a_kind_of(expected)
        +  BuiltIn::BeAKindOf.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be_an_instance_of(expected) + + + + Also known as: + be_instance_of + + + + +

        +
        +

        Passes if actual.instance_of?(expected)

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     be_an_instance_of(Fixnum)
        +expect(5).not_to be_an_instance_of(Numeric)
        +expect(5).not_to be_an_instance_of(Float)
        + +
        + + +
        + + + + +
        +
        +
        +
        +240
        +241
        +242
        +
        +
        # File 'lib/rspec/matchers.rb', line 240
        +
        +def be_an_instance_of(expected)
        +  BuiltIn::BeAnInstanceOf.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be_close(expected, delta) + + + + + +

        +
        +
        Deprecated.

        use +be_within+ instead.

        +
        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/be_close.rb', line 4
        +
        +def be_close(expected, delta)
        +  RSpec.deprecate("be_close(#{expected}, #{delta})", :replacement => "be_within(#{delta}).of(#{expected})")
        +  be_within(delta).of(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) be_false + + + + + +

        +
        +

        Passes if actual is falsy (false or nil)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +192
        +193
        +194
        +
        +
        # File 'lib/rspec/matchers.rb', line 192
        +
        +def be_false
        +  BuiltIn::BeFalse.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_nil + + + + + +

        +
        +

        Passes if actual is nil

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +197
        +198
        +199
        +
        +
        # File 'lib/rspec/matchers.rb', line 197
        +
        +def be_nil
        +  BuiltIn::BeNil.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_true + + + + + +

        +
        +

        Passes if actual is truthy (anything but false or nil)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +187
        +188
        +189
        +
        +
        # File 'lib/rspec/matchers.rb', line 187
        +
        +def be_true
        +  BuiltIn::BeTrue.new
        +end
        +
        +
        + +
        +

        + + - (Object) be_within(delta) + + + + + +

        +
        +

        Passes if actual == expected +/- delta

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(result).to     be_within(0.5).of(3.0)
        +expect(result).not_to be_within(0.5).of(3.0)
        + +
        + + +
        + + + + +
        +
        +
        +
        +265
        +266
        +267
        +
        +
        # File 'lib/rspec/matchers.rb', line 265
        +
        +def be_within(delta)
        +  BuiltIn::BeWithin.new(delta)
        +end
        +
        +
        + +
        +

        + + - (Object) change(receiver = nil, message = nil, &block) + + + + + +

        +
        +

        Applied to a proc, specifies that its execution will cause some value to +change.

        + +

        You can either pass receiver and message, or a block, +but not both.

        + +

        When passing a block, it must use the { ... } format, not +do/end, as { ... } binds to the +change+ method, whereas do/end +would errantly bind to the +expect(..)+ or +expect(..).not_to+ method.

        + +

        == Notes

        + +

        Evaluates receiver.message or block before and after it +evaluates the block passed to expect.

        + +

        expect( ... ).not_to change only supports the form with no subsequent +calls to by, by_at_least, by_at_most, +to or from.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by(1)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by_at_least(1)
        +
        +expect {
        +  team.add_player(player)
        +}.to change(roster, :count).by_at_most(1)
        +
        +string = "string"
        +expect {
        +  string.reverse!
        +}.to change { string }.from("string").to("gnirts")
        +
        +string = "string"
        +expect {
        +  string
        +}.not_to change { string }
        +
        +expect {
        +  person.happy_birthday
        +}.to change(person, :birthday).from(32).to(33)
        +
        +expect {
        +  employee.develop_great_new_social_networking_app
        +}.to change(employee, :title).from("Mail Clerk").to("CEO")
        +
        +expect {
        +  doctor.leave_office
        +}.to change(doctor, :sign).from(/is in/).to(/is out/)
        +
        +user = User.new(:type => "admin")
        +expect {
        +  user.symbolize_type
        +}.to change(user, :type).from(String).to(Symbol)
        + +
        +

        Parameters:

        +
          + +
        • + + receiver + + + (Object) + + + (defaults to: nil) + + +
        • + +
        • + + message + + + (Symbol) + + + (defaults to: nil) + + + — +

          the message to send the receiver

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +335
        +336
        +337
        +
        +
        # File 'lib/rspec/matchers.rb', line 335
        +
        +def change(receiver=nil, message=nil, &block)
        +  BuiltIn::Change.new(receiver, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) cover(*values) + + + + + +

        + + + + +
        +
        +
        +
        +351
        +352
        +353
        +
        +
        # File 'lib/rspec/matchers.rb', line 351
        +
        +def cover(*values)
        +  BuiltIn::Cover.new(*values)
        +end
        +
        +
        + +
        +

        + + - (Object) end_with(*expected) + + + + + +

        +
        +

        Matches if the actual value ends with the expected value(s). In the case +of a string, matches against the last expected.length characters of the +actual string. In the case of an array, matches against the last +expected.length elements of the actual array.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect("this string").to   end_with "string"
        +expect([0, 1, 2, 3, 4]).to end_with 4
        +expect([0, 2, 3, 4, 4]).to end_with 3, 4
        + +
        + + +
        + + + + +
        +
        +
        +
        +365
        +366
        +367
        +
        +
        # File 'lib/rspec/matchers.rb', line 365
        +
        +def end_with(*expected)
        +  BuiltIn::EndWith.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) eq(expected) + + + + + +

        +
        +

        Passes if actual == expected.

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     eq(5)
        +expect(5).not_to eq(3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +378
        +379
        +380
        +
        +
        # File 'lib/rspec/matchers.rb', line 378
        +
        +def eq(expected)
        +  BuiltIn::Eq.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) eql(expected) + + + + + +

        +
        +

        Passes if +actual.eql?(expected)+

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to     eql(5)
        +expect(5).not_to eql(3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +391
        +392
        +393
        +
        +
        # File 'lib/rspec/matchers.rb', line 391
        +
        +def eql(expected)
        +  BuiltIn::Eql.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) equal(expected) + + + + + +

        +
        +

        Passes if actual.equal?(expected) (object identity).

        + +

        See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more +information about equality in Ruby.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to       equal(5)   # Fixnums are equal
        +expect("5").not_to equal("5") # Strings that look the same are not the same object
        + +
        + + +
        + + + + +
        +
        +
        +
        +404
        +405
        +406
        +
        +
        # File 'lib/rspec/matchers.rb', line 404
        +
        +def equal(expected)
        +  BuiltIn::Equal.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) exist(*args) + + + + + +

        +
        +

        Passes if actual.exist? or actual.exists?

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect(File).to exist("path/to/file")
        + +
        + + +
        + + + + +
        +
        +
        +
        +412
        +413
        +414
        +
        +
        # File 'lib/rspec/matchers.rb', line 412
        +
        +def exist(*args)
        +  BuiltIn::Exist.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) have(n) + + + + Also known as: + have_exactly + + + + +

        +
        +

        Passes if receiver is a collection with the submitted number of items OR +if the receiver OWNS a collection with the submitted number of items.

        + +

        If the receiver OWNS the collection, you must use the name of the +collection. So if a Team instance has a collection named #players, +you must use that name to set the expectation.

        + +

        If the receiver IS the collection, you can use any name you like for +named_collection. We'd recommend using either "elements", "members", or +"items" as these are all standard ways of describing the things IN a +collection.

        + +

        This also works for Strings, letting you set expectations about their +lengths.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +# Passes if team.players.size == 11
        +expect(team).to have(11).players
        +
        +# Passes if [1,2,3].length == 3
        +expect([1,2,3]).to have(3).items #"items" is pure sugar
        +
        +# Passes if ['a', 'b', 'c'].count == 3
        +expect([1,2,3]).to have(3).items #"items" is pure sugar
        +
        +# Passes if "this string".length == 11
        +expect("this string").to have(11).characters #"characters" is pure sugar
        + +
        + + +
        + + + + +
        +
        +
        +
        +444
        +445
        +446
        +
        +
        # File 'lib/rspec/matchers.rb', line 444
        +
        +def have(n)
        +  BuiltIn::Have.new(n)
        +end
        +
        +
        + +
        +

        + + - (Object) have_at_least(n) + + + + + +

        +
        +

        Exactly like have() with >=.

        + +

        Warning:

        + +

        expect(..).not_to have_at_least is not supported

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect("this").to have_at_least(3).letters
        + +
        + + +
        + + + + +
        +
        +
        +
        +457
        +458
        +459
        +
        +
        # File 'lib/rspec/matchers.rb', line 457
        +
        +def have_at_least(n)
        +  BuiltIn::Have.new(n, :at_least)
        +end
        +
        +
        + +
        +

        + + - (Object) have_at_most(n) + + + + + +

        +
        +

        Exactly like have() with <=.

        + +

        Warning:

        + +

        expect(..).not_to have_at_most is not supported

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        expect("this").to have_at_most(4).letters
        + +
        + + +
        + + + + +
        +
        +
        +
        +469
        +470
        +471
        +
        +
        # File 'lib/rspec/matchers.rb', line 469
        +
        +def have_at_most(n)
        +  BuiltIn::Have.new(n, :at_most)
        +end
        +
        +
        + +
        +

        + + - (Object) include(*expected) + + + + + +

        +
        +

        Passes if actual includes expected. This works for +collections and Strings. You can also pass in multiple args +and it will only pass if all args are found in collection.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect([1,2,3]).to      include(3)
        +expect([1,2,3]).to      include(2,3)
        +expect([1,2,3]).to      include(2,3,4) # fails
        +expect([1,2,3]).not_to  include(4)
        +expect("spread").to     include("read")
        +expect("spread").not_to include("red")
        + +
        + + +
        + + + + +
        +
        +
        +
        +485
        +486
        +487
        +
        +
        # File 'lib/rspec/matchers.rb', line 485
        +
        +def include(*expected)
        +  BuiltIn::Include.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected) + + + + Also known as: + match_regex + + + + +

        +
        + +
        + Note: +

        Due to Ruby's method dispatch mechanism, using the #match matcher

        +
        +
        + +

        Given a Regexp or String, passes if actual.match(pattern)

        + +

        within a custom matcher defined via the matcher DSL +(RSpec::Matcher.define) will result Ruby calling the wrong #match +method and raising an ArgumentError. Instead, use the aliased +#match_regex method.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(email).to   match(/^([^\s]+)((?:[-a-z0-9]+\.)+[a-z]{2,})$/i)
        +expect(email).to   match("@example.com")
        +expect(zipcode).to match_regex(/\A\d{5}(-\d{4})?\z/)
        +expect(zipcode).to match_regex("90210")
        + +
        + + +
        + + + + +
        +
        +
        +
        +503
        +504
        +505
        +
        +
        # File 'lib/rspec/matchers.rb', line 503
        +
        +def match(expected)
        +  BuiltIn::Match.new(expected)
        +end
        +
        +
        + +
        +

        + + - (Object) match_array(array) + + + + + +

        +
        + +
        + Note: +

        This is also available using the =~ operator with should, +but =~ is not supported with expect.

        +
        +
        + +
        + Note: +

        This matcher only supports positive expectations. +expect(..).not_to match_array(other_array) is not supported.

        +
        +
        + +

        Passes if actual contains all of the expected regardless of order. +This works for collections. Pass in multiple args and it will only +pass if all args are found in collection.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect([1,2,3]).to match_array([1,2,3])
        +expect([1,2,3]).to match_array([1,3,2])
        + +
        + + +
        + + + + +
        +
        +
        +
        +688
        +689
        +690
        +
        +
        # File 'lib/rspec/matchers.rb', line 688
        +
        +def match_array(array)
        +  BuiltIn::MatchArray.new(array)
        +end
        +
        +
        + +
        +

        + + - (Object) raise_error(error = Exception, message = nil, &block) + + + + Also known as: + raise_exception + + + + +

        +
        +

        With no args, matches if any error is raised. +With a named error, matches only if that specific error is raised. +With a named error and messsage specified as a String, matches only if both match. +With a named error and messsage specified as a Regexp, matches only if both match. +Pass an optional block to perform extra verifications on the exception matched

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { do_something_risky }.to raise_error
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError)
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError) { |error| expect(error.data).to eq 42 }
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError, "that was too risky")
        +expect { do_something_risky }.to raise_error(PoorRiskDecisionError, /oo ri/)
        +
        +expect { do_something_risky }.not_to raise_error
        + +
        + + +
        + + + + +
        +
        +
        +
        +524
        +525
        +526
        +
        +
        # File 'lib/rspec/matchers.rb', line 524
        +
        +def raise_error(error=Exception, message=nil, &block)
        +  BuiltIn::RaiseError.new(error, message, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) respond_to(*names) + + + + + +

        +
        +

        Matches if the target object responds to all of the names +provided. Names can be Strings or Symbols.

        + +

        expect("string").to respond_to(:length)

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +537
        +538
        +539
        +
        +
        # File 'lib/rspec/matchers.rb', line 537
        +
        +def respond_to(*names)
        +  BuiltIn::RespondTo.new(*names)
        +end
        +
        +
        + +
        +

        + + - (Object) satisfy(&block) + + + + + +

        +
        +

        Passes if the submitted block returns true. Yields target to the +block.

        + +

        Generally speaking, this should be thought of as a last resort when +you can't find any other way to specify the behaviour you wish to +specify.

        + +

        If you do find yourself in such a situation, you could always write +a custom matcher, which would likely make your specs more expressive.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect(5).to satisfy { |n| n > 3 }
        + +
        + + +
        + + + + +
        +
        +
        +
        +554
        +555
        +556
        +
        +
        # File 'lib/rspec/matchers.rb', line 554
        +
        +def satisfy(&block)
        +  BuiltIn::Satisfy.new(&block)
        +end
        +
        +
        + +
        +

        + + - (Object) start_with(*expected) + + + + + +

        +
        +

        Matches if the actual value starts with the expected value(s). In the +case of a string, matches against the first expected.length characters +of the actual string. In the case of an array, matches against the first +expected.length elements of the actual array.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect("this string").to   start_with "this s"
        +expect([0, 1, 2, 3, 4]).to start_with 0
        +expect([0, 2, 3, 4, 4]).to start_with 0, 1
        + +
        + + +
        + + + + +
        +
        +
        +
        +568
        +569
        +570
        +
        +
        # File 'lib/rspec/matchers.rb', line 568
        +
        +def start_with(*expected)
        +  BuiltIn::StartWith.new(*expected)
        +end
        +
        +
        + +
        +

        + + - (Object) throw_symbol(expected_symbol = nil, expected_arg = nil) + + + + + +

        +
        +

        Given no argument, matches if a proc throws any Symbol.

        + +

        Given a Symbol, matches if the given proc throws the specified Symbol.

        + +

        Given a Symbol and an arg, matches if the given proc throws the +specified Symbol with the specified arg.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { do_something_risky }.to throw_symbol
        +expect { do_something_risky }.to throw_symbol(:that_was_risky)
        +expect { do_something_risky }.to throw_symbol(:that_was_risky, 'culprit')
        +
        +expect { do_something_risky }.not_to throw_symbol
        +expect { do_something_risky }.not_to throw_symbol(:that_was_risky)
        +expect { do_something_risky }.not_to throw_symbol(:that_was_risky, 'culprit')
        + +
        + + +
        + + + + +
        +
        +
        +
        +588
        +589
        +590
        +
        +
        # File 'lib/rspec/matchers.rb', line 588
        +
        +def throw_symbol(expected_symbol=nil, expected_arg=nil)
        +  BuiltIn::ThrowSymbol.new(expected_symbol, expected_arg)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_control + + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +
        + Note: +

        This matcher is not designed for use with methods that yield +multiple times.

        +
        +
        + +

        Passes if the method called in the expect block yields, regardless +of whether or not arguments are yielded.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| 5.tap(&b) }.to yield_control
        +expect { |b| "a".to_sym(&b) }.not_to yield_control
        + +
        + + +
        + + + + +
        +
        +
        +
        +604
        +605
        +606
        +
        +
        # File 'lib/rspec/matchers.rb', line 604
        +
        +def yield_control
        +  BuiltIn::YieldControl.new
        +end
        +
        +
        + +
        +

        + + - (Object) yield_successive_args(*args) + + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +

        Designed for use with methods that repeatedly yield (such as +iterators). Passes if the method called in the expect block yields +multiple times with arguments matching those given.

        + +

        Argument matching is done using === (the case match operator) +and ==. If the expected and actual arguments match with either +operator, the matcher will pass.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +expect { |b| [1, 2, 3].each(&b) }.not_to yield_successive_args(1, 2)
        + +
        + + +
        + + + + +
        +
        +
        +
        +670
        +671
        +672
        +
        +
        # File 'lib/rspec/matchers.rb', line 670
        +
        +def yield_successive_args(*args)
        +  BuiltIn::YieldSuccessiveArgs.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_with_args(*args) + + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +
        + Note: +

        This matcher is not designed for use with methods that yield +multiple times.

        +
        +
        + +

        Given no arguments, matches if the method called in the expect +block yields with arguments (regardless of what they are or how +many there are).

        + +

        Given arguments, matches if the method called in the expect block +yields with arguments that match the given arguments.

        + +

        Argument matching is done using === (the case match operator) +and ==. If the expected and actual arguments match with either +operator, the matcher will pass.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| 5.tap(&b) }.to yield_with_args # because #tap yields an arg
        +expect { |b| 5.tap(&b) }.to yield_with_args(5) # because 5 == 5
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum) # because Fixnum === 5
        +expect { |b| File.open("f.txt", &b) }.to yield_with_args(/txt/) # because /txt/ === "f.txt"
        +
        +expect { |b| User.transaction(&b) }.not_to yield_with_args # because it yields no args
        +expect { |b| 5.tap(&b) }.not_to yield_with_args(1, 2, 3)
        + +
        + + +
        + + + + +
        +
        +
        +
        +650
        +651
        +652
        +
        +
        # File 'lib/rspec/matchers.rb', line 650
        +
        +def yield_with_args(*args)
        +  BuiltIn::YieldWithArgs.new(*args)
        +end
        +
        +
        + +
        +

        + + - (Object) yield_with_no_args + + + + + +

        +
        + +
        + Note: +

        Your expect block must accept a parameter and pass it on to +the method-under-test as a block.

        +
        +
        + +
        + Note: +

        This matcher is not designed for use with methods that yield +multiple times.

        +
        +
        + +

        Passes if the method called in the expect block yields with +no arguments. Fails if it does not yield, or yields with arguments.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +expect { |b| User.transaction(&b) }.to yield_with_no_args
        +expect { |b| 5.tap(&b) }.not_to yield_with_no_args # because it yields with `5`
        +expect { |b| "a".to_sym(&b) }.not_to yield_with_no_args # because it does not yield
        + +
        + + +
        + + + + +
        +
        +
        +
        +621
        +622
        +623
        +
        +
        # File 'lib/rspec/matchers.rb', line 621
        +
        +def yield_with_no_args
        +  BuiltIn::YieldWithNoArgs.new
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn.html new file mode 100644 index 000000000..e595e7ddb --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn.html @@ -0,0 +1,119 @@ + + + + + + Module: RSpec::Matchers::BuiltIn + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::BuiltIn + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in.rb,
        + lib/rspec/matchers/built_in/be.rb,
        lib/rspec/matchers/built_in/eq.rb,
        lib/rspec/matchers/built_in/eql.rb,
        lib/rspec/matchers/built_in/has.rb,
        lib/rspec/matchers/built_in/have.rb,
        lib/rspec/matchers/built_in/cover.rb,
        lib/rspec/matchers/built_in/exist.rb,
        lib/rspec/matchers/built_in/match.rb,
        lib/rspec/matchers/built_in/equal.rb,
        lib/rspec/matchers/built_in/yield.rb,
        lib/rspec/matchers/built_in/change.rb,
        lib/rspec/matchers/operator_matcher.rb,
        lib/rspec/matchers/built_in/satisfy.rb,
        lib/rspec/matchers/built_in/include.rb,
        lib/rspec/matchers/built_in/be_within.rb,
        lib/rspec/matchers/built_in/be_kind_of.rb,
        lib/rspec/matchers/built_in/respond_to.rb,
        lib/rspec/matchers/built_in/raise_error.rb,
        lib/rspec/matchers/built_in/match_array.rb,
        lib/rspec/matchers/built_in/base_matcher.rb,
        lib/rspec/matchers/built_in/throw_symbol.rb,
        lib/rspec/matchers/built_in/be_instance_of.rb,
        lib/rspec/matchers/built_in/start_and_end_with.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: BeHelpers + + + + Classes: BaseMatcher, Be, BeAKindOf, BeAnInstanceOf, BeComparedTo, BeFalse, BeNil, BePredicate, BeTrue, BeWithin, Change, Cover, EndWith, Eq, Eql, Equal, Exist, Has, Have, Include, Match, MatchArray, NegativeOperatorMatcher, PositiveOperatorMatcher, RaiseError, RespondTo, Satisfy, StartAndEndWith, StartWith, ThrowSymbol, YieldControl, YieldProbe, YieldSuccessiveArgs, YieldWithArgs, YieldWithNoArgs + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html new file mode 100644 index 000000000..bba1c630c --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BaseMatcher.html @@ -0,0 +1,1000 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BaseMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BaseMatcher + + + Private +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        Pretty
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/base_matcher.rb
        + +
        +
        + +

        Overview

        +
        +

        + This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

        +

        Used internally as a base class for matchers that ship with +rspec-expectations.

        + +

        Warning:

        + +

        This class is for internal use, and subject to change without notice. We +strongly recommend that you do not base your custom matchers on this +class. If/when this changes, we will announce it and remove this warning.

        + + +
        +
        +
        + + +
        + +

        Constant Summary

        + +
        + +
        UNDEFINED = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        +
        +
        Object.new.freeze
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (BaseMatcher) initialize(expected = UNDEFINED) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of BaseMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 21
        +
        +def initialize(expected = UNDEFINED)
        +  @expected = expected unless UNDEFINED.equal?(expected)
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) actual (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 19
        +
        +def actual
        +  @actual
        +end
        +
        +
        + + + +
        +

        + + - (Object) expected (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 19
        +
        +def expected
        +  @expected
        +end
        +
        +
        + + + +
        +

        + + - (Object) rescued_exception (readonly) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 19
        +
        +def rescued_exception
        +  @rescued_exception
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) ==(other) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 58
        +
        +def ==(other)
        +  matches?(other)
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 50
        +
        +def description
        +  defined?(@expected) ? "#{name_to_sentence} #{@expected.inspect}" : name_to_sentence
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 54
        +
        +def diffable?
        +  false
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +40
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 40
        +
        +def failure_message_for_should
        +  assert_ivars :@actual
        +  "expected #{@actual.inspect} to #{name_to_sentence}#{expected_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 45
        +
        +def failure_message_for_should_not
        +  assert_ivars :@actual
        +  "expected #{@actual.inspect} not to #{name_to_sentence}#{expected_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (Object) match_unless_raises(*exceptions) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 30
        +
        +def match_unless_raises(*exceptions)
        +  exceptions.unshift Exception if exceptions.empty?
        +  begin
        +    yield
        +    true
        +  rescue *exceptions => @rescued_exception
        +    false
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/matchers/built_in/base_matcher.rb', line 25
        +
        +def matches?(actual)
        +  @actual = actual
        +  match(expected, actual)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html new file mode 100644 index 000000000..7d8f49492 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Be.html @@ -0,0 +1,414 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Be + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Be + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        BeHelpers
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        BeComparedTo

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (Be) initialize(*args, &block) + + + + + +

        +
        +

        Returns a new instance of Be

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +75
        +76
        +77
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 75
        +
        +def initialize(*args, &block)
        +  @args = args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 83
        +
        +def failure_message_for_should
        +  "expected #{@actual.inspect} to evaluate to true"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +87
        +88
        +89
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 87
        +
        +def failure_message_for_should_not
        +  "expected #{@actual.inspect} to evaluate to false"
        +end
        +
        +
        + +
        +

        + + - (Object) match(_, actual) + + + + + +

        + + + + +
        +
        +
        +
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 79
        +
        +def match(_, actual)
        +  !!actual
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html new file mode 100644 index 000000000..6016f3300 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeAKindOf.html @@ -0,0 +1,233 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeAKindOf + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeAKindOf + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_kind_of.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/be_kind_of.rb', line 5
        +
        +def match(expected, actual)
        +  actual.kind_of? expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html new file mode 100644 index 000000000..4d61ee44c --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeAnInstanceOf.html @@ -0,0 +1,285 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeAnInstanceOf + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeAnInstanceOf + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_instance_of.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/be_instance_of.rb', line 9
        +
        +def description
        +  "be an instance of #{expected}"
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/be_instance_of.rb', line 5
        +
        +def match(expected, actual)
        +  actual.instance_of? expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html new file mode 100644 index 000000000..bb67ffe56 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeComparedTo.html @@ -0,0 +1,563 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeComparedTo + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeComparedTo + + + +

        + +
        + +
        Inherits:
        +
        + Be + +
          +
        • Object
        • + + + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from Be

        +

        #match

        + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #diffable?, #match_unless_raises

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (BeComparedTo) initialize(operand, operator) + + + + + +

        +
        +

        Returns a new instance of BeComparedTo

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +99
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 99
        +
        +def initialize(operand, operator)
        +  @expected, @operator = operand, operator
        +    @args = []
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +124
        +125
        +126
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 124
        +
        +def description
        +  "be #{@operator} #{expected_to_sentence}#{args_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +109
        +110
        +111
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 109
        +
        +def failure_message_for_should
        +  "expected: #{@operator} #{@expected.inspect}\n     got: #{@operator.to_s.gsub(/./, ' ')} #{@actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +113
        +114
        +115
        +116
        +117
        +118
        +119
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 113
        +
        +def failure_message_for_should_not
        +  message = <<-MESSAGE
        +`#{negative_expectation_expression}` not only FAILED,
        +it is a bit confusing.
        +  MESSAGE
        +
        +  raise message << ([:===,:==].include?(@operator) ?
        +                    "It might be more clearly expressed without the \"be\"?" :
        +                    "It might be more clearly expressed in the positive?")
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +107
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 104
        +
        +def matches?(actual)
        +  @actual = actual
        +  @actual.__send__ @operator, @expected
        +end
        +
        +
        + +
        +

        + + - (Object) negative_expectation_expression + + + + + +

        + + + + +
        +
        +
        +
        +128
        +129
        +130
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 128
        +
        +def negative_expectation_expression
        +  Expectations::Syntax.negative_expression("actual", "be #{@operator} #{@expected}")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalse.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalse.html new file mode 100644 index 000000000..d9a412eff --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeFalse.html @@ -0,0 +1,337 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeFalse + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeFalse + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 25
        +
        +def failure_message_for_should
        +  "expected: false value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 29
        +
        +def failure_message_for_should_not
        +  "expected: non-false value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) match(_, actual) + + + + + +

        + + + + +
        +
        +
        +
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 21
        +
        +def match(_, actual)
        +  !actual
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeHelpers.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeHelpers.html new file mode 100644 index 000000000..c4248a30c --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeHelpers.html @@ -0,0 +1,109 @@ + + + + + + Module: RSpec::Matchers::BuiltIn::BeHelpers + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::BuiltIn::BeHelpers + + + +

        + +
        + + + + + + + +
        Included in:
        +
        Be, BePredicate
        + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html new file mode 100644 index 000000000..abc90a8b1 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeNil.html @@ -0,0 +1,337 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeNil + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeNil + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 39
        +
        +def failure_message_for_should
        +  "expected: nil\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 43
        +
        +def failure_message_for_should_not
        +  "expected: not nil\n     got: nil"
        +end
        +
        +
        + +
        +

        + + - (Object) match(_, actual) + + + + + +

        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 35
        +
        +def match(_, actual)
        +  actual.nil?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html new file mode 100644 index 000000000..65869a524 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BePredicate.html @@ -0,0 +1,516 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BePredicate + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BePredicate + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        BeHelpers
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #diffable?, #match_unless_raises

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (BePredicate) initialize(*args, &block) + + + + + +

        +
        +

        Returns a new instance of BePredicate

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +136
        +137
        +138
        +139
        +140
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 136
        +
        +def initialize(*args, &block)
        +  @expected = parse_expected(args.shift)
        +  @args = args
        +  @block = block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +167
        +168
        +169
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 167
        +
        +def description
        +  "#{prefix_to_sentence}#{expected_to_sentence}#{args_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +159
        +160
        +161
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 159
        +
        +def failure_message_for_should
        +  "expected #{predicate}#{args_to_s} to return true, got #{@result.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +163
        +164
        +165
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 163
        +
        +def failure_message_for_should_not
        +  "expected #{predicate}#{args_to_s} to return false, got #{@result.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + Also known as: + === + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +142
        +143
        +144
        +145
        +146
        +147
        +148
        +149
        +150
        +151
        +152
        +153
        +154
        +155
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 142
        +
        +def matches?(actual)
        +  @actual = actual
        +  begin
        +    return @result = actual.__send__(predicate, *@args, &@block)
        +  rescue NameError => predicate_missing_error
        +    "this needs to be here or rcov will not count this branch even though it's executed in a code example"
        +  end
        +
        +  begin
        +    return @result = actual.__send__(present_tense_predicate, *@args, &@block)
        +  rescue NameError
        +    raise predicate_missing_error
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeTrue.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeTrue.html new file mode 100644 index 000000000..c147dea14 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeTrue.html @@ -0,0 +1,337 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeTrue + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeTrue + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 11
        +
        +def failure_message_for_should
        +  "expected: true value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 15
        +
        +def failure_message_for_should_not
        +  "expected: non-true value\n     got: #{actual.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) match(_, actual) + + + + + +

        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/matchers/built_in/be.rb', line 7
        +
        +def match(_, actual)
        +  !!actual
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html new file mode 100644 index 000000000..1dd31c7ba --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/BeWithin.html @@ -0,0 +1,564 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::BeWithin + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::BeWithin + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/be_within.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (BeWithin) initialize(delta) + + + + + +

        +
        +

        Returns a new instance of BeWithin

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 5
        +
        +def initialize(delta)
        +  @delta = delta
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +39
        +40
        +41
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 39
        +
        +def description
        +  "be within #{@delta}#{@unit} of #{@expected}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 31
        +
        +def failure_message_for_should
        +  "expected #{@actual} to #{description}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 35
        +
        +def failure_message_for_should_not
        +  "expected #{@actual} not to #{description}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 9
        +
        +def matches?(actual)
        +  @actual = actual
        +  raise needs_expected     unless defined? @expected
        +  raise needs_subtractable unless @actual.respond_to? :-
        +  (@actual - @expected).abs <= @tolerance
        +end
        +
        +
        + +
        +

        + + - (Object) of(expected) + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 17
        +
        +def of(expected)
        +  @expected  = expected
        +  @tolerance = @delta
        +  @unit      = ''
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) percent_of(expected) + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/matchers/built_in/be_within.rb', line 24
        +
        +def percent_of(expected)
        +  @expected  = expected
        +  @tolerance = @delta * @expected.abs / 100.0
        +  @unit      = '%'
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html new file mode 100644 index 000000000..62e4707fd --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Change.html @@ -0,0 +1,950 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Change + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Change + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/change.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Change) initialize(receiver = nil, message = nil, &block) + + + + + +

        +
        +

        Returns a new instance of Change

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 5
        +
        +def initialize(receiver=nil, message=nil, &block)
        +  @message = message
        +  @value_proc = block || lambda {receiver.__send__(message)}
        +  @expected_after = @expected_before = @minimum = @maximum = @expected_delta = nil
        +  @eval_before = @eval_after = false
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) actual_delta + + + + + +

        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 54
        +
        +def actual_delta
        +  @actual_after - @actual_before
        +end
        +
        +
        + +
        +

        + + - (Object) by(expected_delta) + + + + + +

        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +65
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 62
        +
        +def by(expected_delta)
        +  @expected_delta = expected_delta
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) by_at_least(minimum) + + + + + +

        + + + + +
        +
        +
        +
        +67
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 67
        +
        +def by_at_least(minimum)
        +  @minimum = minimum
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) by_at_most(maximum) + + + + + +

        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +75
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 72
        +
        +def by_at_most(maximum)
        +  @maximum = maximum
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 89
        +
        +def description
        +  "change ##{message}"
        +end
        +
        +
        + +
        +

        + + - (Object) evaluate_value_proc + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 29
        +
        +def evaluate_value_proc
        +  case val = @value_proc.call
        +  when Enumerable, String
        +    val.dup
        +  else
        +    val
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 38
        +
        +def failure_message_for_should
        +  if @eval_before && !expected_matches_actual?(@expected_before, @actual_before)
        +    "#{message} should have initially been #{@expected_before.inspect}, but was #{@actual_before.inspect}"
        +  elsif @eval_after && !expected_matches_actual?(@expected_after, @actual_after)
        +    "#{message} should have been changed to #{failure_message_for_expected_after}, but is now #{@actual_after.inspect}"
        +  elsif @expected_delta
        +    "#{message} should have been changed by #{@expected_delta.inspect}, but was changed by #{actual_delta.inspect}"
        +  elsif @minimum
        +    "#{message} should have been changed by at least #{@minimum.inspect}, but was changed by #{actual_delta.inspect}"
        +  elsif @maximum
        +    "#{message} should have been changed by at most #{@maximum.inspect}, but was changed by #{actual_delta.inspect}"
        +  else
        +    "#{message} should have changed, but is still #{@actual_before.inspect}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +58
        +59
        +60
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 58
        +
        +def failure_message_for_should_not
        +  "#{message} should not have changed, but did change from #{@actual_before.inspect} to #{@actual_after.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) from(before) + + + + + +

        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +86
        +87
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 83
        +
        +def from (before)
        +  @eval_before = true
        +  @expected_before = before
        +  self
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(event_proc) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 12
        +
        +def matches?(event_proc)
        +  raise_block_syntax_error if block_given?
        +
        +  @actual_before = evaluate_value_proc
        +  event_proc.call
        +  @actual_after = evaluate_value_proc
        +
        +  (!change_expected? || changed?) && matches_before? && matches_after? && matches_expected_delta? && matches_min? && matches_max?
        +end
        +
        +
        + +
        +

        + + - (Object) raise_block_syntax_error + + + + + +

        +
        + + +
        +
        +
        + +

        Raises:

        +
          + +
        • + + + (SyntaxError) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 23
        +
        +def raise_block_syntax_error
        +  raise SyntaxError.new(<<-MESSAGE)
        +block passed to should or should_not change must use {} instead of do/end
        +MESSAGE
        +end
        +
        +
        + +
        +

        + + - (Object) to(to) + + + + + +

        + + + + +
        +
        +
        +
        +77
        +78
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/matchers/built_in/change.rb', line 77
        +
        +def to(to)
        +  @eval_after = true
        +  @expected_after = to
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html new file mode 100644 index 000000000..03cde84da --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Cover.html @@ -0,0 +1,396 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Cover + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Cover + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/cover.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (Cover) initialize(*expected) + + + + + +

        +
        +

        Returns a new instance of Cover

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 5
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) does_not_match?(range) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 14
        +
        +def does_not_match?(range)
        +  @actual = range
        +  expected.none? { |e| range.cover?(e) }
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(range) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/cover.rb', line 9
        +
        +def matches?(range)
        +  @actual = range
        +  @expected.all? { |e| range.cover?(e) }
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html new file mode 100644 index 000000000..aaf6c7dfe --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/EndWith.html @@ -0,0 +1,342 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::EndWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::EndWith + + + +

        + +
        + +
        Inherits:
        +
        + StartAndEndWith + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from StartAndEndWith

        +

        #failure_message_for_should, #failure_message_for_should_not, #initialize, #matches?

        + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::StartAndEndWith

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) element_matches?(expected, actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +42
        +43
        +44
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 42
        +
        +def element_matches?(expected, actual)
        +  actual[-1] == expected
        +end
        +
        +
        + +
        +

        + + - (Boolean) subset_matches?(expected, actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 38
        +
        +def subset_matches?(expected, actual)
        +  actual[-expected.length, expected.length] == expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html new file mode 100644 index 000000000..80d9b5b68 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Eq.html @@ -0,0 +1,407 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Eq + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Eq + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/eq.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 17
        +
        +def diffable?; true; end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 9
        +
        +def failure_message_for_should
        +  "\nexpected: #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using ==)\n"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 13
        +
        +def failure_message_for_should_not
        +  "\nexpected: value != #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using ==)\n"
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/eq.rb', line 5
        +
        +def match(expected, actual)
        +  actual == expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html new file mode 100644 index 000000000..4ae17bb13 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Eql.html @@ -0,0 +1,411 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Eql + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Eql + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/eql.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 17
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 9
        +
        +def failure_message_for_should
        +  "\nexpected: #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 13
        +
        +def failure_message_for_should_not
        +  "\nexpected: value != #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/eql.rb', line 5
        +
        +def match(expected, actual)
        +  actual.eql? expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html new file mode 100644 index 000000000..8f30f1753 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Equal.html @@ -0,0 +1,441 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Equal + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Equal + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/equal.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 34
        +
        +def diffable?; true; end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 9
        +
        +def failure_message_for_should
        +  return <<-MESSAGE
        +
        +expected #{inspect_object(expected)}
        +     got #{inspect_object(actual)}
        +
        +Compared using equal?, which compares object identity,
        +but expected and actual are not the same object. Use
        +`#{eq_expression}` if you don't care about
        +object identity in this example.
        +
        +MESSAGE
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 23
        +
        +def failure_message_for_should_not
        +  return <<-MESSAGE
        +
        +expected not #{inspect_object(actual)}
        + got #{inspect_object(expected)}
        +
        +Compared using equal?, which compares object identity.
        +
        +MESSAGE
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/equal.rb', line 5
        +
        +def match(expected, actual)
        +  actual.equal? expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html new file mode 100644 index 000000000..08a810e57 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Exist.html @@ -0,0 +1,340 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Exist + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Exist + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/exist.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (Exist) initialize(*expected) + + + + + +

        +
        +

        Returns a new instance of Exist

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 5
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/exist.rb', line 9
        +
        +def matches?(actual)
        +  @actual = actual
        +  predicates = [:exist?, :exists?].select { |p| @actual.respond_to?(p) }
        +  existence_values = predicates.map { |p| @actual.__send__(p, *@expected) }
        +  uniq_truthy_values = existence_values.map { |v| !!v }.uniq
        +
        +  case uniq_truthy_values.size
        +  when 0; raise NoMethodError.new("#{@actual.inspect} does not respond to either #exist? or #exists?")
        +  when 1; existence_values.first
        +  else raise "#exist? and #exists? returned different values:\n\n" +
        +    " exist?: #{existence_values.first}\n" +
        +    "exists?: #{existence_values.last}"
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html new file mode 100644 index 000000000..144b2b882 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Has.html @@ -0,0 +1,442 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Has + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Has + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/has.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Has) initialize(expected, *args) + + + + + +

        +
        +

        Returns a new instance of Has

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 5
        +
        +def initialize(expected, *args)
        +  @expected, @args = expected, args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 22
        +
        +def description
        +  [method_description(@expected), args_description].compact.join(' ')
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 14
        +
        +def failure_message_for_should
        +  "expected ##{predicate(@expected)}#{failure_message_args_description} to return true, got false"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 18
        +
        +def failure_message_for_should_not
        +  "expected ##{predicate(@expected)}#{failure_message_args_description} to return false, got true"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/has.rb', line 9
        +
        +def matches?(actual)
        +  actual.__send__(predicate(@expected), *@args)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Have.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Have.html new file mode 100644 index 000000000..5de631a86 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Have.html @@ -0,0 +1,894 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Have + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Have + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/have.rb
        + +
        +
        + + +

        Constant Summary

        + +
        + +
        QUERY_METHODS = + +
        +
        [:size, :length, :count].freeze
        + +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Have) initialize(expected, relativity = :exactly) + + + + + +

        +
        +

        Returns a new instance of Have

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 7
        +
        +def initialize(expected, relativity=:exactly)
        +  @expected = case expected
        +              when :no then 0
        +              when String then expected.to_i
        +              else expected
        +              end
        +  @relativity = relativity
        +  @actual = @collection_name = @plural_collection_name = nil
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(method, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +104
        +105
        +106
        +107
        +108
        +109
        +110
        +111
        +112
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 104
        +
        +def method_missing(method, *args, &block)
        +  @collection_name = method
        +  if inflector = (defined?(ActiveSupport::Inflector) && ActiveSupport::Inflector.respond_to?(:pluralize) ? ActiveSupport::Inflector : (defined?(Inflector) ? Inflector : nil))
        +    @plural_collection_name = inflector.pluralize(method.to_s)
        +  end
        +  @args = args
        +  @block = block
        +  self
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +94
        +95
        +96
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 94
        +
        +def description
        +  "have #{relative_expectation} #{@collection_name}"
        +end
        +
        +
        + +
        +

        + + - (Object) determine_collection(collection_or_owner) + + + + + +

        + + + + +
        +
        +
        +
        +48
        +49
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 48
        +
        +def determine_collection(collection_or_owner)
        +  if collection_or_owner.respond_to?(@collection_name)
        +    collection_or_owner.__send__(@collection_name, *@args, &@block)
        +  elsif (@plural_collection_name && collection_or_owner.respond_to?(@plural_collection_name))
        +    collection_or_owner.__send__(@plural_collection_name, *@args, &@block)
        +  elsif determine_query_method(collection_or_owner)
        +    collection_or_owner
        +  else
        +    collection_or_owner.__send__(@collection_name, *@args, &@block)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) determine_query_method(collection) + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 60
        +
        +def determine_query_method(collection)
        +  QUERY_METHODS.detect {|m| collection.respond_to?(m)}
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +68
        +69
        +70
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 68
        +
        +def failure_message_for_should
        +  "expected #{relative_expectation} #{@collection_name}, got #{@actual}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +89
        +90
        +91
        +92
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 72
        +
        +def failure_message_for_should_not
        +  if @relativity == :exactly
        +    return "expected target not to have #{@expected} #{@collection_name}, got #{@actual}"
        +  elsif @relativity == :at_most
        +    return <<-EOF
        +Isn't life confusing enough?
        +Instead of having to figure out the meaning of this:
        +  #{Expectations::Syntax.negative_expression("actual", "have_at_most(#{@expected}).#{@collection_name}")}
        +We recommend that you use this instead:
        +  #{Expectations::Syntax.positive_expression("actual", "have_at_least(#{@expected + 1}).#{@collection_name}")}
        +EOF
        +  elsif @relativity == :at_least
        +    return <<-EOF
        +Isn't life confusing enough?
        +Instead of having to figure out the meaning of this:
        +  #{Expectations::Syntax.negative_expression("actual", "have_at_least(#{@expected}).#{@collection_name}")}
        +We recommend that you use this instead:
        +  #{Expectations::Syntax.positive_expression("actual", "have_at_most(#{@expected - 1}).#{@collection_name}")}
        +EOF
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(collection_or_owner) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 25
        +
        +def matches?(collection_or_owner)
        +  collection = determine_collection(collection_or_owner)
        +  case collection
        +  when enumerator_class
        +    for query_method in QUERY_METHODS
        +      next unless collection.respond_to?(query_method)
        +      @actual = collection.__send__(query_method)
        +      break unless @actual.nil?
        +    end
        +    raise not_a_collection if @actual.nil?
        +  else
        +    query_method = determine_query_method(collection)
        +    raise not_a_collection unless query_method
        +    @actual = collection.__send__(query_method)
        +  end
        +  case @relativity
        +  when :at_least then @actual >= @expected
        +  when :at_most  then @actual <= @expected
        +  else                @actual == @expected
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) not_a_collection + + + + + +

        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 64
        +
        +def not_a_collection
        +  "expected #{@collection_name} to be a collection but it does not respond to #length, #size or #count"
        +end
        +
        +
        + +
        +

        + + - (Object) relativities + + + + + +

        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 17
        +
        +def relativities
        +  @relativities ||= {
        +    :exactly => "",
        +    :at_least => "at least ",
        +    :at_most => "at most "
        +  }
        +end
        +
        +
        + +
        +

        + + - (Boolean) respond_to?(m) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +98
        +99
        +100
        +
        +
        # File 'lib/rspec/matchers/built_in/have.rb', line 98
        +
        +def respond_to?(m)
        +  @expected.respond_to?(m) || super
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html new file mode 100644 index 000000000..ee9595c3d --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Include.html @@ -0,0 +1,526 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Include + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Include + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/include.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (Include) initialize(*expected) + + + + + +

        +
        +

        Returns a new instance of Include

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 5
        +
        +def initialize(*expected)
        +  @expected = expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 19
        +
        +def description
        +  "include#{expected_to_sentence}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 23
        +
        +def diffable?
        +  # Matchers do not diff well, since diff uses their inspect
        +  # output, which includes their instance variables and such.
        +  @expected.none? { |e| RSpec::Matchers.is_a_matcher?(e) }
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 14
        +
        +def does_not_match?(actual)
        +  @actual = actual
        +  perform_match(:none?, :any?, @actual, @expected)
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/include.rb', line 9
        +
        +def matches?(actual)
        +  @actual = actual
        +  perform_match(:all?, :all?, @actual, @expected)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html new file mode 100644 index 000000000..9ce6951b1 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Match.html @@ -0,0 +1,307 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Match + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Match + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/match.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/match.rb', line 10
        +
        +def diffable?
        +  true
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/matchers/built_in/match.rb', line 6
        +
        +def match(expected, actual)
        +  actual.match expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/MatchArray.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/MatchArray.html new file mode 100644 index 000000000..14bd06cf0 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/MatchArray.html @@ -0,0 +1,413 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::MatchArray + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::MatchArray + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/match_array.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #diffable?, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/matchers/built_in/match_array.rb', line 29
        +
        +def description
        +  "contain exactly #{_pretty_print(expected)}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +
        +
        # File 'lib/rspec/matchers/built_in/match_array.rb', line 12
        +
        +def failure_message_for_should
        +  if actual.respond_to? :to_ary
        +    message =  "expected collection contained:  #{safe_sort(expected).inspect}\n"
        +    message += "actual collection contained:    #{safe_sort(actual).inspect}\n"
        +    message += "the missing elements were:      #{safe_sort(@missing_items).inspect}\n" unless @missing_items.empty?
        +    message += "the extra elements were:        #{safe_sort(@extra_items).inspect}\n"   unless @extra_items.empty?
        +  else
        +    message = "expected an array, actual collection was #{actual.inspect}"
        +  end
        +
        +  message
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +25
        +26
        +27
        +
        +
        # File 'lib/rspec/matchers/built_in/match_array.rb', line 25
        +
        +def failure_message_for_should_not
        +  "Matcher does not support should_not"
        +end
        +
        +
        + +
        +

        + + - (Object) match(expected, actual) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +
        +
        # File 'lib/rspec/matchers/built_in/match_array.rb', line 5
        +
        +def match(expected, actual)
        +  return false unless actual.respond_to? :to_ary
        +  @extra_items = difference_between_arrays(actual, expected)
        +  @missing_items = difference_between_arrays(expected, actual)
        +  @extra_items.empty? & @missing_items.empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/NegativeOperatorMatcher.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/NegativeOperatorMatcher.html new file mode 100644 index 000000000..3b3c2b7dd --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/NegativeOperatorMatcher.html @@ -0,0 +1,210 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::NegativeOperatorMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::NegativeOperatorMatcher + + + +

        + +
        + +
        Inherits:
        +
        + OperatorMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/operator_matcher.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from OperatorMatcher

        +

        #description, #fail_with_message, get, #initialize, register, registry, unregister, use_custom_matcher_or_delegate

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::OperatorMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) __delegate_operator(actual, operator, expected) + + + + + +

        + + + + +
        +
        +
        +
        +106
        +107
        +108
        +109
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 106
        +
        +def __delegate_operator(actual, operator, expected)
        +  return false unless actual.__send__(operator, expected)
        +  return fail_with_message("expected not: #{operator} #{expected.inspect}\n         got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/PositiveOperatorMatcher.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/PositiveOperatorMatcher.html new file mode 100644 index 000000000..e0429e6a0 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/PositiveOperatorMatcher.html @@ -0,0 +1,220 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::PositiveOperatorMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::PositiveOperatorMatcher + + + +

        + +
        + +
        Inherits:
        +
        + OperatorMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/operator_matcher.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from OperatorMatcher

        +

        #description, #fail_with_message, get, #initialize, register, registry, unregister, use_custom_matcher_or_delegate

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::OperatorMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) __delegate_operator(actual, operator, expected) + + + + + +

        + + + + +
        +
        +
        +
        +94
        +95
        +96
        +97
        +98
        +99
        +100
        +101
        +102
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 94
        +
        +def __delegate_operator(actual, operator, expected)
        +  if actual.__send__(operator, expected)
        +    true
        +  elsif ['==','===', '=~'].include?(operator)
        +    fail_with_message("expected: #{expected.inspect}\n     got: #{actual.inspect} (using #{operator})")
        +  else
        +    fail_with_message("expected: #{operator} #{expected.inspect}\n     got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html new file mode 100644 index 000000000..5960a66c9 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/RaiseError.html @@ -0,0 +1,730 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::RaiseError + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::RaiseError + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/raise_error.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (RaiseError) initialize(expected_error_or_message = Exception, expected_message = nil, &block) + + + + + +

        +
        +

        Returns a new instance of RaiseError

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 5
        +
        +def initialize(expected_error_or_message=Exception, expected_message=nil, &block)
        +  @block = block
        +  @actual_error = nil
        +  case expected_error_or_message
        +  when String, Regexp
        +    @expected_error, @expected_message = Exception, expected_error_or_message
        +  else
        +    @expected_error, @expected_message = expected_error_or_message, expected_message
        +  end
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 89
        +
        +def description
        +  "raise #{expected_error}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(given_proc) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 56
        +
        +def does_not_match?(given_proc)
        +  !matches?(given_proc, :negative_expectation)
        +end
        +
        +
        + +
        +

        + + - (Object) eval_block + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +67
        +68
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 60
        +
        +def eval_block
        +  @eval_block = true
        +  begin
        +    @block[@actual_error]
        +    @eval_block_passed = true
        +  rescue Exception => err
        +    @actual_error = err
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +81
        +82
        +83
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 81
        +
        +def failure_message_for_should
        +  @eval_block ? @actual_error.message : "expected #{expected_error}#{given_error}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +85
        +86
        +87
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 85
        +
        +def failure_message_for_should_not
        +  "expected no #{expected_error}#{given_error}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(given_proc, negative_expectation = false) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 16
        +
        +def matches?(given_proc, negative_expectation = false)
        +  if negative_expectation && (expecting_specific_exception? || @expected_message)
        +    what_to_deprecate = if expecting_specific_exception? && @expected_message
        +                          "`expect { }.not_to raise_error(SpecificErrorClass, message)`"
        +                        elsif expecting_specific_exception?
        +                          "`expect { }.not_to raise_error(SpecificErrorClass)`"
        +                        elsif @expected_message
        +                          "`expect { }.not_to raise_error(message)`"
        +                        end
        +
        +    RSpec.deprecate(
        +      what_to_deprecate,
        +      :replacement => "`expect { }.not_to raise_error` (with no args)"
        +    )
        +  end
        +  @raised_expected_error = false
        +  @with_expected_message = false
        +  @eval_block = false
        +  @eval_block_passed = false
        +  unless given_proc.respond_to?(:call)
        +    ::Kernel.warn "`raise_error` was called with non-proc object #{given_proc.inspect}"
        +    return false
        +  end
        +  begin
        +    given_proc.call
        +  rescue Exception => @actual_error
        +    if @actual_error == @expected_error || @expected_error === @actual_error
        +      @raised_expected_error = true
        +      @with_expected_message = verify_message
        +    end
        +  end
        +
        +  unless negative_expectation
        +    eval_block if @raised_expected_error && @with_expected_message && @block
        +  end
        +ensure
        +  return (@raised_expected_error & @with_expected_message) ? (@eval_block ? @eval_block_passed : true) : false
        +end
        +
        +
        + +
        +

        + + - (Object) verify_message + + + + + +

        + + + + +
        +
        +
        +
        +70
        +71
        +72
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +
        +
        # File 'lib/rspec/matchers/built_in/raise_error.rb', line 70
        +
        +def verify_message
        +  case @expected_message
        +  when nil
        +    true
        +  when Regexp
        +    @expected_message =~ @actual_error.message
        +  else
        +    @expected_message == @actual_error.message
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html new file mode 100644 index 000000000..7c2fd5076 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/RespondTo.html @@ -0,0 +1,630 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::RespondTo + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::RespondTo + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/respond_to.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (RespondTo) initialize(*names) + + + + + +

        +
        +

        Returns a new instance of RespondTo

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 5
        +
        +def initialize(*names)
        +  @names = names
        +  @expected_arity = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) argument + + + + Also known as: + arguments + + + + +

        + + + + +
        +
        +
        +
        +36
        +37
        +38
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 36
        +
        +def argument
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +27
        +28
        +29
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 27
        +
        +def description
        +  "respond to #{pp_names}#{with_arity}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 15
        +
        +def does_not_match?(actual)
        +  find_failing_method_names(actual, :select).empty?
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 19
        +
        +def failure_message_for_should
        +  "expected #{@actual.inspect} to respond to #{@failing_method_names.collect {|name| name.inspect }.join(', ')}#{with_arity}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 23
        +
        +def failure_message_for_should_not
        +  failure_message_for_should.sub(/to respond to/, 'not to respond to')
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 10
        +
        +def matches?(actual)
        +  find_failing_method_names(actual, :reject).empty?
        +end
        +
        +
        + +
        +

        + + - (Object) with(n) + + + + + +

        + + + + +
        +
        +
        +
        +31
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/matchers/built_in/respond_to.rb', line 31
        +
        +def with(n)
        +  @expected_arity = n
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html new file mode 100644 index 000000000..45f60a358 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/Satisfy.html @@ -0,0 +1,446 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::Satisfy + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::Satisfy + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/satisfy.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (Satisfy) initialize(&block) + + + + + +

        +
        +

        Returns a new instance of Satisfy

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 5
        +
        +def initialize(&block)
        +  @block = block
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +24
        +25
        +26
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 24
        +
        +def description
        +  "satisfy block"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 16
        +
        +def failure_message_for_should
        +  "expected #{@actual} to satisfy block"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 20
        +
        +def failure_message_for_should_not
        +  "expected #{@actual} not to satisfy block"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual, &block) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/matchers/built_in/satisfy.rb', line 9
        +
        +def matches?(actual, &block)
        +  @block = block if block
        +  @actual = actual
        +  @block.call(actual)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html new file mode 100644 index 000000000..dfc1f98f9 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/StartAndEndWith.html @@ -0,0 +1,436 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::StartAndEndWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::StartAndEndWith + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + +
        +

        Direct Known Subclasses

        +

        EndWith, StartWith

        +
        + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #match_unless_raises

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (StartAndEndWith) initialize(*expected) + + + + + +

        +
        +

        Returns a new instance of StartAndEndWith

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 5
        +
        +def initialize(*expected)
        +  @expected = expected.length == 1 ? expected.first : expected
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 18
        +
        +def failure_message_for_should
        +  "expected #{@actual.inspect} to #{self.class.name.split('::').last.sub(/With/,'').downcase} with #{@expected.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +22
        +23
        +24
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 22
        +
        +def failure_message_for_should_not
        +  "expected #{@actual.inspect} not to #{self.class.name.split('::').last.sub(/With/,'').downcase} with #{@expected.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 9
        +
        +def matches?(actual)
        +  @actual = actual.respond_to?(:[]) ? actual : (raise ArgumentError.new("#{actual.inspect} does not respond to :[]"))
        +  begin
        +    @expected.respond_to?(:length) ? subset_matches?(@expected, @actual) : element_matches?(@expected, @actual)
        +  rescue ArgumentError
        +    raise ArgumentError.new("#{actual.inspect} does not have ordered elements")
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html new file mode 100644 index 000000000..284b2af24 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/StartWith.html @@ -0,0 +1,342 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::StartWith + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::StartWith + + + +

        + +
        + +
        Inherits:
        +
        + StartAndEndWith + + + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/start_and_end_with.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from StartAndEndWith

        +

        #failure_message_for_should, #failure_message_for_should_not, #initialize, #matches?

        + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #initialize, #match_unless_raises, #matches?

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::StartAndEndWith

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Boolean) element_matches?(expected, actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 32
        +
        +def element_matches?(expected, actual)
        +  @actual[0] == @expected
        +end
        +
        +
        + +
        +

        + + - (Boolean) subset_matches?(expected, actual) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/built_in/start_and_end_with.rb', line 28
        +
        +def subset_matches?(expected, actual)
        +  actual[0, expected.length] == expected
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html new file mode 100644 index 000000000..5f5cce46b --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/ThrowSymbol.html @@ -0,0 +1,526 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::ThrowSymbol + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::ThrowSymbol + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/throw_symbol.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (ThrowSymbol) initialize(expected_symbol = nil, expected_arg = nil) + + + + + +

        +
        +

        Returns a new instance of ThrowSymbol

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 5
        +
        +def initialize(expected_symbol = nil, expected_arg=nil)
        +  @expected_symbol = expected_symbol
        +  @expected_arg = expected_arg
        +  @caught_symbol = @caught_arg = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 64
        +
        +def description
        +  "throw #{expected}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 56
        +
        +def failure_message_for_should
        +  "expected #{expected} to be thrown, got #{caught}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 60
        +
        +def failure_message_for_should_not
        +  "expected #{expected('no Symbol')}#{' not' if @expected_symbol} to be thrown, got #{caught}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(given_proc) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +50
        +51
        +52
        +53
        +
        +
        # File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 11
        +
        +def matches?(given_proc)
        +  begin
        +    if @expected_symbol.nil?
        +      given_proc.call
        +    else
        +      @caught_arg = catch :proc_did_not_throw_anything do
        +        catch @expected_symbol do
        +          given_proc.call
        +          throw :proc_did_not_throw_anything, :nothing_thrown
        +        end
        +      end
        +
        +      if @caught_arg == :nothing_thrown
        +        @caught_arg = nil
        +      else
        +        @caught_symbol = @expected_symbol
        +      end
        +    end
        +
        +    # Ruby 1.8 uses NameError with `symbol'
        +    # Ruby 1.9 uses ArgumentError with :symbol
        +  rescue NameError, ArgumentError => e
        +    unless e.message =~ /uncaught throw (`|\:)([a-zA-Z0-9_]*)(')?/
        +      other_exception = e
        +      raise
        +    end
        +    @caught_symbol = $2.to_sym
        +  rescue => other_exception
        +    raise
        +  ensure
        +    unless other_exception
        +      if @expected_symbol.nil?
        +        return !@caught_symbol.nil?
        +      else
        +        if @expected_arg.nil?
        +          return @caught_symbol == @expected_symbol
        +        else
        +          return (@caught_symbol == @expected_symbol) & (@caught_arg == @expected_arg)
        +        end
        +      end
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html new file mode 100644 index 000000000..ef4d48e72 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldControl.html @@ -0,0 +1,766 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldControl + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldControl + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #match_unless_raises

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +
        +

        + + - (YieldControl) initialize + + + + + +

        +
        +

        Returns a new instance of YieldControl

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +68
        +69
        +70
        +71
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 68
        +
        +def initialize
        +  @expectation_type = nil
        +  @expected_yields_count = nil
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) at_least(number) + + + + + +

        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +106
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 103
        +
        +def at_least(number)
        +  set_expected_yields_count(:>=, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) at_most(number) + + + + + +

        + + + + +
        +
        +
        +
        +98
        +99
        +100
        +101
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 98
        +
        +def at_most(number)
        +  set_expected_yields_count(:<=, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) exactly(number) + + + + + +

        + + + + +
        +
        +
        +
        +93
        +94
        +95
        +96
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 93
        +
        +def exactly(number)
        +  set_expected_yields_count(:==, number)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +112
        +113
        +114
        +115
        +116
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 112
        +
        +def failure_message_for_should
        +  'expected given block to yield control'.tap do |failure_message|
        +    failure_message << relativity_failure_message
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +118
        +119
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 118
        +
        +def failure_message_for_should_not
        +  'expected given block not to yield control'.tap do |failure_message|
        +    failure_message << relativity_failure_message
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +73
        +74
        +75
        +76
        +77
        +78
        +79
        +80
        +81
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 73
        +
        +def matches?(block)
        +  probe = YieldProbe.probe(block)
        +
        +  if @expectation_type
        +    probe.num_yields.send(@expectation_type, @expected_yields_count)
        +  else
        +    probe.yielded_once?(:yield_control)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) once + + + + + +

        + + + + +
        +
        +
        +
        +83
        +84
        +85
        +86
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 83
        +
        +def once
        +  exactly(1)
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) times + + + + + +

        + + + + +
        +
        +
        +
        +108
        +109
        +110
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 108
        +
        +def times
        +  self
        +end
        +
        +
        + +
        +

        + + - (Object) twice + + + + + +

        + + + + +
        +
        +
        +
        +88
        +89
        +90
        +91
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 88
        +
        +def twice
        +  exactly(2)
        +  self
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldProbe.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldProbe.html new file mode 100644 index 000000000..ea859f388 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldProbe.html @@ -0,0 +1,807 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldProbe + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldProbe + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) num_yields + + + + + + + + + + + + + + + + +

          Returns the value of attribute num_yields.

          +
          + +
        • + + +
        • + + + - (Object) yielded_args + + + + + + + + + + + + + + + + +

          Returns the value of attribute yielded_args.

          +
          + +
        • + + +
        + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (YieldProbe) initialize + + + + + +

        +
        +

        Returns a new instance of YieldProbe

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +15
        +16
        +17
        +18
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 15
        +
        +def initialize
        +  @used = false
        +  self.num_yields, self.yielded_args = 0, []
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) num_yields + + + + + +

        +
        +

        Returns the value of attribute num_yields

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 13
        +
        +def num_yields
        +  @num_yields
        +end
        +
        +
        + + + +
        +

        + + - (Object) yielded_args + + + + + +

        +
        +

        Returns the value of attribute yielded_args

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 13
        +
        +def yielded_args
        +  @yielded_args
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) assert_valid_expect_block!(block) + + + + + +

        + + + + +
        +
        +
        +
        +60
        +61
        +62
        +63
        +64
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 60
        +
        +def self.assert_valid_expect_block!(block)
        +  return if block.arity == 1
        +  raise "Your expect block must accept an argument to be used with this " +
        +        "matcher. Pass the argument as a block on to the method you are testing."
        +end
        +
        +
        + +
        +

        + + + (Object) probe(block) + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +8
        +9
        +10
        +11
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 5
        +
        +def self.probe(block)
        +  probe = new
        +  assert_valid_expect_block!(block)
        +  block.call(probe)
        +  probe.assert_used!
        +  probe
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) assert_used! + + + + + +

        + + + + +
        +
        +
        +
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 51
        +
        +def assert_used!
        +  return if @used
        +  raise "You must pass the argument yielded to your expect block on " +
        +        "to the method-under-test as a block. It acts as a probe that " +
        +        "allows the matcher to detect whether or not the method-under-test " +
        +        "yields, and, if so, how many times, and what the yielded arguments " +
        +        "are."
        +end
        +
        +
        + +
        +

        + + - (Object) single_yield_args + + + + + +

        + + + + +
        +
        +
        +
        +30
        +31
        +32
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 30
        +
        +def single_yield_args
        +  yielded_args.first
        +end
        +
        +
        + +
        +

        + + - (Object) successive_yield_args + + + + + +

        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 45
        +
        +def successive_yield_args
        +  yielded_args.map do |arg_array|
        +    arg_array.size == 1 ? arg_array.first : arg_array
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) to_proc + + + + + +

        + + + + +
        +
        +
        +
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 20
        +
        +def to_proc
        +  @used = true
        +
        +  probe = self
        +  Proc.new do |*args|
        +    probe.num_yields += 1
        +    probe.yielded_args << args
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) yielded_once?(matcher_name) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 34
        +
        +def yielded_once?(matcher_name)
        +  case num_yields
        +  when 1 then true
        +  when 0 then false
        +  else
        +    raise "The #{matcher_name} matcher is not designed to be used with a " +
        +          "method that yields multiple times. Use the yield_successive_args " +
        +          "matcher for that case."
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html new file mode 100644 index 000000000..0edc9bcdd --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldSuccessiveArgs.html @@ -0,0 +1,458 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (YieldSuccessiveArgs) initialize(*args) + + + + + +

        +
        +

        Returns a new instance of YieldSuccessiveArgs

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +254
        +255
        +256
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 254
        +
        +def initialize(*args)
        +  @expected = args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +277
        +278
        +279
        +280
        +281
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 277
        +
        +def description
        +  desc = "yield successive args"
        +  desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")"
        +  desc
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +265
        +266
        +267
        +268
        +269
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 265
        +
        +def failure_message_for_should
        +  "expected given block to yield successively with arguments, but yielded with unexpected arguments" +
        +    "\nexpected: #{@expected.inspect}" +
        +    "\n     got: #{@actual.inspect} (compared using === and ==)"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +271
        +272
        +273
        +274
        +275
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 271
        +
        +def failure_message_for_should_not
        +  "expected given block not to yield successively with arguments, but yielded with expected arguments" +
        +      "\nexpected not: #{@expected.inspect}" +
        +      "\n         got: #{@actual.inspect} (compared using === and ==)"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +258
        +259
        +260
        +261
        +262
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 258
        +
        +def matches?(block)
        +  @probe = YieldProbe.probe(block)
        +  @actual = @probe.successive_yield_args
        +  args_match?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html new file mode 100644 index 000000000..3c1e7787f --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithArgs.html @@ -0,0 +1,450 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldWithArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldWithArgs + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (YieldWithArgs) initialize(*args) + + + + + +

        +
        +

        Returns a new instance of YieldWithArgs

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +184
        +185
        +186
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 184
        +
        +def initialize(*args)
        +  @expected = args
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +203
        +204
        +205
        +206
        +207
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 203
        +
        +def description
        +  desc = "yield with args"
        +  desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")" unless @expected.empty?
        +  desc
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +195
        +196
        +197
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 195
        +
        +def failure_message_for_should
        +  "expected given block to yield with arguments, but #{positive_failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +199
        +200
        +201
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 199
        +
        +def failure_message_for_should_not
        +  "expected given block not to yield with arguments, but #{negative_failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + Also known as: + == + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +188
        +189
        +190
        +191
        +192
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 188
        +
        +def matches?(block)
        +  @probe = YieldProbe.probe(block)
        +  @actual = @probe.single_yield_args
        +  @probe.yielded_once?(:yield_with_args) && args_match?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html new file mode 100644 index 000000000..00f2caca3 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/BuiltIn/YieldWithNoArgs.html @@ -0,0 +1,361 @@ + + + + + + Class: RSpec::Matchers::BuiltIn::YieldWithNoArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::BuiltIn::YieldWithNoArgs + + + +

        + +
        + +
        Inherits:
        +
        + BaseMatcher + +
          +
        • Object
        • + + + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/built_in/yield.rb
        + +
        +
        + + +

        Constant Summary

        + + + + +

        Constant Summary

        + +

        Constants inherited + from BaseMatcher

        +

        BaseMatcher::UNDEFINED

        + + + + +

        Instance Attribute Summary

        + +

        Attributes inherited from BaseMatcher

        +

        #actual, #expected, #rescued_exception

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods inherited from BaseMatcher

        +

        #==, #description, #diffable?, #initialize, #match_unless_raises

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        +
        +

        Constructor Details

        + +

        This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) failure_message_for_should + + + + + +

        + + + + +
        +
        +
        +
        +164
        +165
        +166
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 164
        +
        +def failure_message_for_should
        +  "expected given block to yield with no arguments, but #{failure_reason}"
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not + + + + + +

        + + + + +
        +
        +
        +
        +168
        +169
        +170
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 168
        +
        +def failure_message_for_should_not
        +  "expected given block not to yield with no arguments, but did"
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(block) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +159
        +160
        +161
        +162
        +
        +
        # File 'lib/rspec/matchers/built_in/yield.rb', line 159
        +
        +def matches?(block)
        +  @probe = YieldProbe.probe(block)
        +  @probe.yielded_once?(:yield_with_no_args) && @probe.single_yield_args.empty?
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Configuration.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Configuration.html new file mode 100644 index 000000000..5c385716c --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Configuration.html @@ -0,0 +1,708 @@ + + + + + + Class: RSpec::Matchers::Configuration + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::Configuration + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/configuration.rb
        + +
        +
        + +

        Overview

        +
        +

        Provides configuration options for rspec-expectations.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + +
        + +
        NullBacktraceFormatter = +
        +
        +

        + This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        +
        +
        Module.new do
        +  def self.format_backtrace(backtrace)
        +    backtrace
        +  end
        +end
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) backtrace_formatter + + + + + +

        + + + + +
        +
        +
        +
        +82
        +83
        +84
        +85
        +86
        +87
        +88
        +
        +
        # File 'lib/rspec/matchers/configuration.rb', line 82
        +
        +def backtrace_formatter
        +  @backtrace_formatter ||= if defined?(::RSpec::Core::BacktraceFormatter)
        +    ::RSpec::Core::BacktraceFormatter
        +  else
        +    NullBacktraceFormatter
        +  end
        +end
        +
        +
        + + + +
        +

        + + - (Object) color=(value) (writeonly) + + + + + +

        +
        +

        Sets the attribute color

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + value + + + + + + + — +

          the value to set the attribute color to.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/matchers/configuration.rb', line 49
        +
        +def color=(value)
        +  @color = value
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) add_should_and_should_not_to(*modules) + + + + + +

        +
        +

        Adds should and should_not to the given classes +or modules. This can be used to ensure should works +properly on things like proxy objects (particular +Delegator-subclassed objects on 1.8).

        + + +
        +
        +
        +

        Parameters:

        +
          + +
        • + + modules + + + (Array<Module>) + + + + — +

          the list of classes or modules +to add should and should_not to.

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +62
        +63
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/matchers/configuration.rb', line 62
        +
        +def add_should_and_should_not_to(*modules)
        +  modules.each do |mod|
        +    Expectations::Syntax.enable_should(mod)
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) color? + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/matchers/configuration.rb', line 45
        +
        +def color?
        +  ::RSpec.configuration.color_enabled?
        +end
        +
        +
        + +
        +

        + + - (Array<Symbol>) syntax + + + + + +

        +
        +

        The list of configured syntaxes.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Array<Symbol>) + + + + — +

          the list of configured syntaxes.

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +35
        +36
        +37
        +38
        +39
        +40
        +
        +
        # File 'lib/rspec/matchers/configuration.rb', line 35
        +
        +def syntax
        +  syntaxes = []
        +  syntaxes << :should if Expectations::Syntax.should_enabled?
        +  syntaxes << :expect if Expectations::Syntax.expect_enabled?
        +  syntaxes
        +end
        +
        +
        + +
        +

        + + - (Object) syntax=(values) + + + + + +

        +
        +

        Configures the supported syntax.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        RSpec.configure do |rspec|
        +  rspec.expect_with :rspec do |c|
        +    c.syntax = :should
        +    # or
        +    c.syntax = :expect
        +    # or
        +    c.syntax = [:should, :expect]
        +  end
        +end
        + +
        +

        Parameters:

        +
          + +
        • + + values + + + (Array<Symbol>, Symbol) + + + + — +

          the syntaxes to enable

          +
          + +
        • + +
        + + +
        + + + + +
        +
        +
        +
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +
        +
        # File 'lib/rspec/matchers/configuration.rb', line 19
        +
        +def syntax=(values)
        +  if Array(values).include?(:expect)
        +    Expectations::Syntax.enable_expect
        +  else
        +    Expectations::Syntax.disable_expect
        +  end
        +
        +  if Array(values).include?(:should)
        +    Expectations::Syntax.enable_should
        +  else
        +    Expectations::Syntax.disable_should
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/DSL.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/DSL.html new file mode 100644 index 000000000..ccc4dde2d --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/DSL.html @@ -0,0 +1,220 @@ + + + + + + Module: RSpec::Matchers::DSL + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::DSL + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/dsl.rb,
        + lib/rspec/matchers/matcher.rb
        +
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + + + Classes: Matcher + + +

        + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) define(name, &declarations) + + + + Also known as: + matcher + + + + +

        +
        +

        Defines a custom matcher.

        + + +
        +
        +
        + + +

        See Also:

        + + +
        + + + + +
        +
        +
        +
        +6
        +7
        +8
        +9
        +10
        +11
        +12
        +13
        +
        +
        # File 'lib/rspec/matchers/dsl.rb', line 6
        +
        +def define(name, &declarations)
        +  matcher_template = RSpec::Matchers::DSL::Matcher.new(name, &declarations)
        +  define_method name do |*expected|
        +    matcher = matcher_template.for_expected(*expected)
        +    matcher.matcher_execution_context = @matcher_execution_context ||= self
        +    matcher
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/DSL/Matcher.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/DSL/Matcher.html new file mode 100644 index 000000000..8a56422e4 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/DSL/Matcher.html @@ -0,0 +1,1769 @@ + + + + + + Class: RSpec::Matchers::DSL::Matcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::DSL::Matcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + +
        Includes:
        +
        RSpec::Matchers, Extensions::InstanceEvalWithArgs, Pretty
        + + + + + +
        Defined in:
        +
        lib/rspec/matchers/matcher.rb
        + +
        +
        + +

        Overview

        +
        +

        Provides the context in which the block passed to RSpec::Matchers.define +will be evaluated.

        + + +
        +
        +
        + + +
        +

        Constant Summary

        + +
        + +
        PERSISTENT_INSTANCE_VARIABLES = + +
        +
        [
        +  :@name, :@declarations, :@diffable,
        +  :@match_block, :@match_for_should_not_block,
        +  :@expected_exception
        +].to_set
        + +
        + + + + + +

        Instance Attribute Summary (collapse)

        +
          + +
        • + + + - (Object) actual + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute actual.

          +
          + +
        • + + +
        • + + + - (Object) expected + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute expected.

          +
          + +
        • + + +
        • + + + - (Object) matcher_execution_context + + + + + + + + + + + + + + + + +

          Returns the value of attribute matcher_execution_context.

          +
          + +
        • + + +
        • + + + - (Object) rescued_exception + + + + + + + + + readonly + + + + + + + + + +

          Returns the value of attribute rescued_exception.

          +
          + +
        • + + +
        + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + + + + + + + + +

        Methods included from RSpec::Matchers

        +

        #be, #be_a, #be_a_kind_of, #be_an_instance_of, #be_close, #be_false, #be_nil, #be_true, #be_within, #change, clear_generated_description, configuration, #cover, #end_with, #eq, #eql, #equal, #exist, generated_description, #have, #have_at_least, #have_at_most, is_a_matcher?, #match_array, #raise_error, #respond_to, #satisfy, #start_with, #throw_symbol, #yield_control, #yield_successive_args, #yield_with_args, #yield_with_no_args

        + + + + + + + + + +

        Methods included from Pretty

        +

        #_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

        + + + + + + + + + +

        Methods included from Extensions::InstanceEvalWithArgs

        +

        #instance_eval_with_args

        +
        +

        Constructor Details

        + +
        +

        + + - (Matcher) initialize(name, &declarations) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Returns a new instance of Matcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 17
        +
        +def initialize(name, &declarations)
        +  @name         = name
        +  @declarations = declarations
        +  @actual       = nil
        +  @diffable     = false
        +  @expected_exception, @rescued_exception = nil, nil
        +  @match_for_should_not_block = nil
        +  @messages = {}
        +end
        +
        +
        + +
        +
        +

        Dynamic Method Handling

        +

        + This class handles dynamic methods through the method_missing method + +

        + +
        +

        + + - (Object) method_missing(method, *args, &block) (private) + + + + + +

        + + + + +
        +
        +
        +
        +232
        +233
        +234
        +235
        +236
        +237
        +238
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 232
        +
        +def method_missing(method, *args, &block)
        +  if matcher_execution_context.respond_to?(method)
        +    matcher_execution_context.__send__ method, *args, &block
        +  else
        +    super(method, *args, &block)
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Attribute Details

        + + + +
        +

        + + - (Object) actual (readonly) + + + + + +

        +
        +

        Returns the value of attribute actual

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 13
        +
        +def actual
        +  @actual
        +end
        +
        +
        + + + +
        +

        + + - (Object) expected (readonly) + + + + + +

        +
        +

        Returns the value of attribute expected

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 13
        +
        +def expected
        +  @expected
        +end
        +
        +
        + + + +
        +

        + + - (Object) matcher_execution_context + + + + + +

        +
        +

        Returns the value of attribute matcher_execution_context

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 14
        +
        +def matcher_execution_context
        +  @matcher_execution_context
        +end
        +
        +
        + + + +
        +

        + + - (Object) rescued_exception (readonly) + + + + + +

        +
        +

        Returns the value of attribute rescued_exception

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +13
        +14
        +15
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 13
        +
        +def rescued_exception
        +  @rescued_exception
        +end
        +
        +
        + +
        + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) chain(method, &block) + + + + + +

        +
        +

        Convenience for defining methods on this matcher to create a fluent +interface. The trick about fluent interfaces is that each method must +return self in order to chain methods together. chain handles that +for you.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_errors_on do |key|
        +  chain :with do |message|
        +    @message = message
        +  end
        +
        +  match do |actual|
        +    actual.errors[key] == @message
        +  end
        +end
        +
        +minor.should have_errors_on(:age).with("Not old enough to participate")
        + +
        + + +
        + + + + +
        +
        +
        +
        +204
        +205
        +206
        +207
        +208
        +209
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 204
        +
        +def chain(method, &block)
        +  define_method method do |*args|
        +    block.call(*args)
        +    self
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) description(&block) + + + + + +

        +
        +

        Customize the description to use for one-liners. Only use this when +the description generated by default doesn't suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :qualify_for do |expected|
        +  match { ... }
        +
        +  description do
        +    "qualify for #{expected}"
        +  end
        +end
        + +
        + + +
        + + + + +
        +
        +
        +
        +176
        +177
        +178
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 176
        +
        +def description(&block)
        +  cache_or_call_cached(:description, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) diffable + + + + + +

        +
        +

        Tells the matcher to diff the actual and expected values in the failure +message.

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +182
        +183
        +184
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 182
        +
        +def diffable
        +  @diffable = true
        +end
        +
        +
        + +
        +

        + + - (Boolean) diffable? + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used internally by objects returns by +should+ and +should_not+.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +213
        +214
        +215
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 213
        +
        +def diffable?
        +  @diffable
        +end
        +
        +
        + +
        +

        + + - (Boolean) does_not_match?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used internally by +should_not+

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +219
        +220
        +221
        +222
        +223
        +224
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 219
        +
        +def does_not_match?(actual)
        +  @actual = actual
        +  @match_for_should_not_block ?
        +    instance_eval_with_args(actual, &@match_for_should_not_block) :
        +    !matches?(actual)
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should {|Object| ... } + + + + + +

        +
        +

        Customize the failure messsage to use when this matcher is invoked with +should. Only use this when the message generated by default doesn't +suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_strength do |expected|
        +  match { ... }
        +
        +  failure_message_for_should do |actual|
        +    "Expected strength of #{expected}, but had #{actual.strength}"
        +  end
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +139
        +140
        +141
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 139
        +
        +def failure_message_for_should(&block)
        +  cache_or_call_cached(:failure_message_for_should, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) failure_message_for_should_not {|Object| ... } + + + + + +

        +
        +

        Customize the failure messsage to use when this matcher is invoked with +should_not. Only use this when the message generated by default +doesn't suit your needs.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :have_strength do |expected|
        +  match { ... }
        +
        +  failure_message_for_should_not do |actual|
        +    "Expected not to have strength of #{expected}, but did"
        +  end
        +end
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual object

          +
          + +
        • + +
        • + + + (Object) + + + + — +

          actual the actual object

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +159
        +160
        +161
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 159
        +
        +def failure_message_for_should_not(&block)
        +  cache_or_call_cached(:failure_message_for_should_not, &block)
        +end
        +
        +
        + +
        +

        + + - (Object) for_expected(*expected) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 34
        +
        +def for_expected(*expected)
        +  @expected = expected
        +  dup.instance_eval do
        +    instance_variables.map {|ivar| ivar.intern}.each do |ivar|
        +      instance_variable_set(ivar, nil) unless (PERSISTENT_INSTANCE_VARIABLES + [:@expected]).include?(ivar)
        +    end
        +    @messages = {}
        +    making_declared_methods_public do
        +      instance_eval_with_args(*@expected, &@declarations)
        +    end
        +    self
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) match {|Object| ... } + + + + Also known as: + match_for_should + + + + +

        +
        +

        Stores the block that is used to determine whether this matcher passes +or fails. The block should return a boolean value. When the matcher is +passed to should and the block returns true, then the expectation +passes. Similarly, when the matcher is passed to should_not and the +block returns false, then the expectation passes.

        + +

        Use match_for_should when used in conjuntion with +match_for_should_not.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :be_even do
        +  match do |actual|
        +    actual.even?
        +  end
        +end
        +
        +4.should be_even     # passes
        +3.should_not be_even # passes
        +3.should be_even     # fails
        +4.should_not be_even # fails
        + +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual value (or receiver of should)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +91
        +92
        +93
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 91
        +
        +def match(&block)
        +  @match_block = block
        +end
        +
        +
        + +
        +

        + + - (Object) match_for_should_not {|Object| ... } + + + + + +

        +
        +

        Use this to define the block for a negative expectation (should_not) +when the positive and negative forms require different handling. This +is rarely necessary, but can be helpful, for example, when specifying +asynchronous processes that require different timeouts.

        + + +
        +
        +
        + +

        Yields:

        +
          + +
        • + + + (Object) + + + + — +

          actual the actual value (or receiver of should)

          +
          + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +103
        +104
        +105
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 103
        +
        +def match_for_should_not(&block)
        +  @match_for_should_not_block = block
        +end
        +
        +
        + +
        +

        + + - (Object) match_unless_raises(exception = Exception, &block) + + + + + +

        +
        +

        Use this instead of match when the block will raise an exception +rather than returning false to indicate a failure.

        + + +
        +
        +
        + +
        +

        Examples:

        + + +
        
        +RSpec::Matchers.define :accept_as_valid do |candidate_address|
        +  match_unless_raises ValidationException do |validator|
        +    validator.validate(candidate_address)
        +  end
        +end
        +
        +email_validator.should accept_as_valid("person@company.com")
        + +
        + + +
        + + + + +
        +
        +
        +
        +119
        +120
        +121
        +122
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 119
        +
        +def match_unless_raises(exception=Exception, &block)
        +  @expected_exception = exception
        +  match(&block)
        +end
        +
        +
        + +
        +

        + + - (Boolean) matches?(actual) + + + + + +

        +
        +

        + This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

        +

        Used internally by +should+ and +should_not+.

        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +50
        +51
        +52
        +53
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +62
        +63
        +64
        +65
        +66
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 50
        +
        +def matches?(actual)
        +  @actual = actual
        +  if @expected_exception
        +    begin
        +      instance_eval_with_args(actual, &@match_block)
        +      true
        +    rescue @expected_exception => @rescued_exception
        +      false
        +    end
        +  else
        +    begin
        +      instance_eval_with_args(actual, &@match_block)
        +    rescue RSpec::Expectations::ExpectationNotMetError
        +      false
        +    end
        +  end
        +end
        +
        +
        + +
        +

        + + - (Boolean) respond_to?(method, include_private = false) + + + + + +

        +
        + + +
        +
        +
        + +

        Returns:

        +
          + +
        • + + + (Boolean) + + + +
        • + +
        + +
        + + + + +
        +
        +
        +
        +226
        +227
        +228
        +
        +
        # File 'lib/rspec/matchers/matcher.rb', line 226
        +
        +def respond_to?(method, include_private=false)
        +  super || matcher_execution_context.respond_to?(method, include_private)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Extensions.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Extensions.html new file mode 100644 index 000000000..d2661ed59 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Extensions.html @@ -0,0 +1,115 @@ + + + + + + Module: RSpec::Matchers::Extensions + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::Extensions + + + +

        + +
        + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/extensions/instance_eval_with_args.rb
        + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: InstanceEvalWithArgs + + + + +

        + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Extensions/InstanceEvalWithArgs.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Extensions/InstanceEvalWithArgs.html new file mode 100644 index 000000000..90349a871 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Extensions/InstanceEvalWithArgs.html @@ -0,0 +1,239 @@ + + + + + + Module: RSpec::Matchers::Extensions::InstanceEvalWithArgs + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::Extensions::InstanceEvalWithArgs + + + +

        + +
        + + + + + + + +
        Included in:
        +
        DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/extensions/instance_eval_with_args.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) instance_eval_with_args(*args, &block) + + + + + +

        +
        +

        based on Bounded Spec InstanceExec (Mauricio Fernandez) +http://eigenclass.org/hiki/bounded+space+instance_exec +- uses singleton_class instead of global InstanceExecHelper module +- this keeps it scoped to classes/modules that include this module +- only necessary for ruby 1.8.6

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/matchers/extensions/instance_eval_with_args.rb', line 10
        +
        +def instance_eval_with_args(*args, &block)
        +  return instance_exec(*args, &block) if respond_to?(:instance_exec)
        +
        +  # If there are no args and the block doesn't expect any, there's no
        +  # need to fake instance_exec with our hack below.
        +  # Notes:
        +  #   * lambda { }.arity # => -1
        +  #   * lambda { || }.arity # => 0
        +  #   * lambda { |*a| }.arity # -1
        +  return instance_eval(&block) if block.arity < 1 && args.empty?
        +
        +  singleton_class = (class << self; self; end)
        +  begin
        +    orig_critical, Thread.critical = Thread.critical, true
        +    n = 0
        +    n += 1 while respond_to?(method_name="__instance_exec#{n}")
        +    singleton_class.module_eval{ define_method(method_name, &block) }
        +  ensure
        +    Thread.critical = orig_critical
        +  end
        +  begin
        +    return __send__(method_name, *args)
        +  ensure
        +    singleton_class.module_eval{ remove_method(method_name) } rescue nil
        +  end
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/OperatorMatcher.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/OperatorMatcher.html new file mode 100644 index 000000000..5650c199d --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/OperatorMatcher.html @@ -0,0 +1,631 @@ + + + + + + Class: RSpec::Matchers::OperatorMatcher + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Class: RSpec::Matchers::OperatorMatcher + + + +

        + +
        + +
        Inherits:
        +
        + Object + +
          +
        • Object
        • + + + +
        + show all + +
        + + + + + + + + + +
        Defined in:
        +
        lib/rspec/matchers/operator_matcher.rb
        + +
        +
        + + + + + + + + + + +

        + Class Method Summary + (collapse) +

        + + + +

        + Instance Method Summary + (collapse) +

        + + + + +
        +

        Constructor Details

        + +
        +

        + + - (OperatorMatcher) initialize(actual) + + + + + +

        +
        +

        Returns a new instance of OperatorMatcher

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +28
        +29
        +30
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 28
        +
        +def initialize(actual)
        +  @actual = actual
        +end
        +
        +
        + +
        + + +
        +

        Class Method Details

        + + +
        +

        + + + (Object) get(klass, operator) + + + + + +

        + + + + +
        +
        +
        +
        +18
        +19
        +20
        +21
        +22
        +23
        +24
        +25
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 18
        +
        +def get(klass, operator)
        +  klass.ancestors.each { |ancestor|
        +    matcher = registry[ancestor] && registry[ancestor][operator]
        +    return matcher if matcher
        +  }
        +
        +  nil
        +end
        +
        +
        + +
        +

        + + + (Object) register(klass, operator, matcher) + + + + + +

        + + + + +
        +
        +
        +
        +9
        +10
        +11
        +12
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 9
        +
        +def register(klass, operator, matcher)
        +  registry[klass] ||= {}
        +  registry[klass][operator] = matcher
        +end
        +
        +
        + +
        +

        + + + (Object) registry + + + + + +

        + + + + +
        +
        +
        +
        +5
        +6
        +7
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 5
        +
        +def registry
        +  @registry ||= {}
        +end
        +
        +
        + +
        +

        + + + (Object) unregister(klass, operator) + + + + + +

        + + + + +
        +
        +
        +
        +14
        +15
        +16
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 14
        +
        +def unregister(klass, operator)
        +  registry[klass] && registry[klass].delete(operator)
        +end
        +
        +
        + +
        +

        + + + (Object) use_custom_matcher_or_delegate(operator) + + + + + +

        + + + + +
        +
        +
        +
        +32
        +33
        +34
        +35
        +36
        +37
        +38
        +39
        +40
        +41
        +42
        +43
        +44
        +45
        +46
        +47
        +48
        +49
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 32
        +
        +def self.use_custom_matcher_or_delegate(operator)
        +  define_method(operator) do |expected|
        +    if uses_generic_implementation_of?(operator) && matcher = OperatorMatcher.get(@actual.class, operator)
        +      @actual.__send__(::RSpec::Matchers.last_should, matcher.new(expected))
        +    else
        +      eval_match(@actual, operator, expected)
        +    end
        +  end
        +
        +  negative_operator = operator.sub(/^=/, '!')
        +  if negative_operator != operator && respond_to?(negative_operator)
        +    define_method(negative_operator) do |expected|
        +      opposite_should = ::RSpec::Matchers.last_should == :should ? :should_not : :should
        +      raise "RSpec does not support `#{::RSpec::Matchers.last_should} #{negative_operator} expected`.  " +
        +        "Use `#{opposite_should} #{operator} expected` instead."
        +    end
        +  end
        +end
        +
        +
        + +
        + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) description + + + + + +

        + + + + +
        +
        +
        +
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 59
        +
        +def description
        +  "#{@operator} #{@expected.inspect}"
        +end
        +
        +
        + +
        +

        + + - (Object) fail_with_message(message) + + + + + +

        + + + + +
        +
        +
        +
        +55
        +56
        +57
        +
        +
        # File 'lib/rspec/matchers/operator_matcher.rb', line 55
        +
        +def fail_with_message(message)
        +  RSpec::Expectations.fail_with(message, @expected, @actual)
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Pretty.html b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Pretty.html new file mode 100644 index 000000000..6317347a5 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/RSpec/Matchers/Pretty.html @@ -0,0 +1,605 @@ + + + + + + Module: RSpec::Matchers::Pretty + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Module: RSpec::Matchers::Pretty + + + +

        + +
        + + + + + + + +
        Included in:
        +
        BuiltIn::BaseMatcher, DSL::Matcher
        + + + +
        Defined in:
        +
        lib/rspec/matchers/pretty.rb
        + +
        +
        + + + + + + + + + +

        + Instance Method Summary + (collapse) +

        + + + + + + +
        +

        Instance Method Details

        + + +
        +

        + + - (Object) _pretty_print(array) + + + + + +

        + + + + +
        +
        +
        +
        +23
        +24
        +25
        +26
        +27
        +28
        +29
        +30
        +31
        +32
        +33
        +34
        +35
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 23
        +
        +def _pretty_print(array)
        +  result = ""
        +  array.each_with_index do |item, index|
        +    if index < (array.length - 2)
        +      result << "#{item.inspect}, "
        +    elsif index < (array.length - 1)
        +      result << "#{item.inspect} and "
        +    else
        +      result << "#{item.inspect}"
        +    end
        +  end
        +  result
        +end
        +
        +
        + +
        +

        + + - (Object) expected_to_sentence + + + + + +

        + + + + +
        +
        +
        +
        +45
        +46
        +47
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 45
        +
        +def expected_to_sentence
        +  to_sentence(@expected) if defined?(@expected)
        +end
        +
        +
        + +
        +

        + + - (Object) name + + + + + +

        + + + + +
        +
        +
        +
        +49
        +50
        +51
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 49
        +
        +def name
        +  defined?(@name) ? @name : underscore(self.class.name.split("::").last)
        +end
        +
        +
        + +
        +

        + + - (Object) name_to_sentence + + + + + +

        + + + + +
        +
        +
        +
        +41
        +42
        +43
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 41
        +
        +def name_to_sentence
        +  split_words(name)
        +end
        +
        +
        + +
        +

        + + - (Object) split_words(sym) + + + + + +

        + + + + +
        +
        +
        +
        +4
        +5
        +6
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 4
        +
        +def split_words(sym)
        +  sym.to_s.gsub(/_/,' ')
        +end
        +
        +
        + +
        +

        + + - (Object) to_sentence(words) + + + + + +

        + + + + +
        +
        +
        +
        +8
        +9
        +10
        +11
        +12
        +13
        +14
        +15
        +16
        +17
        +18
        +19
        +20
        +21
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 8
        +
        +def to_sentence(words)
        +  return "" unless words
        +  words = Array(words).map { |w| to_word(w) }
        +  case words.length
        +    when 0
        +      ""
        +    when 1
        +      " #{words[0]}"
        +    when 2
        +      " #{words[0]} and #{words[1]}"
        +    else
        +      " #{words[0...-1].join(', ')}, and #{words[-1]}"
        +  end
        +end
        +
        +
        + +
        +

        + + - (Object) to_word(item) + + + + + +

        + + + + +
        +
        +
        +
        +37
        +38
        +39
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 37
        +
        +def to_word(item)
        +  is_matcher_with_description?(item) ? item.description : item.inspect
        +end
        +
        +
        + +
        +

        + + - (Object) underscore(camel_cased_word) + + + + + +

        +
        +

        Borrowed from ActiveSupport

        + + +
        +
        +
        + + +
        + + + + +
        +
        +
        +
        +54
        +55
        +56
        +57
        +58
        +59
        +60
        +61
        +
        +
        # File 'lib/rspec/matchers/pretty.rb', line 54
        +
        +def underscore(camel_cased_word)
        +  word = camel_cased_word.to_s.dup
        +  word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
        +  word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
        +  word.tr!("-", "_")
        +  word.downcase!
        +  word
        +end
        +
        +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/_index.html b/source/documentation/2.14/rspec-expectations/_index.html new file mode 100644 index 000000000..21672b0e8 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/_index.html @@ -0,0 +1,622 @@ + + + + + + Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Documentation by YARD 0.8.7.4

        +
        +

        Alphabetic Index

        + +

        File Listing

        + + +
        +

        Namespace Listing A-Z

        + + + + + + + + +
        + + +
          +
        • B
        • +
            + +
          • + BaseMatcher + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Be + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeAKindOf + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeAnInstanceOf + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeComparedTo + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeFalse + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeHelpers + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeNil + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BePredicate + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeTrue + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BeWithin + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + BuiltIn + + (RSpec::Matchers) + +
          • + +
          +
        + + +
          +
        • C
        • +
            + +
          • + Change + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Configuration + + (RSpec::Matchers) + +
          • + +
          • + Cover + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + +
          +
        • D
        • + +
        + + + + + +
          +
        • H
        • +
            + +
          • + Has + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Have + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + + +
          +
        • M
        • +
            + +
          • + Match + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + MatchArray + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + Matcher + + (RSpec::Matchers::DSL) + +
          • + +
          • + Matchers + + (RSpec) + +
          • + +
          +
        + + +
        + + + + + + + + + + + +
          +
        • R
        • +
            + +
          • + RSpec + +
          • + +
          • + RaiseError + + (RSpec::Matchers::BuiltIn) + +
          • + +
          • + RespondTo + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + + +
          +
        • T
        • +
            + +
          • + ThrowSymbol + + (RSpec::Matchers::BuiltIn) + +
          • + +
          +
        + + + + +
        + +
        + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/class_list.html b/source/documentation/2.14/rspec-expectations/class_list.html new file mode 100644 index 000000000..67ece508e --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/class_list.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + Class List + + + + +
        +

        Class List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-expectations/file.Changelog.html b/source/documentation/2.14/rspec-expectations/file.Changelog.html new file mode 100644 index 000000000..b6870e277 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/file.Changelog.html @@ -0,0 +1,610 @@ + + + + + + File: Changelog + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        2.14.5 / 2014-02-01

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix wrong matcher descriptions with falsey expected value (yujinakayama)
        • +
        + +

        2.14.4 / 2013-11-06

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Make the match matcher produce a diff output. (Jon Rowe, Ben Moss)
        • +
        • Choose encoding for diff's more intelligently, and when all else fails fall +back to default internal encoding with replacing characters. (Jon Rowe)
        • +
        + +

        2.14.3 / 2013-09-22

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix operator matchers (should syntax) when method is redefined on target. +(Brandon Turner)
        • +
        • Fix diffing of hashes with object based keys. (Jon Rowe)
        • +
        • Fix operator matchers (should syntax) when operator is defined via +method_missing (Jon Rowe)
        • +
        + +

        2.14.2 / 2013-08-14

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix be_<predicate> matcher to not support operator chaining like the +be matcher does (e.g. be == 5). This led to some odd behaviors +since be_<predicate> == anything returned a BeComparedTo matcher +and was thus always truthy. This was a consequence of the implementation +(e.g. subclassing the basic Be matcher) and was not intended behavior. +(Myron Marston).
        • +
        • Fix change matcher to compare using == in addition to ===. This +is important for an expression like: +expect {}.to change { a.class }.from(ClassA).to(ClassB) because +SomeClass === SomeClass returns false. (Myron Marston)
        • +
        + +

        2.14.1 / 2013-08-08

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Ensure diff output uses the same encoding as the encoding of +the string being diff'd to prevent Encoding::UndefinedConversionError +errors (Jon Rowe).
        • +
        + +

        2.14.0 / 2013-07-06

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Values that are not matchers use #inspect, rather than #description for +documentation output (Andy Lindeman, Sam Phippen).
        • +
        • Make expect(a).to be_within(x).percent_of(y) work with negative y +(Katsuhiko Nishimra).
        • +
        • Make the be_predicate matcher work as expected used with expect{...}.to +change... (Sam Phippen).
        • +
        + +

        2.14.0.rc1 / 2013-05-27

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Enhance yield_control so that you can specify an exact or relative +number of times: expect { }.to yield_control.exactly(3).times, +expect { }.to yield_control.at_least(2).times, etc (Bartek +Borkowski).
        • +
        • Make the differ that is used when an expectation fails better handle arrays +by splitting each element of the array onto its own line. (Sam Phippen)
        • +
        • Accept duck-typed strings that respond to :to_str as expectation messages. +(Toby Ovod-Everett)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix differ to not raise errors when dealing with differently-encoded +strings (Jon Rowe).
        • +
        • Fix expect(something).to be_within(x).percent_of(y) where x and y are both +integers (Sam Phippen).
        • +
        • Fix have matcher to handle the fact that on ruby 2.0, +Enumerator#size may return nil (Kenta Murata).
        • +
        • Fix expect { raise s }.to raise_error(s) where s is an error instance +on ruby 2.0 (Sam Phippen).
        • +
        • Fix expect(object).to raise_error passing. This now warns the user and +fails the spec (tomykaira).
        • +
        + +

        Deprecations

        + +
          +
        • Deprecate expect { }.not_to raise_error(SpecificErrorClass) or +expect { }.not_to raise_error("some specific message"). Using +these was prone to hiding failures as they would allow any other +error to pass. (Sam Phippen and David Chelimsky)
        • +
        + +

        2.13.0 / 2013-02-23

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Add support for percent deltas to be_within matcher: +expect(value).to be_within(10).percent_of(expected) +(Myron Marston).
        • +
        • Add support to include matcher to allow it to be given a list +of matchers as the expecteds to match against (Luke Redpath).
        • +
        + +

        Bug fixes

        + +
          +
        • Fix change matcher so that it dups strings in order to handle +mutated strings (Myron Marston).
        • +
        • Fix should be =~ /some regex/ / expect(...).to be =~ /some regex/. +Previously, these either failed with a confusing undefined method +matches?' for false:FalseClass error or were no-ops that didn't +actually verify anything (Myron Marston).
        • +
        • Add compatibility for diff-lcs 1.2 and relax the version +constraint (Peter Goldstein).
        • +
        • Fix DSL-generated matchers to allow multiple instances of the +same matcher in the same example to have different description +and failure messages based on the expected value (Myron Marston).
        • +
        • Prevent undefined method #split for Array error when dumping +the diff of an array of multiline strings (Myron Marston).
        • +
        • Don't blow up when comparing strings that are in an encoding +that is not ASCII compatible (Myron Marston).
        • +
        • Remove confusing "Check the implementation of #==" message +printed for empty diffs (Myron Marston).
        • +
        + +

        2.12.1 / 2012-12-15

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Improve the failure message for an expression like +{}.should =~ {}. (Myron Marston and Andy Lindeman)
        • +
        • Provide a match_regex alias so that custom matchers +built using the matcher DSL can use it (since match +is a different method in that context). +(Steven Harman)
        • +
        + +

        2.12.0 / 2012-11-12

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Colorize diffs if the --color option is configured. (Alex Coplan)
        • +
        • Include backtraces in unexpected errors handled by raise_error +matcher (Myron Marston)
        • +
        • Print a warning when users accidentally pass a non-string argument +as an expectation message (Sam Phippen)
        • +
        • =~ and match_array matchers output a more useful error message when +the actual value is not an array (or an object that responds to #to_ary) +(Sam Phippen)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix include matcher so that expect({}).to include(:a => nil) +fails as it should (Sam Phippen).
        • +
        • Fix be_an_instance_of matcher so that Class#to_s is used in the +description rather than Class#inspect, since some classes (like +ActiveRecord::Base) define a long, verbose #inspect. +(Tom Stuart)
        • +
        + +

        2.11.3 / 2012-09-04

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Fix (and deprecate) expect { }.should syntax so that it works even +though it was never a documented or intended syntax. It worked as a +consequence of the implementation of expect in RSpec 2.10 and +earlier. (Myron Marston)
        • +
        • Ensure #== is defined on built in matchers so that they can be composed. +For example:

          + +

          expect { + user.emailed! +}.to change { user.last_emailed_at }.to be_within(1.second).of(Time.zone.now)

        • +
        + +

        2.11.2 / 2012-07-25

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Define should and should_not on Object rather than BasicObject +on MacRuby. On MacRuby, BasicObject is defined but is not the root +of the object hierarchy. (Gabriel Gilder)
        • +
        + +

        2.11.1 / 2012-07-08

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Constrain actual in be_within matcher to values that respond to - instead +of requiring a specific type. + +
            +
          • Time, for example, is a legit alternative.
          • +
        • +
        + +

        2.11.0 / 2012-07-07

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Expand expect syntax so that it supports expections on bare values +in addition to blocks (Myron Marston).
        • +
        • Add configuration options to control available expectation syntaxes +(Myron Marston): + +
            +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :expect }
          • +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :should }
          • +
          • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
          • +
          • RSpec.configuration.add_should_and_should_not_to Delegator
          • +
        • +
        + +

        Bug fixes

        + +
          +
        • Allow only Numeric values to be the "actual" in the be_within matcher. +This prevents confusing error messages. (Su Zhang @zhangsu)
        • +
        • Define should and should_not on BasicObject rather than Kernel +on 1.9. This makes should and should_not work properly with +BasicObject-subclassed proxy objects like Delegator. (Myron +Marston)
        • +
        + +

        2.10.0 / 2012-05-03

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Add new start_with and end_with matchers (Jeremy Wadsack)
        • +
        • Add new matchers for specifying yields (Myron Marston): + +
            +
          • expect {...}.to yield_control
          • +
          • expect {...}.to yield_with_args(1, 2, 3)
          • +
          • expect {...}.to yield_with_no_args
          • +
          • expect {...}.to yield_successive_args(1, 2, 3)
          • +
        • +
        • match_unless_raises takes multiple exception args
        • +
        + +

        Bug fixes

        + +
          +
        • Fix be_within matcher to be inclusive of delta.
        • +
        • Fix message-specific specs to pass on Rubinius (John Firebaugh)
        • +
        + +

        2.9.1 / 2012-04-03

        + +

        full changelog

        + +

        Bug fixes

        + +
          +
        • Provide a helpful message if the diff between two objects is empty.
        • +
        • Fix bug diffing single strings with multiline strings.
        • +
        • Fix for error with using custom matchers inside other custom matchers +(mirasrael)
        • +
        • Fix using execution context methods in nested DSL matchers (mirasrael)
        • +
        + +

        2.9.0 / 2012-03-17

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce pollution +of RSpec::Matchers (which is included in every example).
        • +
        • Autoload files with matcher classes to improve load time.
        • +
        + +

        Bug fixes

        + +
          +
        • Align respond_to? and method_missing in DSL-defined matchers.
        • +
        • Clear out user-defined instance variables between invocations of DSL-defined +matchers.
        • +
        • Dup the instance of a DSL generated matcher so its state is not changed by +subsequent invocations.
        • +
        • Treat expected args consistently across positive and negative expectations +(thanks to Ralf Kistner for the heads up)
        • +
        + +

        2.8.0 / 2012-01-04

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Better diff output for Hash (Philippe Creux)
        • +
        • Eliminate Ruby warnings (Olek Janiszewski)
        • +
        + +

        2.8.0.rc2 / 2011-12-19

        + +

        full changelog

        + +

        No changes for this release. Just releasing with the other rspec gems.

        + +

        2.8.0.rc1 / 2011-11-06

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Use classes for the built-in matchers (they're faster).
        • +
        • Eliminate Ruby warnings (Matijs van Zuijlen)
        • +
        + +

        2.7.0 / 2011-10-16

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • HaveMatcher converts argument using to_i (Alex Bepple & Pat Maddox)
        • +
        • Improved failure message for the have_xxx matcher (Myron Marston)
        • +
        • HaveMatcher supports count (Matthew Bellantoni)
        • +
        • Change matcher dups Enumerable before the action, supporting custom +Enumerable types like CollectionProxy in Rails (David Chelimsky)
        • +
        + +

        Bug fixes

        + +
          +
        • Fix typo in have(n).xyz documentation (Jean Boussier)
        • +
        • fix safe_sort for ruby 1.9.2 (Kernel now defines <=> for Object) (Peter +van Hardenberg)
        • +
        + +

        2.6.0 / 2011-05-12

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • change matcher accepts regexps (Robert Davis)
        • +
        • better descriptions for have_xxx matchers (Magnus Bergmark)
        • +
        • range.should cover(*values) (Anders Furseth)
        • +
        + +

        Bug fixes

        + +
          +
        • Removed non-ascii characters that were choking rcov (Geoffrey Byers)
        • +
        • change matcher dups arrays and hashes so their before/after states can be +compared correctly.
        • +
        • Fix the order of inclusion of RSpec::Matchers in Test::Unit::TestCase and +MiniTest::Unit::TestCase to prevent a SystemStackError (Myron Marston)
        • +
        + +

        2.5.0 / 2011-02-05

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • should exist works with exist? or exists? (Myron Marston)
        • +
        • expect { ... }.not_to do_something (in addition to to_not)
        • +
        + +

        Documentation

        + +
          +
        • improved docs for raise_error matcher (James Almond)
        • +
        + +

        2.4.0 / 2011-01-02

        + +

        full changelog

        + +

        No functional changes in this release, which was made to align with the +rspec-core-2.4.0 release.

        + +

        Enhancements

        + +
          +
        • improved RDoc for change matcher (Jo Liss)
        • +
        + +

        2.3.0 / 2010-12-12

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • diff strings when include matcher fails (Mike Sassak)
        • +
        + +

        2.2.0 / 2010-11-28

        + +

        full changelog

        + +

        2.1.0 / 2010-11-07

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • be_within(delta).of(expected) matcher (Myron Marston)
        • +
        • Lots of new Cucumber features (Myron Marston)
        • +
        • Raise error if you try should != expected on Ruby-1.9 (Myron Marston)
        • +
        • Improved failure messages from throw_symbol (Myron Marston)
        • +
        + +

        Bug fixes

        + +
          +
        • Eliminate hard dependency on RSpec::Core (Myron Marston)
        • +
        • have_matcher - use pluralize only when ActiveSupport inflections are indeed +defined (Josep M Bach)
        • +
        • throw_symbol matcher no longer swallows exceptions (Myron Marston)
        • +
        • fix matcher chaining to avoid name collisions (Myron Marston)
        • +
        + +

        2.0.0 / 2010-10-10

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • Add match_for_should_not method to matcher DSL (Myron Marston)
        • +
        + +

        Bug fixes

        + +
          +
        • respond_to matcher works correctly with should_not with multiple methods +(Myron Marston)
        • +
        • include matcher works correctly with should_not with multiple values +(Myron Marston)
        • +
        + +

        2.0.0.rc / 2010-10-05

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • require 'rspec/expectations' in a T::U or MiniUnit suite (Josep M. Bach)
        • +
        + +

        Bug fixes

        + +
          +
        • change by 0 passes/fails correctly (Len Smith)
        • +
        • Add description to satisfy matcher
        • +
        + +

        2.0.0.beta.22 / 2010-09-12

        + +

        full changelog

        + +

        Enhancements

        + +
          +
        • diffing improvements + +
            +
          • diff multiline strings
          • +
          • don't diff single line strings
          • +
          • don't diff numbers (silly)
          • +
          • diff regexp + multiline string
          • +
        • +
        + +

        Bug fixes + * should[_not] change now handles boolean values correctly

        +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/file.License.html b/source/documentation/2.14/rspec-expectations/file.License.html new file mode 100644 index 000000000..0b6e2e855 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/file.License.html @@ -0,0 +1,73 @@ + + + + + + File: License + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +
        (The MIT License)

        Copyright (c) 2006 David Chelimsky, The RSpec Development Team
        Copyright (c) 2005 Steven Baker

        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/file.README.html b/source/documentation/2.14/rspec-expectations/file.README.html new file mode 100644 index 000000000..4cf8965a2 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/file.README.html @@ -0,0 +1,248 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        RSpec Expectations Build Status Code Climate

        + +

        RSpec::Expectations lets you express expected outcomes on an object in an +example.

        + +
        expect(.balance).to eq(Money.new(37.42, :USD))
        +
        + +

        Install

        + +

        If you want to use rspec-expectations with rspec, just install the rspec gem +and RubyGems will also install rspec-expectations for you (along with +rspec-core and rspec-mocks):

        + +
        gem install rspec
        +
        + +

        If you want to use rspec-expectations with another tool, like Test::Unit, +Minitest, or Cucumber, you can install it directly:

        + +
        gem install rspec-expectations
        +
        + +

        Basic usage

        + +

        Here's an example using rspec-core:

        + +
        describe Order do
        +  it "sums the prices of the items in its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        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 +expresses an expected outcome. If order.total == Money.new(5.55, :USD), then +the example passes. If not, it fails with a message like:

        + +
        expected: #<Money @value=5.55 @currency=:USD>
        +     got: #<Money @value=1.11 @currency=:USD>
        +
        + +

        Built-in matchers

        + +

        Equivalence

        + +
        expect(actual).to eq(expected)  # passes if actual == expected
        +expect(actual).to eql(expected) # passes if actual.eql?(expected)
        +
        + +

        Note: The new expect syntax no longer supports == matcher.

        + +

        Identity

        + +
        expect(actual).to be(expected)    # passes if actual.equal?(expected)
        +expect(actual).to equal(expected) # passes if actual.equal?(expected)
        +
        + +

        Comparisons

        + +
        expect(actual).to be >  expected
        +expect(actual).to be >= expected
        +expect(actual).to be <= expected
        +expect(actual).to be <  expected
        +expect(actual).to be_within(delta).of(expected)
        +
        + +

        Regular expressions

        + +
        expect(actual).to match(/expression/)
        +
        + +

        Note: The new expect syntax no longer supports =~ matcher.

        + +

        Types/classes

        + +
        expect(actual).to be_an_instance_of(expected)
        +expect(actual).to be_a_kind_of(expected)
        +
        + +

        Truthiness

        + +
        expect(actual).to be_true  # passes if actual is truthy (not nil or false)
        +expect(actual).to be_false # passes if actual is falsy (nil or false)
        +expect(actual).to be_nil   # passes if actual is nil
        +
        + +

        Expecting errors

        + +
        expect { ... }.to raise_error
        +expect { ... }.to raise_error(ErrorClass)
        +expect { ... }.to raise_error("message")
        +expect { ... }.to raise_error(ErrorClass, "message")
        +
        + +

        Expecting throws

        + +
        expect { ... }.to throw_symbol
        +expect { ... }.to throw_symbol(:symbol)
        +expect { ... }.to throw_symbol(:symbol, 'value')
        +
        + +

        Yielding

        + +
        expect { |b| 5.tap(&b) }.to yield_control # passes regardless of yielded args
        +
        +expect { |b| yield_if_true(true, &b) }.to yield_with_no_args # passes only if no args are yielded
        +
        +expect { |b| 5.tap(&b) }.to yield_with_args(5)
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum)
        +expect { |b| "a string".tap(&b) }.to yield_with_args(/str/)
        +
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +
        + +

        Predicate matchers

        + +
        expect(actual).to be_xxx         # passes if actual.xxx?
        +expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
        +
        + +

        Ranges (Ruby >= 1.9 only)

        + +
        expect(1..10).to cover(3)
        +
        + +

        Collection membership

        + +
        expect(actual).to include(expected)
        +expect(actual).to start_with(expected)
        +expect(actual).to end_with(expected)
        +
        + +

        Examples

        + +
        expect([1,2,3]).to include(1)
        +expect([1,2,3]).to include(1, 2)
        +expect([1,2,3]).to start_with(1)
        +expect([1,2,3]).to start_with(1,2)
        +expect([1,2,3]).to end_with(3)
        +expect([1,2,3]).to end_with(2,3)
        +expect({:a => 'b'}).to include(:a => 'b')
        +expect("this string").to include("is str")
        +expect("this string").to start_with("this")
        +expect("this string").to end_with("ring")
        +
        + +

        should syntax

        + +

        In addition to the expect syntax, rspec-expectations continues to support the +should syntax:

        + +
        actual.should eq expected
        +actual.should be > 3
        +[1, 2, 3].should_not include 4
        +
        + +

        See detailed information on the should syntax and its usage.

        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/file_list.html b/source/documentation/2.14/rspec-expectations/file_list.html new file mode 100644 index 000000000..ac9df6c7e --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/file_list.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + File List + + + + +
        +

        File List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-expectations/frames.html b/source/documentation/2.14/rspec-expectations/frames.html new file mode 100644 index 000000000..43d89f7b9 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/frames.html @@ -0,0 +1,26 @@ + + + + + + Documentation by YARD 0.8.7.4 + + + + diff --git a/source/documentation/2.14/rspec-expectations/index.html b/source/documentation/2.14/rspec-expectations/index.html new file mode 100644 index 000000000..4cf8965a2 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/index.html @@ -0,0 +1,248 @@ + + + + + + File: README + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        RSpec Expectations Build Status Code Climate

        + +

        RSpec::Expectations lets you express expected outcomes on an object in an +example.

        + +
        expect(.balance).to eq(Money.new(37.42, :USD))
        +
        + +

        Install

        + +

        If you want to use rspec-expectations with rspec, just install the rspec gem +and RubyGems will also install rspec-expectations for you (along with +rspec-core and rspec-mocks):

        + +
        gem install rspec
        +
        + +

        If you want to use rspec-expectations with another tool, like Test::Unit, +Minitest, or Cucumber, you can install it directly:

        + +
        gem install rspec-expectations
        +
        + +

        Basic usage

        + +

        Here's an example using rspec-core:

        + +
        describe Order do
        +  it "sums the prices of the items in its line items" do
        +    order = Order.new
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(1.11, :USD)
        +    )))
        +    order.add_entry(LineItem.new(:item => Item.new(
        +      :price => Money.new(2.22, :USD),
        +      :quantity => 2
        +    )))
        +    expect(order.total).to eq(Money.new(5.55, :USD))
        +  end
        +end
        +
        + +

        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 +expresses an expected outcome. If order.total == Money.new(5.55, :USD), then +the example passes. If not, it fails with a message like:

        + +
        expected: #<Money @value=5.55 @currency=:USD>
        +     got: #<Money @value=1.11 @currency=:USD>
        +
        + +

        Built-in matchers

        + +

        Equivalence

        + +
        expect(actual).to eq(expected)  # passes if actual == expected
        +expect(actual).to eql(expected) # passes if actual.eql?(expected)
        +
        + +

        Note: The new expect syntax no longer supports == matcher.

        + +

        Identity

        + +
        expect(actual).to be(expected)    # passes if actual.equal?(expected)
        +expect(actual).to equal(expected) # passes if actual.equal?(expected)
        +
        + +

        Comparisons

        + +
        expect(actual).to be >  expected
        +expect(actual).to be >= expected
        +expect(actual).to be <= expected
        +expect(actual).to be <  expected
        +expect(actual).to be_within(delta).of(expected)
        +
        + +

        Regular expressions

        + +
        expect(actual).to match(/expression/)
        +
        + +

        Note: The new expect syntax no longer supports =~ matcher.

        + +

        Types/classes

        + +
        expect(actual).to be_an_instance_of(expected)
        +expect(actual).to be_a_kind_of(expected)
        +
        + +

        Truthiness

        + +
        expect(actual).to be_true  # passes if actual is truthy (not nil or false)
        +expect(actual).to be_false # passes if actual is falsy (nil or false)
        +expect(actual).to be_nil   # passes if actual is nil
        +
        + +

        Expecting errors

        + +
        expect { ... }.to raise_error
        +expect { ... }.to raise_error(ErrorClass)
        +expect { ... }.to raise_error("message")
        +expect { ... }.to raise_error(ErrorClass, "message")
        +
        + +

        Expecting throws

        + +
        expect { ... }.to throw_symbol
        +expect { ... }.to throw_symbol(:symbol)
        +expect { ... }.to throw_symbol(:symbol, 'value')
        +
        + +

        Yielding

        + +
        expect { |b| 5.tap(&b) }.to yield_control # passes regardless of yielded args
        +
        +expect { |b| yield_if_true(true, &b) }.to yield_with_no_args # passes only if no args are yielded
        +
        +expect { |b| 5.tap(&b) }.to yield_with_args(5)
        +expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum)
        +expect { |b| "a string".tap(&b) }.to yield_with_args(/str/)
        +
        +expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
        +expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
        +
        + +

        Predicate matchers

        + +
        expect(actual).to be_xxx         # passes if actual.xxx?
        +expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
        +
        + +

        Ranges (Ruby >= 1.9 only)

        + +
        expect(1..10).to cover(3)
        +
        + +

        Collection membership

        + +
        expect(actual).to include(expected)
        +expect(actual).to start_with(expected)
        +expect(actual).to end_with(expected)
        +
        + +

        Examples

        + +
        expect([1,2,3]).to include(1)
        +expect([1,2,3]).to include(1, 2)
        +expect([1,2,3]).to start_with(1)
        +expect([1,2,3]).to start_with(1,2)
        +expect([1,2,3]).to end_with(3)
        +expect([1,2,3]).to end_with(2,3)
        +expect({:a => 'b'}).to include(:a => 'b')
        +expect("this string").to include("is str")
        +expect("this string").to start_with("this")
        +expect("this string").to end_with("ring")
        +
        + +

        should syntax

        + +

        In addition to the expect syntax, rspec-expectations continues to support the +should syntax:

        + +
        actual.should eq expected
        +actual.should be > 3
        +[1, 2, 3].should_not include 4
        +
        + +

        See detailed information on the should syntax and its usage.

        + +

        Also see

        + + +
        + + + + + \ No newline at end of file diff --git a/source/documentation/2.14/rspec-expectations/method_list.html b/source/documentation/2.14/rspec-expectations/method_list.html new file mode 100644 index 000000000..821a4ca84 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/method_list.html @@ -0,0 +1,1745 @@ + + + + + + + + + + + + + + + + + Method List + + + + +
        +

        Method List

        + + + + +
        + + diff --git a/source/documentation/2.14/rspec-expectations/top-level-namespace.html b/source/documentation/2.14/rspec-expectations/top-level-namespace.html new file mode 100644 index 000000000..772940fb6 --- /dev/null +++ b/source/documentation/2.14/rspec-expectations/top-level-namespace.html @@ -0,0 +1,138 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.8.7.4 + + + + + + + + + + + + + + + + + + + + + +

        Top Level Namespace + + + +

        + +
        + + + +
        Extended by:
        +
        RSpec::Expectations::DeprecatedConstants, RSpec::Matchers::DSL
        + + + + + + + +
        +
        + +

        Defined Under Namespace

        +

        + + + Modules: RSpec + + + + +

        + + + + + + + + + + + + + + +

        Method Summary

        + +

        Methods included from RSpec::Expectations::DeprecatedConstants

        +

        const_missing

        + + + + + + + + + +

        Methods included from RSpec::Matchers::DSL

        +

        define

        + + +
        + + + + + \ No newline at end of file