require File.dirname(__FILE__) + '/../spec_helper'
describe Node, "instance" do
before(:each) do
@language = mock_model(Language, :name => "Japanese")
@node = Node.new(:language => @language)
@section1 = Node.new()
@chapter1 = Node.new()
@node.stub!(:root?).and_return(true)
@section1.stub!(:root?).and_return(false)
@chapter1.stub!(:root?).and_return(false)
end
it "should return it's own language if it is root" do # Passes
@node.language_name.should == "Japanese"
end
it "should return it's parent's language if it is a child" do # Fails (message below)
@section1.stub!(:parent).and_return(@node)
@chapter1.stub!(:parent).and_return(@section1)
@section1.language_name.should == "Japanese"
@chapter1.language_name.should == "Japanese"
end
end