Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-03 16:55:08 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-03 16:55:08 +0400
commitdfeef6c22849c04ffd225a0356fd11fb8e4907f6 (patch)
tree02eafb752d203a1ca93ee8442299771b3610d737 /spec
parent413a310faa17f626f351fa3afd6423e8782935a9 (diff)
Fixed API file raw functionality, Fixed tree controller tests. Added BlobController specs
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/blob_controller_spec.rb37
-rw-r--r--spec/controllers/tree_controller_spec.rb6
-rw-r--r--spec/models/commit_spec.rb4
3 files changed, 42 insertions, 5 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
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index 6cf777bec04..ad99d8a390b 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -38,10 +38,10 @@ describe Commit do
it { should respond_to(:message) }
it { should respond_to(:authored_date) }
it { should respond_to(:committed_date) }
+ it { should respond_to(:committer_email) }
+ it { should respond_to(:author_email) }
it { should respond_to(:parents) }
it { should respond_to(:date) }
- it { should respond_to(:committer) }
- it { should respond_to(:author) }
it { should respond_to(:diffs) }
it { should respond_to(:tree) }
it { should respond_to(:id) }