Makes total sense.
Thank you _very_ much David :) All works well and handles another
question I have on a disrelated matter.
By the way, loving RSpec. Makes testing a lot more interesting and
rewarding. Thanks for all your work.
Regards
Mikel
On 7/19/07, David Chelimsky <[EMAIL PROTECTED]>
D'oh. I should have figured this out on first sighting:
The parent method does a find, so it retrieves a new object from the
db - not the instance of Node you have defined. This new instance has
no language associated with it (because the one you gave it pretends
to exist by sporting an ID, but is
I like the it "should..." do end calls, specifiy as well makes sense.
So what is the problem? I think we should take a look at what comments are for.
Essentially the "should blah" text acts as a comment on the spec. One
that is then picked up by RSpec and inserted to make our
specifications mor
Well in that specific case, please seems like a good choice
please do
@thing.should be_somthing
end
But If you had text in between then it wouldn't seem the same:
please "whatever text" do
@thing.should be_something
end
Quoting David Chelimsky <[EMAIL PROTECTED]>:
> H
Using 1.2.3 and RSpec with the RSpec Rails plugin installed from
CURRENT on the RSpec SVN server.
On 7/19/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
> Crap, I totally, forgot to mention, sorry David. I am using betternestedset
>
> http://wiki.rubyonrails.org/rails/pages/BetterNestedSet
>
> scr
Crap, I totally, forgot to mention, sorry David. I am using betternestedset
http://wiki.rubyonrails.org/rails/pages/BetterNestedSet
script/plugin source svn://rubyforge.org/var/svn/betternestedset
script/plugin install betternestedset
Regards
Mikel
On 7/19/07, David Chelimsky <[EMAIL PROTECT
Here are the errors I'm getting now:
1)
NoMethodError in 'Node instance should return it's parent's language
if it is a child'
undefined method `move_to_child_of' for #
./spec/models/node_spec.rb:20:
2)
NameError in 'Node instance should return it's own language if it is root'
undefined local var
Here are the migrations:
class CreateNodes < ActiveRecord::Migration
def self.up
create_table ("nodes", :options => 'ENGINE=InnoDB DEFAULT
CHARSET=utf8', :force => true) do |t|
t.column "title",:string
t.column "language_id", :integer
t.column "parent_id",
You might also want to try this w/ another mock framework like mocha
or flexmock (or rr if you're on edge). If you do, please report the
results here.
Thx
On 7/18/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
> Would you mind posting the migrations?
>
> On 7/18/07, Mikel Lindsaar <[EMAIL PROTECT
Would you mind posting the migrations?
On 7/18/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
> Heya David,
>
> Thanks for the reply.
>
> No, that didn't work, get the same error:
>
> NoMethodError in 'Node instance should return it's parent's language
> if it is a child'
> You have a nil object wh
Heya David,
Thanks for the reply.
No, that didn't work, get the same error:
NoMethodError in 'Node instance should return it's parent's language
if it is a child'
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.name
If I include the fixture :languages,
On 7/19/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
Hey all,
I see examples showing up that look like this:
describe Thing do
before(:each) do
@thing = Thing.new
end
it do
@thing.should be_something
end
end
This will produce output like this:
Thing
- should be something
David Chelimsky wrote:
> Consise? Yes. But I'm not psyched about 'specify' either. There IS a
> perfect word for this situation. What is it? Suggestions?
Personally, I disagree. For examples like that, I think 'specify' is a
pretty ideal word. It reads exactly as I want it to. Depending on what
On 7/19/07, David Chelimsky <[EMAIL PROTECTED]> wrote:
Hey all,
I see examples showing up that look like this:
describe Thing do
before(:each) do
@thing = Thing.new
end
it do
@thing.should be_something
end
end
This will produce output like this:
Thing
- should be something
Hey all,
I see examples showing up that look like this:
describe Thing do
before(:each) do
@thing = Thing.new
end
it do
@thing.should be_something
end
end
This will produce output like this:
Thing
- should be something
But "it do" is driving me mad :(
We need a better word. O
On 7/18/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote:
> Hello list,
>
> I think I have a rails related RSpec problem with a mock going out of
> scope on a recursive call to a model.
>
> The code is at: http://pastie.textmate.org/79821 if you want to see it
> highlighted. I have pasted it below as
On 7/18/07, Esad Hajdarevic <[EMAIL PROTECTED]> wrote:
> Hi!
>
> Is there an option that I could provide to the spec runner that would
> make it stop after it
> encounters the first spec that fails?
Not yet. Please submit an RFE if you'd like to see it:
http://rubyforge.org/tracker/?group_id=797
Hi!
Is there an option that I could provide to the spec runner that would
make it stop after it
encounters the first spec that fails?
Esad
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
On 7/18/07, court3nay <[EMAIL PROTECTED]> wrote:
> Any chance of some prettier syntax for that?
There's always a chance. What do you propose?
>
> ---
> Courtenay
>
> On Jul 18, 2007, at 2:30 PM, "David Chelimsky" <[EMAIL PROTECTED]>
> wrote:
>
> > On 7/18/07, Paul <[EMAIL PROTECTED]> wrote:
>
Hello list,
I think I have a rails related RSpec problem with a mock going out of
scope on a recursive call to a model.
The code is at: http://pastie.textmate.org/79821 if you want to see it
highlighted. I have pasted it below as well.
Basically, I have an acts_as_nested_set model called "Node"
I eventually ended up using this, from a somewhat-related post to this
list a couple months ago:
def assoc_mock(stubs = {})
proxy = mock('association_proxy')
stubs.each do |method, ret|
proxy.stub!(method).and_return(ret)
end
proxy
end
Then I can do something like I wanted:
@comment
Any chance of some prettier syntax for that?
---
Courtenay
On Jul 18, 2007, at 2:30 PM, "David Chelimsky" <[EMAIL PROTECTED]>
wrote:
> On 7/18/07, Paul <[EMAIL PROTECTED]> wrote:
>> Rails model association collections allow you to do nifty things
>> like:
>>
>> article.comments.find(:al
Any chance of some prettier syntax for that?
---
Courtenay
On Jul 18, 2007, at 2:30 PM, "David Chelimsky" <[EMAIL PROTECTED]>
wrote:
> On 7/18/07, Paul <[EMAIL PROTECTED]> wrote:
>> Rails model association collections allow you to do nifty things
>> like:
>>
>> article.comments.find(:all
On 7/18/07, Paul <[EMAIL PROTECTED]> wrote:
> Rails model association collections allow you to do nifty things like:
>
> article.comments.find(:all, :conditions => {:created_at > 1.day.ago})
>
> Has anyone found a good way to mock this up? I'm currently doing this:
>
> @comment1 = mock_model(Co
Rails model association collections allow you to do nifty things like:
article.comments.find(:all, :conditions => {:created_at > 1.day.ago})
Has anyone found a good way to mock this up? I'm currently doing this:
@comment1 = mock_model(Comment)
comments = mock(Array)
comments.stub!(:find)
25 matches
Mail list logo