e8ceec219830407bded84634716d37d45d3a5872Julian Kornbergerrequire 'spec_helper'
e8ceec219830407bded84634716d37d45d3a5872Julian Kornberger
90f9fe34cbbb04b483cfe71b94ae63317fcfee7cEugen Kuksadescribe 'FilesControllerRouting' do
a847d9812b328c048773e705606b10875a929034Eugen Kuksa before do
a847d9812b328c048773e705606b10875a929034Eugen Kuksa Repository.stub(:find_by_path) { true }
a847d9812b328c048773e705606b10875a929034Eugen Kuksa RepositoryFile.stub(:find_with_path) { true }
a847d9812b328c048773e705606b10875a929034Eugen Kuksa end
a847d9812b328c048773e705606b10875a929034Eugen Kuksa
a847d9812b328c048773e705606b10875a929034Eugen Kuksa after do
a847d9812b328c048773e705606b10875a929034Eugen Kuksa Repository.unstub(:find_by_path)
a847d9812b328c048773e705606b10875a929034Eugen Kuksa RepositoryFile.unstub(:find_with_path)
a847d9812b328c048773e705606b10875a929034Eugen Kuksa end
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase
90f9fe34cbbb04b483cfe71b94ae63317fcfee7cEugen Kuksa it { should route(:get, 'repopath' ).to(repository_id: 'repopath', controller: :files, action: :show ) }
90f9fe34cbbb04b483cfe71b94ae63317fcfee7cEugen Kuksa it { should route(:get, 'repopath/some/path' ).to(repository_id: 'repopath', controller: :files, action: :show, path: 'some/path') }
90f9fe34cbbb04b483cfe71b94ae63317fcfee7cEugen Kuksa it { should route(:get, 'repositories/repopath/files/new' ).to(repository_id: 'repopath', controller: :files, action: :new ) }
90f9fe34cbbb04b483cfe71b94ae63317fcfee7cEugen Kuksa it { should route(:post, 'repositories/repopath/files' ).to(repository_id: 'repopath', controller: :files, action: :create ) }
90f9fe34cbbb04b483cfe71b94ae63317fcfee7cEugen Kuksa it { should route(:get, 'repositories/repopath/12ab/action' ).to(repository_id: 'repopath', controller: :files, action: :action, ref: '12ab' ) }
90f9fe34cbbb04b483cfe71b94ae63317fcfee7cEugen Kuksa it { should route(:get, 'repositories/repopath/12ab/files/some/path' ).to(repository_id: 'repopath', controller: :files, action: :show, ref: '12ab', path: 'some/path' ) }
78b69b71ee6bb1b213a2af7a2daec9e2e16052efEugen Kuksa it { should route(:delete, 'repopath/some/path' ).to(repository_id: 'repopath', controller: :files, action: :destroy, path: 'some/path') }
e8ceec219830407bded84634716d37d45d3a5872Julian Kornbergerend