Displaying 20 results from an estimated 30000 matches similar to: "Model Testings with Observers"
2007 Jul 14
3
expect_render twice in views
I found this:
controller.expect_render(:partial => ''thing'', :collection => things).once
but I am trying to expect_render twice in my view spec:
template.expect_render(:partial => ''order_details'').twice
This doesn''t work as the template.expect_render call seems to be
returning an array. Is it possible to expect the rendering of a
partial
2007 Feb 13
16
Error against latest trunk while testing via spec for model
Hi
I just did an update to lates trunk
=================
context "Given a generated venue_spec.rb with fixtures loaded" do
fixtures :venues
specify "fixtures should load two Venues" do
Venue.should have(2).records
end
end
==================
gives me
==========
1)
TypeError in ''Given a generated venue_spec.rb with fixtures loaded
fixtures should load two
2006 Nov 24
2
Bugs Fixed in Trunk
I''m backed off Edge Rails and all the way back to 0.7.2 of rSpec to
make my tests pass. The changes to rSpec are coming together fast and
furious and they seem too good to pass up. Is there an approved way
to upgrade the components in the absence of prebuilt stuff? Every
time I''ve tried, I''ve been punished harshly by the Version Conflict
Gods.
Just asking for
2006 Dec 04
5
should_be_different -- possible implementation
There is an assert_difference helper for Test::Unit (you can read
about it at http://blog.caboo.se/articles/2006/06/13/a-better-
assert_difference and to some it should look familiar -- you know who
you are :), so I took a shot at one for rSpec on Rails.
class Object
def should_be_different(method = nil, difference = nil)
return self.should_not_eql(yield) if method.nil?
2007 Jul 30
4
Stubbing Observers in rails?
In most of my tests I''d like to be able to stub out the observers for my
models, but I''m not sure the best way to do this. I doesn''t look like there
is a way to stub all instance methods, and I don''t seem to be able to stub
early enough to stub out the observer as it''s instantiated. I can think of
several hackish ways to get around it, but I was
2008 Mar 04
10
Pretty story output for non-Rails project
I''m taking my first fledgling steps driving a new ruby (non-rails)
project with BDD. I''ve got a (test) story working. However, when I
run the story in TextMate (via command-r), the output is plain text.
See: http://skitch.com/georgeanderson/8grg/run-examples
How do I get the output to look pretty (formatted)?
rspec-1.1.3
OS X 10.5.2
TextMate v1.5.7 (1455)
Thanks,
/g
--
2007 Nov 11
4
Who''s using --format rdoc
I''m doing some housekeeping and just realised that the rdoc formatter
produces gibberish:
http://rspec.rubyforge.org/rdoc/files/EXAMPLES_rd.html
Will anyone protest if I just go ahead and remove it? (I can''t imagine
anyone using it, especially with the much better HTML formatter)
Aslak
2007 Oct 15
14
Top Quoting?
Sort of off-topic and don''t mean to complain, but many on this list
use top quoting. That works ok if you don''t quote the whole previous
thread. However, I''m finding that scrolling forever to locate the
reply on longer threads is getting tedious. What''s the rationale for
top-quoting?
Thx.
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
2007 Jan 22
1
Observed models cause failures with DRBSpec ?
Hi all !
I don''t believe I am the only one using model observers, right ?
Well, here''s a nice one:
$ drbspec spec
.
Finished in 0.125322 seconds
1 specification, 0 failures
$ drbspec spec
F
1)
''A user with an inactive and an active project should be able to
return active projects only'' FAILED
[] should == [#<Spec::Mocks::Mock:0xb75590bc
2007 Mar 14
5
What''s the new syntax for predicates?
@settings.should allow_publish_ip("127.0.0.1") fails with
undefined method `allow_publish_ip'' for #<#<Class:0x2f8fd48>:0x2f5a968>
@settings.should_allow_publish_ip("127.0.0.1") works fine
This is rspec 0.8.2.
http://rspec.rubyforge.org/documentation/expectations.html says that
matching arbitrary predicates is deprecated and to see
2008 May 03
11
Date comparisons
I occasionally get this error:
1)
''A puzzle once featured, should no longer be nominated'' FAILED
expected: Sun May 04 09:10:26 -0700 2008,
got: Sun May 04 09:10:26 -0700 2008 (using ==)
./spec/models/puzzle_spec.rb:180:
So, the dates looks the same to me. Any ideas for how to debug?
Joe
2009 Mar 21
1
[Cucumber] Rails Upgrade Notes
In the history.txt for 0.2 is an "important note" toward the bottom of
the announcement. (http://github.com/aslakhellesoy/cucumber/blob/d0555e4ca8a133f020efefd5a755da04bde3f57d/History.txt
). This is really, *really* important for Rails users, but it can be
more than a bit difficult to Google out.
Questions:
1. Can this be brought into a wiki page on github on cuke.info?
2. Is
2007 Apr 18
1
Scaffolding Specs
I just wrote a really simple tool that cranks out spec scaffolds for
Rails apps. It''s new and pretty simple, but you might find it useful:
http://calicowebdev.com/blog/show/13
--steve
2007 Feb 04
10
Spec''ing ActionMailer
Good morning (Pacific Time). I have a controller action that, as a
side-effect, sends an email to an administrator. I want it to do
something like this:
specify "when someone successfully signs up, an email should be sent
to the administrator with the person''s contact page" do
post :signup, {...lots o'' params}
response should_be success
#
2007 May 01
6
rspec and autotest
If you want to use rspec-0.9.2 with autotest (ZenTest-3.5.2), you''ll
want to read this blog:
http://blog.davidchelimsky.net/articles/2007/05/01/rspec-0-9-1-and-autotest-zentest-3-5-2
Enjoy!
David
2007 Aug 23
6
controller spec with model that validates_uniqueness
I want to use mocks and stubs to test the controller, but am having
trouble getting my validation not to trigger. Here''s the code:
# spec:
Image.stub!(:find).and_return(@image)
@image.should_receive(:save!).once.with(:any_args)
put :update, :id => @image.id, :category_id =>
@category.id, :image => {:name => ''test'', :image_number =>
2007 Mar 19
3
rSpec on Rails Integration Testing
I see that there is an integration testing example in the plugin
code. What is the thinking about integration specs?
Thanks,
Steve
2007 Dec 28
3
Converting to Rails 2.0.2
I''m moving an older project to Rails 2.0.2 and ran into a roadblock on
the version matching. Here''s script/console session:
>> Spec::VERSION::REV
=> "1785"
>> Spec::Rails::VERSION::REV
NoMethodError: undefined method `run='' for Test::Unit:Module
from /Users/sxross/rails/tastie_work/vendor/plugins/rspec_on_rails/
lib/spec/rails.rb:16
from
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