files_routing_spec.rb revision a847d9812b328c048773e705606b10875a929034
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagherrequire 'spec_helper'
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagherdescribe FilesController do
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher before do
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher Repository.stub(:find_by_path) { true }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher RepositoryFile.stub(:find_with_path) { true }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher end
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher after do
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher Repository.unstub(:find_by_path)
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher RepositoryFile.unstub(:find_with_path)
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher end
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher # FIXME some/path must exist in repository
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher #it { should route(:get, 'repopath/some/path' ).to(repository_id: 'repopath', action: :files, path: 'some/path') }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher it { should route(:get, 'repopath' ).to(repository_id: 'repopath', action: :files ) }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher it { should route(:get, 'repositories/repopath/files/new' ).to(repository_id: 'repopath', action: :new ) }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher it { should route(:post, 'repositories/repopath/files' ).to(repository_id: 'repopath', action: :create ) }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher it { should route(:get, 'repositories/repopath/12ab/action' ).to(repository_id: 'repopath', action: :action, ref: '12ab' ) }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher it { should route(:get, 'repositories/repopath/12ab/files/some/path' ).to(repository_id: 'repopath', action: :files, ref: '12ab', path: 'some/path' ) }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher it { should route(:get, 'repositories/repopath/master/history' ).to(repository_id: 'repopath', action: :history, ref: 'master' ) }
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagherend
505e75ba28b42bb3de7a6d55de825091b70cc2b2Stephen Gallagher