Displaying 20 results from an estimated 30000 matches similar to: "include keyword in describe block"
2007 Mar 19
4
spec.opts: questions about formatters, etc.
Questions concerning spec.opts:
1. Am I correct in believing that each option should go on a
separate line of spec.opts in the rails spec directory? If this is
so, why is it so?
2. Using a formatter in spec.opts doesn''t seem to work. Here is my
spec.opts file:
--colour
-f s
and this is what happens when I run the rake task:
Couldn''t find formatter class s
Make
2007 Aug 08
5
and_yield + instance_eval(&block)
I have the following code, which yields instance eval''s the block given:
class Foo
def bar(&blk)
instance_eval &blk
end
def baz
yield
end
end
The effect of this is that self is reassigned:
Foo.new.bar do
# here, self is the instance of Foo
# created by new
end
But normally self is the object in which
Foo.new.bar {...} occurs.
Foo.new.baz do
2007 Apr 17
8
Verifying that a block calls a method
I have something like the following:
def my_fun
my_fun2 do
raise Error
end
end
I know that I can verify that the method receives my_fun2. How can I
mock/stub out the example to verify that it calls raise Error?
Scott
2007 Apr 10
5
using YAML for --failures and --examples
As it is currently, in trunk, --failures and --examples except a text
file, each line containing the name of a spec.
I''m wondering: Would a a patch to use YAML (instead or as well as)
plain text be welcomed? I''m thinking of a yaml file like the following:
spec_file_1:
file: spec/person_spec.rb
specs:
- should have first name
- should provide email address
2007 Jun 11
3
hpricot as dependency for building rspec?
It looks to me that hpricot is a dependency to building rspec:
euclid% rake pre_commit
(in /Users/smtlaissezfaire/ruby/projects/rspec/hpricot)
rake aborted!
Could not find RubyGem hpricot (>= 0.0.0)
/Users/smtlaissezfaire/ruby/projects/rspec/hpricot/rakefile:9
(See full trace by running task with --trace)
Let me know if I''m wrong. Otherwise, I''ll submit a patch in the docs.
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",
2007 Aug 06
3
pending w/ no string
Is there some reason that pending() *MUST* take an argument?
Scott
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 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
2007 Apr 20
5
stubbing with and without a string
What is the difference between these two ways of mocking (with and
without the string):
mock(''Object'')
and
mock(Object)
?
Scott
2007 Mar 19
3
controller_name with dynamic controllers
I''m writing a controller which should only be inherited from,
something like the generic crud controller seen here: http://
geekonomics.blogspot.com/2006/07/crud-and-shared-controllers.html
Now, in my spec, I would like to create a controller which inherits
from the generic CRUDController, without actually creating the
controller. This controller is *only* for testing.
How can I
2007 Feb 27
8
Using a subversion repository to spec in a rails app
Is it a bad practice to use a subversion repository to the trunk of
rspec and rspec_on_rails? Or rather, is it doomed to fail, since my
gem will always be out of date?
I know I can''t use spec, installed from gem,s if I have the latest
revision of rspec and rspec_on_rails checked into my plugins
directory. But I should still be able to use it with the --drb
option, correct?
2007 Mar 28
3
respond.should be_successful
I''m wondering: Does it make more sense to add on successful? as an
alias for success? in ActionController:TestRequest?
I keep getting these two mixed up in my specs and was wondering if it
would be helpful to anyone as a small patch to rspec.
Best,
Scott
2007 Aug 06
5
using RSpec''s trunk in non-rails projects w/ Autotest
I believe for rails projects you can put rspec''s code repos into
vendor/plugins, and autotest will automatically use the rspec binary
in that directory, and not the gem installed.
Is there an easy way to do this for non-rails projects? There are a
few advancements on trunk which I would like to take advantage of.
Tips welcome ; ).
Scott Taylor
2007 Apr 09
10
changes in 0.8 and greater - should_
Has the should_... syntax changed? I''m getting errors when running
the following:
should_render(:index)
should_be_valid
should_not_be_valid
should_respond_to
should_be
should_render
I thought the syntax changed to something like the following:
obj.should render(:index)
but this doesn''t seem to work.
Scott
2007 Apr 01
4
rake w/rspec
How can I spec out a rake task?
How can I use rake in my spec''s? I want to fix this rake
spec:autotest bug with --drb and --color. How can I get rake output?
How would I get out of autotest? My initial thought is just to run
the command in the spec.
Scott
2007 May 12
3
[OT] - In Memory Databases
My specs are still taking to long to run in a rails app. Is anyone
using an in-memory database to run their specs? Any pointers or tips?
Scott
2007 Oct 08
17
(no subject)
Just ran svn up this morning, and got this (after running ./script/
generate rspec)
escher: ./script/spec spec/models/item_spec.rb
Finished in 8.0e-06 seconds
0 examples, 0 failures
./script/spec:4:in `run'': wrong number of arguments (3 for 1)
(ArgumentError)
from ./script/spec:4
Using rails 1.2.3, rspec trunk, on Mac OS X.4.9.
Any ideas, or is this a bug in
2007 Apr 01
11
--color doesn''t work with --drb w/rspec_autotest
If I got this to work, do you think we could/should check in
rspec_autotest into rspec?
I''ve updated rspec_autotest abit, so let me know if you''d like the
modified code.
Scott