files_controller_spec.rb revision e8ceec219830407bded84634716d37d45d3a5872
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehaserequire 'spec_helper'
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehasedescribe FilesController do
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase describe "repository" do
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase let!(:repository){ create :repository }
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase describe "files" do
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase before { get :files, repository_id: repository.to_param }
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase it { should respond_with :success }
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase it { should render_template :files }
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase end
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase describe "signed in with write access" do
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase let(:user){ create(:permission, item: repository).subject }
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase before { sign_in user }
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase describe "new" do
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase before { get :new, repository_id: repository.to_param }
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase it { should respond_with :success }
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase end
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase describe "create" do
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase describe "without file" do
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase before { post :create, repository_id: repository.to_param }
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase it { should respond_with :success }
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase end
e1d2fd86f76c899ca9cc37b6dc892a1410b53470Tim Reddehase
0d3763fcd43f738899afcf8699b0e02b833c8132Tim Reddehase describe "with file" do
before {
post :create, repository_id: repository.to_param, upload_file: {
path: 'my_path',
message: 'commit message',
file: Rack::Test::UploadedFile.new(Rails.root.join('test','fixtures','ontologies','owl','pizza.owl'),'image/jpg')
}
}
it { should respond_with :redirect }
end
end
end
end
end