Hello Rspecers,
I have a rails project where I am calling Resolv::DNS.open and then
using the block to check a domain name.
The code snippet in question is:
domain = "mytest.com"
Resolv::DNS.open do |dns|
@mx = dns.getresources(domain, Resolv::DNS::Resource::IN::MX)
end
I obviousl
On 7/24/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
> Hello Rspecers,
>
> I have a rails project where I am calling Resolv::DNS.open and then
> using the block to check a domain name.
>
> The code snippet in question is:
>
>domain = "mytest.com"
>Resolv::DNS.open do |dns|
> @mx = dns
Thank you, works perfectly!
Regards
Mikel
On 7/24/07, Pat Maddox <[EMAIL PROTECTED]> wrote:
> On 7/24/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
> > Hello Rspecers,
> >
> > I have a rails project where I am calling Resolv::DNS.open and then
> > using the block to check a domain name.
> >
> >
Hi,
I'm a bit stuck with mocking a unit test of a join model with regards to a
validates_uniqueness_of clause.
I have
class Book < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clip < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clipping < A
On 24 Jul 2007, at 14:07, Daniel N wrote:
> Any hints as to how to do this without using fixtures?
I did this literally minutes ago. I don't use fixtures at all,
ever. Instead I put the data in the before block, eg:
describe Purchase, "assigned to a Quote that already has a saved
purchase
On 7/24/07, Ashley Moran <[EMAIL PROTECTED]> wrote:
On 24 Jul 2007, at 14:07, Daniel N wrote:
> Any hints as to how to do this without using fixtures?
I did this literally minutes ago. I don't use fixtures at all,
ever. Instead I put the data in the before block, eg:
describe Purchase, "as
I'm trying to test some code that has validates each and I've got a very
strange failure
Mock 'Book_1027' expected :store_with_privacy? with (#) but received it with (#)
The Spec
it "should check that a book can save a clip" do
@user = mock_model( User, :id => 3 )
@clip = mock_model( Cl
On 7/24/07, Daniel N <[EMAIL PROTECTED]> wrote:
On 7/24/07, Ashley Moran <[EMAIL PROTECTED]> wrote:
>
>
> On 24 Jul 2007, at 14:07, Daniel N wrote:
>
> > Any hints as to how to do this without using fixtures?
>
> I did this literally minutes ago. I don't use fixtures at all,
> ever. Instead
On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote:
I'm trying to test some code that has validates each and I've got a very
strange failure
Mock 'Book_1027' expected :store_with_privacy? with (#) but received it with (#)
The Spec
it "should check that a book can save a clip" do
@user = moc
On 7/24/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
> On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > I'm trying to test some code that has validates each and I've got a very
> strange failure
> >
> > Mock 'Book_1027' expected :store_with_privacy? with (# @name="Clip_1025">) but received it wit
On 7/25/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
On 7/24/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
> On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > I'm trying to test some code that has validates each and I've got a
very
> strange failure
> >
> > Mock 'Book_1027' expected :store_wit
On 7/24/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
>
> On 7/25/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> > On 7/24/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote:
> > > > I'm trying to test some code that has validates each and I've
Hi all,
I am trying to use rspec_on_rails in a Rails app that doesn't have a
database. so far I have just been faking it out by dumping in a
sqlite3 database just to make Rails happy.
I was using for test::unit a rake task that eliminated the calls to
database prep:
# Added this .rake fil
I'm trying to jump on the TDD/BDD bandwagon, but am having trouble
understanding how i should mock my user. The user has a habtm
relationship to a roles model (acl_system2 plugin), but I'm not sure
how to tell rspec about a model.
My code:
describe UsersController do
integrate_views
before(
On 7/24/07, Justin Williams <[EMAIL PROTECTED]> wrote:
> I'm trying to jump on the TDD/BDD bandwagon, but am having trouble
> understanding how i should mock my user. The user has a habtm
> relationship to a roles model (acl_system2 plugin), but I'm not sure
> how to tell rspec about a model.
>
>
Hi all,
I'm in the process of creating rspecs for my helpers. One of the
helpers in app/helpers/application_helper.rb looks like this:
def page_name
@page_name || "Define @page_name in
#{controller.controller_name}::#{controller.action_name}"
end
The rspec is s
Does this work?
ApplicationHelper.stub!(:controller).and_return mock('controller',
:controller_name => 'foo')
On 7/24/07, Rick Tessner <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm in the process of creating rspecs for my helpers. One of the
> helpers in app/helpers/application_helper.rb looks
On 7/24/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> Would you please post the code for the actions as well?
def login
if request.post?
begin
session[:user] = User.authenticate(params[:login][:email],
params[:login][:password]).id
if current_user.roles.include?(Role.find_by_title
Hi,
On Tue, 2007-24-07 at 15:26 -0700, Courtenay wrote:
> Does this work?
>
> ApplicationHelper.stub!(:controller).and_return mock('controller',
> :controller_name => 'foo')
Sadly, no. Same result:
undefined local variable or method `controller' for [RSpec
example]: #
--
Ri
There would be a different way.
In the idea of "Only test the code you write" all you really need to
spec is that you have set the right association, because activerecord
has it's own tests to ensure the uniq call works.
You can do this with a call to reflect_on_association. Unfortunately
that c
On 7/24/07, Rick Tessner <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On Tue, 2007-24-07 at 15:26 -0700, Courtenay wrote:
> > Does this work?
> >
> > ApplicationHelper.stub!(:controller).and_return mock('controller',
> > :controller_name => 'foo')
>
> Sadly, no. Same result:
>
> undefined local
On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
There would be a different way.
In the idea of "Only test the code you write" all you really need to
spec is that you have set the right association, because activerecord
has it's own tests to ensure the uniq call works.
You can do this wit
Daniel N wrote:
> On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
>>
>> There would be a different way.
>>
>> In the idea of "Only test the code you write" all you really need to
>> spec is that you have set the right association, because activerecord
>> has it's own tests to ensure the uniq
On 7/25/07, Kyle Hargraves <[EMAIL PROTECTED]> wrote:
Daniel N wrote:
> On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
>>
>> There would be a different way.
>>
>> In the idea of "Only test the code you write" all you really need to
>> spec is that you have set the right association, becau
Hi,
This worked just fine. :) Thanks.
On Tue, 2007-24-07 at 16:30 -0700, Courtenay wrote:
> specing helpers just includes the module in your spec.
>
> So you can cheat like
>
> describe "Application Helper" do
> helper_name :application
>
> def controller
> @controller
> end
>
>
Kyle,
That is a good point. We are after the behaviour, not the implementation.
Regards
Mikel
On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote:
>
>
>
> On 7/25/07, Kyle Hargraves <[EMAIL PROTECTED]> wrote:
> > Daniel N wrote:
> > > On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
> > >>
> >
26 matches
Mail list logo