summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-03 15:55:08 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-03 15:55:08 +0300
commitdfeef6c22849c04ffd225a0356fd11fb8e4907f6 (patch)
tree02eafb752d203a1ca93ee8442299771b3610d737 /spec/controllers
parent413a310faa17f626f351fa3afd6423e8782935a9 (diff)
downloadgitlab-ce-dfeef6c22849c04ffd225a0356fd11fb8e4907f6.tar.gz
Fixed API file raw functionality, Fixed tree controller tests. Added BlobController specs
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/blob_controller_spec.rb37
-rw-r--r--spec/controllers/tree_controller_spec.rb6
2 files changed, 40 insertions, 3 deletions
diff --git a/spec/controllers/blob_controller_spec.rb b/spec/controllers/blob_controller_spec.rb
new file mode 100644
index 00000000000..fe113459470
--- /dev/null
+++ b/spec/controllers/blob_controller_spec.rb
@@ -0,0 +1,37 @@
+require 'spec_helper'
+
+describe BlobController do
+ let(:project) { create(:project_with_code) }
+ let(:user) { create(:user) }
+
+ before do
+ sign_in(user)
+
+ project.team << [user, :master]
+
+ project.stub(:branches).and_return(['master', 'foo/bar/baz'])
+ project.stub(:tags).and_return(['v1.0.0', 'v2.0.0'])
+ controller.instance_variable_set(:@project, project)
+ end
+
+ describe "GET show" do
+ render_views
+
+ before { get :show, project_id: project.code, id: id }
+
+ context "valid branch, valid file" do
+ let(:id) { 'master/README.md' }
+ it { should respond_with(:success) }
+ end
+
+ context "valid branch, invalid file" do
+ let(:id) { 'master/invalid-path.rb' }
+ it { should respond_with(:not_found) }
+ end
+
+ context "invalid branch, valid file" do
+ let(:id) { 'invalid-branch/README.md' }
+ it { should respond_with(:not_found) }
+ end
+ end
+end
diff --git a/spec/controllers/tree_controller_spec.rb b/spec/controllers/tree_controller_spec.rb
index 8232f1472e1..f9fe4fe2010 100644
--- a/spec/controllers/tree_controller_spec.rb
+++ b/spec/controllers/tree_controller_spec.rb
@@ -26,17 +26,17 @@ describe TreeController do
end
context "valid branch, valid path" do
- let(:id) { 'master/README.md' }
+ let(:id) { 'master/app/' }
it { should respond_with(:success) }
end
context "valid branch, invalid path" do
- let(:id) { 'master/invalid-path.rb' }
+ let(:id) { 'master/invalid-path/' }
it { should respond_with(:not_found) }
end
context "invalid branch, valid path" do
- let(:id) { 'invalid-branch/README.md' }
+ let(:id) { 'invalid-branch/app/' }
it { should respond_with(:not_found) }
end
end