similar to: Mocking causes empty specification blocks

Displaying 20 results from an estimated 1000 matches similar to: "Mocking causes empty specification blocks"

2008 Jun 28
19
Stopping example execution?
Hello, I''m wondering If I am missing something here when creating an example that sets an expecation at the top or beginning of an action but requires you to stub / mock everything that follows. Example: I want to test that a certain controller is running a before_filter...thats easy: - controller.should_receive(:require_user) - do_get But now i''ve got to mock / stub
2008 Jun 07
3
Match render :nothing
Hello guys, Is there any way to match a render :nothing? I coudn''t find any way to do this so i''ve just changed my controllers to do a "head :ok", but it would be nice to know if there is any other way :) -- Maur?cio Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) Jo?o Pessoa, PB, +55 83 8867-7208
2007 Dec 06
6
mock libraries, Object#send, and Object#__send__
What is the appropriate way to stub out (and put an expectation on Object#__send__), without getting warnings from the Rspec mock library? Scott
2007 May 08
4
help with rspec''ing controller
Hi, I''m a rspec newbie. I''m having trouble with rspec''ing a simple controller to Create a record. I''ve tried a couple of approaches and still get errors: Mock ''remedy'' expected :save! with (any args) once, but received it 0 times -or- Mock ''Remedy'' received unexpected message :save with (no args). Here are my two
2007 Jun 24
6
mocking errors
What is the correct way to mock out the errors on a Rails model? I''m assuming i need to say @mock_thing = mock_model(Thing) @mock_thing_errors = mock("errors") @mock_thing_errors.should_receive(:full_messages).and_return("An error") @mock_thing.should_receive(:errors).and_return(@mock_thing_errors) Just wanted to check the best practice on this kind of thing and how
2006 Apr 11
1
FeedValidator :: validating feeds RSS or ATOM
FeedValidator is an interface to the W3C Feed Validation online service, based on its SOAP 1.2 support. It helps to find errors in RSS or ATOM feeds. FeedValidator add a new assertion (assert_valid_feed) which you can use in Rails applications. This assertion implements a cache to improve the performance of the tests and to not abuse of the W3C Feed Validation online service. = Download The
2006 Oct 23
6
overriding mock expectations
There is one annoyance I''m encountering with the Mock API in rSpec. Overall it works well, as far as dynamic mocks go ;)... but there''s this one thing... It doesn''t allow overriding of expectations. example: m = mock("blah") m.should_receive(:one).any_number_of_times().and_return(1) m.should_receive(:one).and_return(1) The second call to should_receive
2006 Oct 04
3
do we need stubbing?
Hey all - The trunk currently supports three types of mocking/stubbing: Mock Objects (created dynamically at runtime) Partial Mocking of methods on existing classes Stubbing of methods on existing objects or classes The main difference between Partial Mocking and Stubbing is that Stubs don''t verify. I''m wondering if we really need the stubbing facility at all, given that we
2007 Nov 28
6
Newbie question
I installed Rspec and am getting the following failure: $ sudo gem install rspec Successfully installed rspec-1.0.8 Installing ri documentation for rspec-1.0.8... Installing RDoc documentation for rspec-1.0.8... $ spec -v RSpec-1.0.8 (r2338) - BDD for Ruby http://rspec.rubyforge.org/ $ cat acct.rb describe Account, " when first created" do it "should have a balance of $0"
2008 Jun 04
2
Mock with an attributes that has state
I''m developing a rails application. I have an Order model that has_many OrderItems. I mocked the OrderItem model in my Order specs using mock_model. I thought I should focus my specs on each model and always mock associated models. In my Order model I need a way to merge OrderItems which have the same cost and same product_id. That I can spec. The other thing this merge helper
2005 Sep 14
16
Showing database results in a grid view
Hello everyone, It seems that the answer to my question should be obvious, but I''ve not yet found a way to do what I want. Any advice on the best method would be greatly appreciated. Have the following database table: CREATE TABLE datasets ( id int not null auto increment, name varchar not null, value varchar not null, year varchar not null, state
2006 Jul 24
2
Creating a ''default'' mock
Am I correct in thinking that it''s not currently possible to have a method that creates a ''standard'' mock (i.e. a mock that has defaults useful in all contexts)? I''ve tried with the mock method and also by manually creating new Mock instances. I get failures when setting up expectations (undefined method ''receive'' for proc). Chris
2007 Dec 05
9
Does mock_model''s :null_object option work?
Please understand in the following that I am making relatively minor changes to legacy (non-TDD/BDD) code in Substruct and don''t have the time to refactor nicely right now. I''m just trying to get past the untested/un-speced cruft quickly to write the spec for my new code, so I''m looking for expediency over prettiness. I''m specifying before( :each ) do
2007 Sep 27
3
There is a easy way to valid markup?
Do I have to create a custom Expectation Matcher? or there is a way to integrate assert_valid_asset plugin? thx -- Edgar Gonz?lez Gonz?lez --
2006 Jun 06
2
RSS Generator - Can not subscribe from yahoo
Hi I have created a rss generator for my web site; it is http://www.rordirectory.com/rss The feed displays correctly; but when I try to subscribe from my yahoo account, after entering the feed url, I get the following message :- "There was a problem subscribing to the following feeds. Please try again later" what am I doing wrong? thanks -- Posted via http://www.ruby-forum.com/.
2008 Jul 25
21
Problems with mock assigned to a constant
Hi all, Initially I thought this was a bug in the built-in mocking framework(and it still may be), but I better hash it out on the mailing list before I file/reopen the ticket: http://rspec.lighthouseapp.com/projects/5645/tickets/478-mocks-on-constants#ticket-478-6 I thought my example illustrated my problem, but obviously I was passing the wrong arguments to the mock. I revised my example to
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?
2006 Feb 01
4
REXML::ParseException - but the feed IS valid
I am using Ruby feedparser and when I try to parse this feed: http://feeds.feedburner.com/Mobilecrunch I get an error: REXML::ParseException: Declarations can only occur in the doctype declaration. This feed does validate at feedvalidator.org. Any idea why it would raise an exception? Thanks, eduard -------------- next part -------------- An HTML attachment was scrubbed... URL:
2007 Aug 14
4
Stubbing all methods
Mocha''s mock/stub framework has the ability to stub all methods on a mock given. Does RSpec''s mocking framework have this ability? And if not, is there some reason it shouldn''t be implemeneted? Regards, Scott
2006 Dec 15
3
Partial mock when a complex return value is required
Hi I''ve come up with a problem using RSpec on a model class in my rails app. I wanted to test that some data was being cached for some calculations, so rather than do state-based testing I tried to specify that the method that fetches the data should NOT be called when I call the calculate method. However in doing so I have to simulate the return value, which is about 27