summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-12-25 15:52:06 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-12-25 15:52:06 +0000
commitfd231ff9fb6292c2fd15f71c5329216e67935560 (patch)
tree258b204b781cbd08a7de3ad26141780e2cfa873b /spec
parent7d5b51f3877eb209e1215c1154a976bb079b930d (diff)
parentc79ffa01b49128c609099b7048649082b5e327fb (diff)
downloadgitlab-ce-fd231ff9fb6292c2fd15f71c5329216e67935560.tar.gz
Merge branch 'revert_votes_back' into 'master'
Revert vote buttons back to issue and MR pages https://gitlab.com/gitlab-org/gitlab-ce/issues/3672 /cc @dzaporozhets @JobV ![joxi_screenshot_1450809309400](/uploads/379a75505e0d5f24e743aa0a6a6684e2/joxi_screenshot_1450809309400.png) See merge request !2206
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/issues_helper_spec.rb7
-rw-r--r--spec/models/note_spec.rb11
2 files changed, 15 insertions, 3 deletions
diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb
index 04e795025d2..ffd8ebae029 100644
--- a/spec/helpers/issues_helper_spec.rb
+++ b/spec/helpers/issues_helper_spec.rb
@@ -141,4 +141,11 @@ describe IssuesHelper do
expect(note_active_class(Note.all, @note.author)).to eq("active")
end
end
+
+ describe "#awards_sort" do
+ it "sorts a hash so thumbsup and thumbsdown are always on top" do
+ data = { "thumbsdown" => "some value", "lifter" => "some value", "thumbsup" => "some value" }
+ expect(awards_sort(data).keys).to eq(["thumbsup", "thumbsdown", "lifter"])
+ end
+ end
end
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index b7006fa5e68..593d8f76215 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -137,9 +137,14 @@ describe Note, models: true do
create :note, note: "smile", is_award: true
end
- it "returns grouped array of notes" do
- expect(Note.grouped_awards.first.first).to eq("smile")
- expect(Note.grouped_awards.first.last).to match_array(Note.all)
+ it "returns grouped hash of notes" do
+ expect(Note.grouped_awards.keys.size).to eq(3)
+ expect(Note.grouped_awards["smile"]).to match_array(Note.all)
+ end
+
+ it "returns thumbsup and thumbsdown always" do
+ expect(Note.grouped_awards["thumbsup"]).to match_array(Note.none)
+ expect(Note.grouped_awards["thumbsdown"]).to match_array(Note.none)
end
end