similar to: spec task prints usage

Displaying 20 results from an estimated 20000 matches similar to: "spec task prints usage"

2007 Feb 07
3
odd mock behavior
I''m seeing some odd behavior around the should_receive() when given a block combined with some cardinality. For example, with the following... my_mock.should_receive(:foo).twice do |i| puts i end ... the spec passes but i never gets puts''ed. With the following... my_mock.should_receive(:foo) do |i| puts i end ... i gets puts''ed twice but the spec fails because
2006 Nov 28
8
view specs with partials
When I first learned about the View specs I was very excited. I still am. However, I haven''t found them useful yet for one reason. They throw the following exception when ever a view renders another view, which is very common. ActionView::TemplateError in ''Event View message'' No rhtml, rxml, rjs or delegate template found for spec/rails/ view_spec/_info
2007 Apr 07
5
Integration Specs On Rails
Now that RSpec is nearing 1 dot oh, are there any plans to implement an integration testing equivalent in RSpec On Rails?
2007 Jul 31
11
helper spec not finding rails core helpers
Hi, My helper specs were going ok until I added a call to a rails DateHelper method in one of my helpers http://api.rubyonrails.com/classes/ActionView/Helpers/ DateHelper.html#M000574 The helper runs fine from my view templates, just dies in the spec test. I boiled my question down to a simple (not too useful) example. I''m not sure what I''m missing. #
2007 Oct 23
9
Running rails specs outside of the normal project tree
I want to create a spec/regressions directory with various regressions (for my rails project). I tried the following: describe LoginController, "regression for user creation when steves_sister does not exist", :behavior_type => :controller do controller_name :login before :each do @params = { "commit"=>"Create Account",
2006 Dec 21
3
Stubbing an instance method on a class
Hi all, I''m not sure if I''ve missed it, but I couldn''t find any docs for stubbing an instance method on a class. For example: class Foo; end Foo.stub!(:my_instance_method).and_return(nil) The reason (I think) I need this is because a certain class (Test::Unit::TestCase) expects an argument (name of method) to new and throws an exception if that instance method
2007 Feb 23
2
Deferred success for specs?
I''ve started using specs as a to-do list. I write explicitly violated specs so I know what to come back to. But a lot of the time, that means if I start to work on another piece of functionality covered by the same spec, it''s hard to tell what I''m working on now from the explicit failues. I run all my specs through TextMate to use the HTML output, so I go by
2007 Nov 17
7
Down with Lambda!!
Rspec is all about using natural language to define behavior. In this context, I feel that lambda is sorely out of place. I was chatting on #irc and a pal of mine (wycats) proposed an interesting alternative: alias_method :doing, :lambda so instead of something like lambda {post :create, {:title => nil}}.should raise_error(ActiveRecord::RecordInvalid) we get doing {post :create, {:title
2006 Sep 13
2
stale spec runner?
I''ve been working with the RSpec on Rails plugin. Great job guys! The Rails spec runner (server) definitely speeds things up nicely. But I''m having some trouble keeping it functional. When I start the server, the first spec execution runs fine. Every following execution fails though. Each spec complains about the ''controller_path'' missing from my
2007 Sep 20
4
alias :calling :lambda
Sprinkling my examples with ''lambda'' has always seemed like a bit of a wart to me. I''ve gotten into the habit of adding ''alias :calling :lambda'' to my spec suites. My examples then look like: calling { Foo }.should raise_error calling { Bar }.should_not raise_error Is there a reason that RSpec core has chosen not to make exception expectations more
2007 Oct 30
1
Facets and/or Nested Describes
I have to confess that I did not know about facets before reading Ashley Moran''s post: http://aviewfromafar.net/2007/10/21/quick-and-dirty-facets-in-rspec-trunk Not knowing about the facets solution, I made a couple of feature requests for nested describes: http://rubyforge.org/tracker/index.php?func=detail&aid=14980&group_id=797&atid=3152
2007 Mar 27
3
Stubbing out method for all instances
I am using the acts_as_state_machine plugin to control state of an object in my app, however when testing this I need to be able to stub out the guard conditions so that state will change when I fire off an event without depending on other models. Guard conditions simply return true or false so I have an instance method: def encoded? <check state of other objects> return true
2006 Oct 24
2
1 should be 2. huh?
There''s another quirk I wanted to bring up. It''s about the failure message with should_equal and should_be. x.should_equal 2 a.should_not_be nil When they fail they yield messages like: 1 should equal 2 nil should not be nil When I''m caught off guard, which can be often, these messages confuse me. 1 should equal 2? No it shouldn''t. nil should not be
2006 Oct 31
5
How to run edge RSpec (on Rails)?
I''m interested in tracking edge development of the RSpec on Rails plugin and I''m a bit confused. The installation guide (http://rspec.rubyforge.org/documentation/rails/install.html) says, "You''ll have to install the RSpec core gem first." It also says, "Take note of what rspec version you''re installing ? it''s very important that you
2007 Feb 21
3
Using rspec_on_rails without a test database
Is there some way to remove the database hit when running rake rspec:models ? I''d like to mock all of my objects (or at least remove all reliance on fixtures and the database itself) - both for speed and because static fixtures are brittle. Best Regards, Scott Taylor
2006 Oct 04
1
String.should_hav_tag
I''ve just upgraded to rspec 0.6.4 and several specs were broken. All for the same reason. String.should_have_tag doesn''t seem to be supported any longer. It used to be possible to write assertions like: response.body.should_have_tag :tag => "form" or "<html><body/></html>".should_have_tag :tag => "body" But these fail
2007 Jan 16
2
Links in view specs
Hi I have this simple view (used by the Gap controller): <h1>Gap#index</h1> <%= link_to "Get a GAP quote", :action => "get_quote" %> And this spec: context "A rendered gap/index" do setup do render ''gap/index'' end specify "should have a link to the get_quote page" do
2006 Oct 25
2
mock parameter problem
Here''s another one. spec: m = mock("blah") m.should_receive(:foo).with(1) code: m.foo(2) Failure message: Mock ''blah'' expected ''foo'' once, but received it 0 times ------ Twice now I''ve gotten this failure message and wasted time trying to understand why the method foo() was not being called despite all evidence suggesting
2006 Nov 03
10
[PLUGIN] rspec_resource_generator - RESTful scaffold generator with RSpec specifications
rspec_resource_generator ======================== By Pat Maddox Use this generator to generate RESTful scaffolding with RSpec specifications. Syntax is exactly the same as the scaffold_resource generator: ./script/generate rspec_resource ModelName [field:type field:type] When you run this generator, it will create a migration, model, and model spec file. In addition, it gives you a RESTful
2006 Oct 27
2
and_return broken when using arrays
m = mock("blah") m.should_receive(:foo).and_return([1, 2, 3]) When foo() is called on the mock it returns the first elements of the array, 1. Shouldn''t it return the whole array? Micah Martin 8th Light, Inc. www.8thlight.com -------------- next part -------------- An HTML attachment was scrubbed... URL: