Skip to content

Commit

Permalink
Fixes to hobo/hobo_helper doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
tslocke committed Nov 11, 2011
1 parent 3bcb6e4 commit ec4ab6b
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions hobo/test/doctest/hobo/hobo_helper.rdoctest
Original file line number Diff line number Diff line change
@@ -22,19 +22,11 @@ Create a mock view layer:
def base_url; "" ;end
end
end
>> Rails.root = "test-app"

Useful stuff

>> def init_mocha; $stubba = Mocha::Central.new; end
>>
class Thing
class Mocks; extend Mocha::AutoVerify; end
def self.mock(hash)
Mocks.mock(hash.update(:class => self))
end
end

>> def mock; Mocha::Mockery.instance.named_mock 'mock'; end

## `object_url`

@@ -45,7 +37,9 @@ Note that `object_url` doesn't perform "reverse routing". It knows nothing about
Something to link to:

>> init_mocha
>> thing = Thing.mock(:to_url_path => "things/1")
>> class Thing; end
>> thing = Thing.new
>> thing.expects(:to_url_path).at_least_once.returns("things/1")

### Simple 'show' URLs

@@ -66,27 +60,3 @@ A URL to the 'edit' page:
=> "/things/1/edit"


### POST URLs for creating new items in collections:

>> collection = mock(:origin => thing, :origin_attribute => "parts")
>> Hobo::Routes.expects(:linkable?).with(Thing, :create_part, {:subsite => '', :method => :post}).returns(true)
>> View.object_url(collection, :method => :post)
=> "/things/1/parts"


















0 comments on commit ec4ab6b

Please sign in to comment.