similar to: Re-using Rspec Matchers

Displaying 20 results from an estimated 110 matches similar to: "Re-using Rspec Matchers"

2006 Dec 02
0
Fwd: Re: Mocha and ActiveRecord
---------- Forwarded message ---------- From: J. B. Rainsberger <jbrains762 at gmail.com> Date: 02-Dec-2006 02:48 Subject: Re: Mocha and ActiveRecord To: ruby-talk ML <ruby-talk at ruby-lang.org> James Mead wrote: > On 28/11/06, J. B. Rainsberger <jbrains762 at gmail.com> wrote: >> >> Suppose I have an Order, which has_many OrderItems. Suppose I want to >>
2009 Oct 14
14
spec-ing private methods?
On Wed, Oct 14, 2009 at 5:49 PM, Scott Taylor <scott at railsnewbie.com> wrote: > > On Oct 14, 2009, at 3:36 PM, Joaquin Rivera Padron wrote: > > hello there, > how do you tipically spec private methods? The thing is ? have something > like this: > > def some_method > ?? complex_method + other_complex_methods > end > > private > def complex_method...
2009 Mar 05
8
Can I construct the controller myself in a controller spec?
Hi I am experimenting with Constructor based dependency injection for rails controllers. So I have something like this class LoginSessionsController < ApplicationController def initialize(authenticator = TheRealAuthenticator) @authenticator = authenticator end .... end The plan was to override the authenticator used when testing with something like describe
2008 Oct 10
16
rspec - undefined method `describe'' for main:Object
When i run a spec file i am getting the following error D:\Diwakar\spec_diwa\spec\controllers>spec sandbox_controller_spec.rb c:/ruby/lib/ruby/gems/1.8/gems/rspec-0.5.15/lib/spec/api/sugar.rb:17:in `method_ missing'': undefined method `describe'' for main:Object (NoMethodError) from ./sandbox_controller_spec.rb:7 from
2007 May 03
0
predicate matchers
Hey all, If any of you are using the new predicate_matchers feature, I just committed a change to it in trunk. See http://rubyforge.org/tracker/index.php?func=detail&aid=10542&group_id=797&atid=3152 for more details, but the high level is that instead of this: predicate_matchers[:method_on_object] = :method_in_spec It now (as of rev 1898 - soon to be released in 0.9.2) does this:
2008 Mar 04
2
Matchers tutorial ...
I am looking for a good a - z matchers tutorial . Anyone got a url for one? Thanks Anthony Broad-Crawford -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080303/fd652444/attachment-0001.html
2010 Aug 16
0
RSpec 2 matchers 'code-spec' and 'file-spec' released
Spec your generated Ruby code files code-spec at: http://github.com/kristianmandrup/code-spec Spec your file structure (files, dirs, symlinks) file-spec at: http://github.com/kristianmandrup/file-spec More to come...
2013 Sep 07
0
[shoulda-matchers gem] validate_numericality_of_matcher strange behaviour
Hello I have Vacancy model and vacancy_spec test with validates_numericality_of :salary, greater_than: 1 in the model and validate_numericality_of(:salary).is_greater_than(2) in the _spec. When i run rspec spec command tests pass (in some cases and in other they don''t) Why? vacancy.rb ------------------------ class Vacancy < ActiveRecord::Base validates_presence_of :name,
2011 Jul 28
2
RSpec, shoulda-matchers and Rails model attributes validations
I was trying out RSpec framework in a project and got stopped doing the unit test of a model. In particular, doing the test for the associations and the ActiveRecord validations. I started writing the validations but my tests didn''t look DRY at all. Before refactoring the tests checked out and look for other people solutions. I found out shoulda-matchers and Shoulda (which if I
2007 Aug 02
2
Do the :attributes and :content matchers work
[Rails plugin 1.0.5] Hi, I am looking for some guidance. When working on a partial which looks like this <div class="bug" style="width: 100%;" /> I have some examples which should fail - I think - but do not: it '' should fail'' do response.should have_tag( ''div.bug'', :content => ''There is no
2008 Aug 22
2
How to find/open Spec::Expectations and Spec::Matchers
Hi, Then RSpec 1.4 recommends, in the webpage http://rspec.info/documentation/expectations.html, referencing the subject items. I''m running ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] over WinXP-Pro/SP2. I believe I installed RSpec with a Ruby gem. At least, I think that''s confirmed because I have a lot of stuff in the directory K:\_Utilities
2011 Oct 08
1
Rails view spec expectations/matchers
>From looking at the RSpec Rails documentation (https://www.relishapp.com/rspec/rspec-rails/docs/view-specs/view-spec) it seems like rendered is just a string and you can''t really do any assert_select type stuff out of the box. After Googling around, it seems that the RSpec authors decided that if you want that functionality, you should just use Capybara or some such... is that
2007 Sep 24
7
Parameter Matchers with optional params
Hi, Are there any docs for combining parameter matchers, or some way to define optional parameters? I''m trying to match something like: .find( 42 ) || .find( 42, {:conditions=>nil,:includes=>nil} ) Or for that matter, 42 followed by nothing or anything... Halp? I''ve tried different nested combos with any_of/all_of/anything, but getting lost trying. --Andrew
2008 Jan 28
9
Nested matchers
We''re encountering a failure with Mocha 0.5.6. We had this expectation: game_version.expects(:attributes=).with(:game_file => kind_of(GameFile), :game_id => @game.id) This expectation was passing with 0.5.5, but fails with 0.5.6. I added this test to parameter_matcher_acceptance_test.rb, which passes in 0.5.5 and fails in 0.5.6 def test_should_match_nested_parameters
2007 Feb 18
1
get() method in custom expectation matcher?
I''m trying to write a custom expectation: controller.should_require_login_for(:action_name). I''m using the example in the docs for ''Custom Expectation Matchers'' but I''m unsure how to make the get() method available to my ShouldRequireLogin class. I''ve tried requiring spec_helper but no joy. can anyone help? thanks -- View this message in
2007 Nov 26
0
custom matcher tutorial
I wrote some quick notes up on a custom matcher I wrote around a pattern that I am using constantly. http://smartic.us/2007/11/26/rspec-matcher-for-active-record-associations You could use it as a custom matcher tutorial for the uninitiated or as a possible solution for validations specs for the more advanced. Or you could use it to school me, and explain why my code sucks :) bryanl
2008 Jan 24
1
Constant definition matcher
Hello all, I need to specify that a class should define a constant. I couldn''t find something such as "should define_const(''MY_CONST'')" in the RSpec documentation, even though there are similar matchers such as "should respond_to". I know I can write the matcher myself (that wouldn''t be so difficult) but is there a reason ? Thanks!
2007 Oct 25
0
Fwd: [ mocha-Feature Requests-15021 ] without or not params matcher
---------- Forwarded message ---------- From: noreply at rubyforge.org <noreply at rubyforge.org> Date: 25 Oct 2007 14:01 Subject: [ mocha-Feature Requests-15021 ] without or not params matcher To: noreply at rubyforge.org Feature Requests item #15021, was opened at 2007-10-24 15:33 You can respond by visiting:
2007 Apr 25
0
Redcloth bug - Stack overflow in regexp matcher
Hi, I''ve been using the rassmalog static blogging engine and have encountered a stack overflow inside the redcloth regexp matcher. I don''t seem to suffer this error on my Ubuntu (Feisty Fawn) box (with Ruby 1.8.4??), but I do get it on my Gentoo system. Running the following line will generate it (I''ve attached the YAML/redcloth file to this message). $ ruby -ryaml
2010 Jun 28
1
have_tag matcher in rspec 2?
I always assumed have_tag was part of rspec, but it''s not in rspec 2, and looking now I don''t see it in rspec 1 either. Webrat defines it, but that seems like a coincidence (I tried requiring webrat/core/matchers to no avail). Is it depricated, not yet implemented, or does it work for everyone else? My project is from scratch, rspec-rails 2b13, using generated spec_helper.