Displaying 20 results from an estimated 1000 matches similar to: "spec''ing models with observers that send mail"
2007 Aug 30
8
experimental rails story adapter in trunk
For those of you interested in getting a jump on learning about and
using the new Story Runner in a Rails app, I''ve added an experimental
Rails-Story adapter to trunk.
You can see how to use it here:
http://pastie.caboo.se/92320
This is PURELY EXPERIMENTAL, however it actually works and will likely
not change much in the way that it does work.
Happy hacking!
David
2008 Mar 12
2
Warning: integrate_views and nested description groups
describe MyController do
integrate_views
describe "A common base senario" do
it "no longer integrates views" do
be_careful
end
end
end
integrate_views affects an attribute in the class formed by the describe
factory method. The second describe generates its own class, so
integrate_views is OFF at that level. I''ve already spent far, far too much
2008 Jan 23
2
integrate_views is not executing my views
I wanted to use "integrate_views" as Ryan explains in his RailsCast #71
(http://railscasts.com/episodes/71)
...but I can''t get it to work: the view code in not executed
I looked everywhere but I can''t understand what I am doing wrong.
Here is what I did:
I created a new application from scratch (Rails 2.0.2), added rspec and
rspec_on_rails plugins, and run
2007 May 23
2
rspec mocha and controller specs without integrated_views
The ability to choose a mocking framework is great as I prefer mocha, but I
am have problems.
On my controller specs, I am forced to ''integrate_views'' as the following
code below shows you, the mocking of views is rspec specific. See stub!
versus mocha''s stub
unless block_given?
unless integrate_views?
2006 Jul 18
7
Observer not working
Help please.
I''m trying to observe a User class, but I can''t get this to work, the
after_create method never gets called... (the breakpoint never gets
called)
app/models/user_observer.rb:
class UserObserver < ActiveRecord::Observer
def after_create(user)
breakpoint
setting =
2007 May 28
1
Rails matcher render_template is wrong when using GetText, looking for flexible solution
I have a problem with a mismatch between RSpec Rails and the actual
behavior when using GetText, and would be glad for suggestions how to
best solve this.
When using GetText a failure is reported for the following simplified
specification:
describe SamplesController, "when requesting /samples" do
it "should render index " do
get ''index''
2007 May 29
4
rspec and autotest (was: questions rspec on rails)
Do have the latest versions?
RSpec-1.0.3
ZenTest-3.6.0
---------- Forwarded message ----------
From: Jonathan Linowes <jonathan at parkerhill.com>
Date: May 29, 2007 11:47 AM
Subject: Re: [rspec-users] questions rspec on rails
To: rspec-users <rspec-users at rubyforge.org>
Hi, I should have mentioned I already did that. Here''s my spec.opts file
--colour
--format
progress
2011 Jan 17
1
Using integrate_views for all controller specs
Is there a way to always use integrate_views for all controller specs?
I hate having to remember to insert that line into each one.
Thanks,
Joe
2006 Nov 19
1
ActiveRecord save-update not performed ?
I try to understand the following issue :
- when creating a new User record, I use an UserObserver to trap the
before_save call back and send an email
def after_create(user)
UserNotifier.deliver_signup_notification(user)
end
- Once created a user can ask for a password reset, which is also
trapped by the UserOberver
def after_save(user)
UserNotifier.deliver_reset_password(user) if
2008 Feb 19
3
render_to_string in a controller test?
Hi all,
I know that in general, view and controller tests should be isolated,
such that controller specs don''t test views etc. However, I think
I''ve run into a situation that might be an exception.
My controller uses render_to_string to produce a chunk of HTML that it
passes to a model to be processed.
The controller then redirects the user to a different page. The
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
2008 May 26
7
Mocking Models in Controller Specs...
I find myself doing this kind of thing a lot in Controller Specs:
@vacancy = mock_model(Vacancy)
@vacancy.stub!(:reference)
@vacancy.stub!(:title)
@vacancy.stub!(:created_at)
@vacancy.stub!(:updated_at)
@vacancy.stub!(:body)
@vacancy.stub!(:contract)
@vacancy.stub!(:location)
@vacancy.stub!(:salary)
@vacancy.stub!(:benefits)
2008 Sep 18
1
user_observer (restful_authentication) causes failure in loading rails
I have restful_authentication in use on an app and it has been working
fine, but I recently was changing the account creation flow and needed
to enable the UserObserver. I did so by including it in the
environment.rb (config.active_record.observers = :user_observer) and
Rails wouldn''t start.
I got the following error;
source/communitysites/vendor/rails/activerecord/lib/active_record/
2012 Mar 22
1
Rspec not loading fixtures
I am taking over a code base and am trying to run the tests. I am
somewhat new to RSpec so this might be a trivial problem.
Basically I can tell that the fixtures are not getting loaded. All 100
tests fail with a similar error.
But I don''t know why. Below is the code, with my narrative with ***
before it... Can you see anything or give me a clue where to look. So
far I am coming up
2013 Jun 06
1
Introducing MailJack: autogenerate querystring parameters that are appended to links in your emails
Hey All,
I just wrote a nifty gem and wanted to share(its one of my first).
Wondering if anyone would be so kind as to tell me what they think and/or
code review it.
MailJack - its like LoJack but for the links in your emails. The problem
this solves is the ability to track click throughs in emails.
https://github.com/synth/mail_jack
Basically, you specify what mailers you want to track
2006 Jul 07
3
Observer and Plugin conflict...
Hi fellas,
I have setup the acts_as_authenticated plugin and activated the
UserObserver to send activation emails.
I also have a homemade security plugin which adds methods to
ActiveRecord::Base like let_read and let_write.
On the server start, those two enter in conflict because the Observer
does something with the User model but it can''t find the let_read and
the let_write
2007 Jan 05
6
RSpec 0.7.5 with Rails and rcov
I seem to be missing something because I am at a loss on how to get
rcov, RSpec, and Rails working together. Would someone mind dropping
some hints?
2007 Dec 23
1
Rails: possible routing discrepancy
Hey all, I''m seeing a strange behavior in my spec that I can''t
account for. I''ve got a route that looks like this:
map.writing \
''/writing'',
:controller => ''abstracts'', :action => ''index'',
:index => { :select => ''all'' }
and I have template code that looks like this:
<br
2007 Jan 09
6
rcov seg fault
Hi
Trying to get rcov going (has been working), but with the following context
and specs it fails.
context ''/account POST with invalid attendee'' do
controller_name :account
setup do
Attendee.stub!(:create!).and_raise(ActiveRecord::RecordInvalid.new(
Attendee.new))
end
specify ''should raise on create'' do
Attendee.should_receive(:create!).with({
2008 Nov 07
0
deprecate integrate_views, WDYT?
I posted a ticket to lighthouse:
http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/595-deprecate-integrate_views
Please put your comments and thoughts there, as that is the best place
for that discussion. I wanted to make it more "visible" so it could
get wide community participation in case there are folks who
absolutely feel integrate_views is necessary (considering that we