Skip to content

Instantly share code, notes, and snippets.

@tomtt
Created April 22, 2009 11:46
Show Gist options
  • Select an option

  • Save tomtt/99747 to your computer and use it in GitHub Desktop.

Select an option

Save tomtt/99747 to your computer and use it in GitHub Desktop.
odule Foo
class Bar
include ActionController::UrlWriter
def inst_path
root_path
end
def self.some_path
root_path
end
end
end
require File.expand_path(File.dirname(__FILE__) + '/../spec/spec_helper')
describe Foo::Bar do
it "should be able to use url writer from instance" do
Foo::Bar.new.inst_path.should == '/'
end
it "should be able to use url writer from class" do
Foo::Bar.some_path.should == '/'
end
end
## Running the spec:
>: spec lib/test.rb
.F
1)
NameError in 'Foo::Bar should be able to use url writer from class'
undefined local variable or method `root_path' for Foo::Bar:Class
./lib/test.rb:10:in `some_path'
./lib/test.rb:23:
script/spec:10:
Finished in 0.087429 seconds
2 examples, 1 failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment