[rspec-users] Testing Email thriugh Rspec

Amit Kulkarni lists at ruby-forum.com
Wed Aug 18 08:21:46 EDT 2010

jko170 wrote:
> There is also the excellent email_spec gem:
> http://github.com/bmabey/email-spec/

Continuing with the topic but scenario is different:
I had written a rake task in rspec.rake.What i want is after running the 
task i should get an email
So for that i have created a method in app/models/notifier.rb which is 
as follows:
def sanity
    @recipients = "amit at test.com"
    @subject = "Sanity"

Now in the rake task i am calling the method which is a follows (I am 
writing this rake task under rspec.rake):
desc "Sanity testing"
  Spec::Rake::SpecTask.new(:sanity) do |t|
#    t.spec_opts = ["--format", "specdoc", "--dry-run"]
    t.spec_files = FileList['spec/models/sanity_spec.rb']

But if i run the task it says "uninitialized constant Notifier" .If i 
comment the notifier line then my rake task is working fine.
May be it is not getting the model.So do i need to add the model or some 
configuration need to be done
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list