search for: dchelim

Displaying 20 results from an estimated 25 matches for "dchelim".

2009 Mar 15
7
How to use different mocking frameworks?
Hi, I''m pretty new to Rspec, so hope someone can help me out with this. I''m leveraging a couple pre-existing applications in my current project, both have fairly robust test suites in Rspec already. However, one is using Rspec''s builit in mocking, and the other is using mocha. If I set config.mock_with mocha in spec_helper.rb, then all of the rspec mocks fail. If I
2011 Aug 05
5
named context or calling include_context with block?
Hello, I''m playing around with Rspec again after going from test/unit to rspec then back to test/unit... :) Right off the bat, I find myself wanting to do something like this: https://gist.github.com/1128091 Basically, I want to name a context, then call it later by name, passing a block to it. Or in other words... what is the best way to DRY this code?
2011 Apr 16
11
added new cool matcher into my framework WatirSplash - #in
Hello! I''ve just added a new cool matcher #in into my framework WatirSplash and thought that this could be integrated into RSpec directly actually if there''s any interest. WatirSplash uses Watir (or Watir-like) frameworks for testing web pages via browser. If you''re not familiar with it then here is a short example how you had to test ajax-heavy application before:
2009 Nov 10
10
Un-recognised routes that do exist, using namespaces & subdomain checking
I''m getting really cheesed off with RSpec not matching some of my routes when controller testing when I have subdomain checking (courtesy of subdomain-fu) on namespaces. These routes appear in the rake routes output, and work fine via HTTP requests . The really annoying thing is it''s working fine for routes that aren''t at the root of the namespace. E.g. say I have
2008 Oct 24
4
Correct way to spec partials
Hi everybody, 1) Does anybody have full working example of how to test partial templates? 2) What the correct place to test partials: controller or view spec? If controller correct place, should I use integrate_views? 3) Is it true that expect_render is deprecated and I have to use should_receive(:render) 4) How to test that partial''s locals hash is correct? Thx -------------- next
2010 May 27
3
as_null_object
Given that RSpec has the following methods to create test doubles ... double(:my_test_double) mock(:my_mock_object) stub(:my_stub) Is there a way to/ plans to introduce a similar syntax for null objects? null_object(:my_null_object) Instead of mock(:bar, :is_null_object => true) or mock(:foo).as_null_object I think this would be cleaner, what do you think?
2011 Sep 22
3
uninitialized constant Spec::Rails (NameError) when running spec command
I get the following error when trying to run a spec command on a model test. The command is :- C:\Rspec Test\spec\models>spec bank_account_spec.rb The error is :- c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-rails-1.3.0/lib/spec/rails/ matchers/ ar_be_valid.rb:2: uninitialized constant Spec::Rails (NameError) from c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec- rails-1.3.0/lib/spec/ra
2009 Jul 06
3
Rspec book issue (mastermind example)
Hey Everyone, Just a simple question. I have read and re-read the examples and I''m not getting the proper output. I''m on page 73/74 of the Rspec book and it says I should have "4 steps passed". I think the problem is within my /step_definition/mastermind.rb" file. It''s definitely not beyond me to make a mistake, but I have checked and double checked my
2009 Sep 20
11
describe block proc parameter as alternative to before blocks?
I''ve been reading through the Rspec book to see if I missed any tricks, and the discussion of before block use for context setup in sec 12.6 struck me as interesting and something I had a knee-jerk reaction to. I think that when you are using nested examples to describe a context change it is bad practice to allow any example within that group to run outside of that context. This could
2009 Feb 20
6
How to mock an object defined in the before_filter function?
Hello, I am trying to implement the following scenario, but I am stuck ... The thing is I want to initialize a variable @comment when the stub function "find_comment" is called. The way I do it below doesn''t work, since "before_filter :find_comment" returns true/false and @comment initialization is done inside it. Could you please give me a hint how to do it? One
2010 Mar 14
2
autotest & rspec2
Hi guys, I''m trying to find some information on how to get autotest to run the rspec2 tests. I have my project setup so "rake spec" runs the specs properly, but autotest seems to ignore/don''t know that there are specs to test. I read on the rspec2 wiki that autotest integration is o be added eventually. Any ideas on how to achieve this? Thanks, Jeroen
2009 Mar 11
3
[rspec, rails] Restful Routes in controller specs
Hi, how is it possible that I can use the restful routes helpers (e.g. new_user_path) in controller specs? I browsed the source code but I couldn''t find the magic. I''m just curious and would appreciate any hint... thanks Andi
2012 Feb 23
2
testing around_save
I''ve just upgraded to Rails 3.2.1 and I can''t get my specs checking whether or not around_save work anymore. I simply did something like: object.should_receive :around_filter_name object.save.should be_true (Actually, it was slightly more complex, it''s part of a state machine)
2010 Aug 08
2
issue with rescue_action_in_public! and testing 404 responses
Hello, I''m new to rails and I''m trying to wrap my heads around how to spec controllers using RSpec (using rails 3rc1 and rspec 2.0.0.beta.19). The problem I''ve run into is when I want to test that my controllers respond with a 404 for unfound records. Whenever I run the spec, the ActiveRecord::RecordNotFound exception is not caught by rails, causing the spec
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
2009 Mar 08
2
rspec 1.1.99.12, Rails 2.3.1, undefined method `rspec_options=''
Hi David, all: I recently upgraded to Rails 2.3.1RC2 (Ubuntu 8.10, ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]) and have been dilligently following the instructions for upgrading rspec and rspec-rails according to: http://wiki.github.com/dchelimsky/rspec/rails-with-rspec-gems. and when I run ''rake gem'' fails with error: rake aborted! undefined method `rspec_options='' for #<Hoe:0xb782caf0> /rspec/Rakefile:24 rspec / Rakefile look like # -*- ruby -*- $:.unshift(File.join(File.dirname(__FILE__), ''...
2008 Jun 14
15
Reusing story snippets
I find myself doing this: Scenario "logged in user visiting the home page" do Given "A logged in user" do a_logged_in_user end When "..." Then "..." end The a_logged_in_user method is a helper method in helper.rb which sets up the state so that the user can browse the website. Later in the story of course, I can just do ''Given
2009 Jun 13
2
removing Mocha; 'spec spec' fails but the specific model file passes
I happened to mix ryan bates'' authentication scaffold with rspec_scaffold on a demo project. and ran into the problem of mixing mock frameworks...ryan uses mocha. So, as a learning experience, I choose to redo ryan''s tests without mocha but ran into a strange problem with tests of the User model. With debugging you can see.... If you run just the user_spec.rb file, everything
2009 Mar 23
5
Rspec weird behaviour
Hi, I recently migrated from classic rails testing to Rspec, so I am pretty new to the framework and still learning. I am getting weird errors on an ActiveRecord model test, here is the basic class model definition: class Size < ActiveRecord::Base has_many :quantities, :dependent => :destroy validates_presence_of :name validates_uniqueness_of :name, :case_sensitive => false end
2010 Nov 12
2
pending tests fail when I switch to mock_with :mocha
First of all, please direct me into how better to search existing threads in this mailing list. Ok to my rspec 2.0.1 mocha 0.9.8 issue: given a controller test before do subject.expects(:authenticate).once end it "should bla bla" do pending "PENDING, shouldn''t fail?" end with config.mock_with :rspec it''s ok: pending, but with