Commit 578cf89812fc12e99e22a3da83aaca89e7c8d430
1 parent
a85e11fa
Exists in
master
and in
4 other branches
Fix specs
Showing
6 changed files
with
39 additions
and
36 deletions
Show diff stats
app/assets/javascripts/issues.js
@@ -39,10 +39,10 @@ function backToIssues(){ | @@ -39,10 +39,10 @@ function backToIssues(){ | ||
39 | } | 39 | } |
40 | 40 | ||
41 | function initIssuesSearch() { | 41 | function initIssuesSearch() { |
42 | - var href = $('.issue_search').parent().attr('action'); | 42 | + var href = $('#issue_search_form').attr('action'); |
43 | var last_terms = ''; | 43 | var last_terms = ''; |
44 | 44 | ||
45 | - $('.issue_search').keyup(function() { | 45 | + $('#issue_search').keyup(function() { |
46 | var terms = $(this).val(); | 46 | var terms = $(this).val(); |
47 | var milestone_id = $('#milestone_id').val(); | 47 | var milestone_id = $('#milestone_id').val(); |
48 | var status = $('#status').val(); | 48 | var status = $('#status').val(); |
@@ -57,10 +57,6 @@ function initIssuesSearch() { | @@ -57,10 +57,6 @@ function initIssuesSearch() { | ||
57 | } | 57 | } |
58 | } | 58 | } |
59 | }); | 59 | }); |
60 | - | ||
61 | - $('.delete-issue').live('ajax:success', function() { | ||
62 | - $(this).closest('tr').fadeOut(); updatePage(); | ||
63 | - }); | ||
64 | } | 60 | } |
65 | 61 | ||
66 | /** | 62 | /** |
app/models/milestone.rb
@@ -7,6 +7,7 @@ class Milestone < ActiveRecord::Base | @@ -7,6 +7,7 @@ class Milestone < ActiveRecord::Base | ||
7 | 7 | ||
8 | validates :title, presence: true | 8 | validates :title, presence: true |
9 | validates :project, presence: true | 9 | validates :project, presence: true |
10 | + validates :closed, inclusion: { in: [true, false] } | ||
10 | 11 | ||
11 | def self.active | 12 | def self.active |
12 | where("due_date > ? OR due_date IS NULL", Date.today) | 13 | where("due_date > ? OR due_date IS NULL", Date.today) |
features/steps/project/project_browse_commits.rb
@@ -53,8 +53,9 @@ class ProjectBrowseCommits < Spinach::FeatureSteps | @@ -53,8 +53,9 @@ class ProjectBrowseCommits < Spinach::FeatureSteps | ||
53 | end | 53 | end |
54 | 54 | ||
55 | Then 'I see commits stats' do | 55 | Then 'I see commits stats' do |
56 | - page.should have_content 'Stats for master' | 56 | + page.should have_content 'Stats' |
57 | page.should have_content 'Committers' | 57 | page.should have_content 'Committers' |
58 | page.should have_content 'Total commits' | 58 | page.should have_content 'Total commits' |
59 | + page.should have_content 'Authors' | ||
59 | end | 60 | end |
60 | end | 61 | end |
spec/models/issue_spec.rb
@@ -30,7 +30,6 @@ describe Issue do | @@ -30,7 +30,6 @@ describe Issue do | ||
30 | 30 | ||
31 | describe "Validation" do | 31 | describe "Validation" do |
32 | it { should ensure_length_of(:description).is_within(0..2000) } | 32 | it { should ensure_length_of(:description).is_within(0..2000) } |
33 | - it { should ensure_inclusion_of(:closed).in_array([true, false]) } | ||
34 | end | 33 | end |
35 | 34 | ||
36 | describe 'modules' do | 35 | describe 'modules' do |
spec/requests/issues_spec.rb
@@ -5,24 +5,27 @@ describe "Issues" do | @@ -5,24 +5,27 @@ describe "Issues" do | ||
5 | 5 | ||
6 | before do | 6 | before do |
7 | login_as :user | 7 | login_as :user |
8 | - @user2 = create(:user) | 8 | + user2 = create(:user) |
9 | 9 | ||
10 | project.add_access(@user, :read, :write) | 10 | project.add_access(@user, :read, :write) |
11 | - project.add_access(@user2, :read, :write) | 11 | + project.add_access(user2, :read, :write) |
12 | end | 12 | end |
13 | 13 | ||
14 | describe "Edit issue", js: true do | 14 | describe "Edit issue", js: true do |
15 | + let!(:issue) do | ||
16 | + create(:issue, | ||
17 | + author: @user, | ||
18 | + assignee: @user, | ||
19 | + project: project) | ||
20 | + end | ||
21 | + | ||
15 | before do | 22 | before do |
16 | - @issue = create(:issue, | ||
17 | - author: @user, | ||
18 | - assignee: @user, | ||
19 | - project: project) | ||
20 | visit project_issues_path(project) | 23 | visit project_issues_path(project) |
21 | click_link "Edit" | 24 | click_link "Edit" |
22 | end | 25 | end |
23 | 26 | ||
24 | it "should open new issue popup" do | 27 | it "should open new issue popup" do |
25 | - page.should have_content("Issue ##{@issue.id}") | 28 | + page.should have_content("Issue ##{issue.id}") |
26 | end | 29 | end |
27 | 30 | ||
28 | describe "fill in" do | 31 | describe "fill in" do |
@@ -46,19 +49,18 @@ describe "Issues" do | @@ -46,19 +49,18 @@ describe "Issues" do | ||
46 | describe "Search issue", js: true do | 49 | describe "Search issue", js: true do |
47 | before do | 50 | before do |
48 | ['foobar', 'foobar2', 'gitlab'].each do |title| | 51 | ['foobar', 'foobar2', 'gitlab'].each do |title| |
49 | - @issue = create(:issue, | ||
50 | - author: @user, | ||
51 | - assignee: @user, | ||
52 | - project: project, | ||
53 | - title: title) | ||
54 | - @issue.save | 52 | + create(:issue, |
53 | + author: @user, | ||
54 | + assignee: @user, | ||
55 | + project: project, | ||
56 | + title: title) | ||
55 | end | 57 | end |
56 | end | 58 | end |
57 | 59 | ||
58 | it "should be able to search on different statuses" do | 60 | it "should be able to search on different statuses" do |
59 | - @issue = Issue.first | ||
60 | - @issue.closed = true | ||
61 | - @issue.save | 61 | + issue = Issue.first # with title 'foobar' |
62 | + issue.closed = true | ||
63 | + issue.save | ||
62 | 64 | ||
63 | visit project_issues_path(project) | 65 | visit project_issues_path(project) |
64 | click_link 'Closed' | 66 | click_link 'Closed' |
@@ -81,8 +83,9 @@ describe "Issues" do | @@ -81,8 +83,9 @@ describe "Issues" do | ||
81 | it "should return all results if term has been cleared" do | 83 | it "should return all results if term has been cleared" do |
82 | visit project_issues_path(project) | 84 | visit project_issues_path(project) |
83 | fill_in "issue_search", with: "foobar" | 85 | fill_in "issue_search", with: "foobar" |
84 | - # Because fill_in, with: "" triggers nothing we need to trigger a keyup event | ||
85 | - page.execute_script("$('.issue_search').val('').keyup();"); | 86 | + # Reset the search field and trigger loading the issues |
87 | + fill_in "issue_search", with: "" | ||
88 | + page.execute_script("$('#issue_search').keyup();"); | ||
86 | 89 | ||
87 | page.should have_content 'foobar' | 90 | page.should have_content 'foobar' |
88 | page.should have_content 'foobar2' | 91 | page.should have_content 'foobar2' |
@@ -93,19 +96,21 @@ describe "Issues" do | @@ -93,19 +96,21 @@ describe "Issues" do | ||
93 | describe "Filter issue" do | 96 | describe "Filter issue" do |
94 | before do | 97 | before do |
95 | ['foobar', 'barbaz', 'gitlab'].each do |title| | 98 | ['foobar', 'barbaz', 'gitlab'].each do |title| |
96 | - @issue = create(:issue, | ||
97 | - author: @user, | ||
98 | - assignee: @user, | ||
99 | - project: project, | ||
100 | - title: title) | 99 | + create(:issue, |
100 | + author: @user, | ||
101 | + assignee: @user, | ||
102 | + project: project, | ||
103 | + title: title) | ||
101 | end | 104 | end |
102 | 105 | ||
103 | - @issue = Issue.first | ||
104 | - @issue.milestone = create(:milestone, project: project) | ||
105 | - @issue.assignee = nil | ||
106 | - @issue.save | 106 | + issue = Issue.first # with title 'foobar' |
107 | + issue.milestone = create(:milestone, project: project) | ||
108 | + issue.assignee = nil | ||
109 | + issue.save | ||
107 | end | 110 | end |
108 | 111 | ||
112 | + let(:issue) { Issue.first } | ||
113 | + | ||
109 | it "should allow filtering by issues with no specified milestone" do | 114 | it "should allow filtering by issues with no specified milestone" do |
110 | visit project_issues_path(project, milestone_id: '0') | 115 | visit project_issues_path(project, milestone_id: '0') |
111 | 116 | ||
@@ -115,7 +120,7 @@ describe "Issues" do | @@ -115,7 +120,7 @@ describe "Issues" do | ||
115 | end | 120 | end |
116 | 121 | ||
117 | it "should allow filtering by a specified milestone" do | 122 | it "should allow filtering by a specified milestone" do |
118 | - visit project_issues_path(project, milestone_id: @issue.milestone.id) | 123 | + visit project_issues_path(project, milestone_id: issue.milestone.id) |
119 | 124 | ||
120 | page.should have_content 'foobar' | 125 | page.should have_content 'foobar' |
121 | page.should_not have_content 'barbaz' | 126 | page.should_not have_content 'barbaz' |
spec/roles/issue_commonality_spec.rb
@@ -15,6 +15,7 @@ describe Issue, "IssueCommonality" do | @@ -15,6 +15,7 @@ describe Issue, "IssueCommonality" do | ||
15 | it { should validate_presence_of(:author) } | 15 | it { should validate_presence_of(:author) } |
16 | it { should validate_presence_of(:title) } | 16 | it { should validate_presence_of(:title) } |
17 | it { should ensure_length_of(:title).is_at_least(0).is_at_most(255) } | 17 | it { should ensure_length_of(:title).is_at_least(0).is_at_most(255) } |
18 | + it { should ensure_inclusion_of(:closed).in_array([true, false]) } | ||
18 | end | 19 | end |
19 | 20 | ||
20 | describe "Scope" do | 21 | describe "Scope" do |