summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-11-14 01:20:37 +0100
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-11-14 01:20:37 +0100
commit578cf89812fc12e99e22a3da83aaca89e7c8d430 (patch)
tree8023632ed4569451da71dff50c9b386f71f672c4
parenta85e11fa51497888684f247bc09450cbcc67a058 (diff)
downloadgitlab-ce-578cf89812fc12e99e22a3da83aaca89e7c8d430.tar.gz
Fix specs
-rw-r--r--app/assets/javascripts/issues.js8
-rw-r--r--app/models/milestone.rb1
-rw-r--r--features/steps/project/project_browse_commits.rb3
-rw-r--r--spec/models/issue_spec.rb1
-rw-r--r--spec/requests/issues_spec.rb61
-rw-r--r--spec/roles/issue_commonality_spec.rb1
6 files changed, 39 insertions, 36 deletions
diff --git a/app/assets/javascripts/issues.js b/app/assets/javascripts/issues.js
index db3ad7f745c..55db72c39f0 100644
--- a/app/assets/javascripts/issues.js
+++ b/app/assets/javascripts/issues.js
@@ -39,10 +39,10 @@ function backToIssues(){
}
function initIssuesSearch() {
- var href = $('.issue_search').parent().attr('action');
+ var href = $('#issue_search_form').attr('action');
var last_terms = '';
- $('.issue_search').keyup(function() {
+ $('#issue_search').keyup(function() {
var terms = $(this).val();
var milestone_id = $('#milestone_id').val();
var status = $('#status').val();
@@ -57,10 +57,6 @@ function initIssuesSearch() {
}
}
});
-
- $('.delete-issue').live('ajax:success', function() {
- $(this).closest('tr').fadeOut(); updatePage();
- });
}
/**
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 41412a13bf5..1dcc93bf2a4 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -7,6 +7,7 @@ class Milestone < ActiveRecord::Base
validates :title, presence: true
validates :project, presence: true
+ validates :closed, inclusion: { in: [true, false] }
def self.active
where("due_date > ? OR due_date IS NULL", Date.today)
diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb
index 428c14a8052..6bf164e2c8f 100644
--- a/features/steps/project/project_browse_commits.rb
+++ b/features/steps/project/project_browse_commits.rb
@@ -53,8 +53,9 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
end
Then 'I see commits stats' do
- page.should have_content 'Stats for master'
+ page.should have_content 'Stats'
page.should have_content 'Committers'
page.should have_content 'Total commits'
+ page.should have_content 'Authors'
end
end
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 4e999aad661..9c69f8689c8 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -30,7 +30,6 @@ describe Issue do
describe "Validation" do
it { should ensure_length_of(:description).is_within(0..2000) }
- it { should ensure_inclusion_of(:closed).in_array([true, false]) }
end
describe 'modules' do
diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb
index c95409d3a5f..ff4d4c8b8ae 100644
--- a/spec/requests/issues_spec.rb
+++ b/spec/requests/issues_spec.rb
@@ -5,24 +5,27 @@ describe "Issues" do
before do
login_as :user
- @user2 = create(:user)
+ user2 = create(:user)
project.add_access(@user, :read, :write)
- project.add_access(@user2, :read, :write)
+ project.add_access(user2, :read, :write)
end
describe "Edit issue", js: true do
+ let!(:issue) do
+ create(:issue,
+ author: @user,
+ assignee: @user,
+ project: project)
+ end
+
before do
- @issue = create(:issue,
- author: @user,
- assignee: @user,
- project: project)
visit project_issues_path(project)
click_link "Edit"
end
it "should open new issue popup" do
- page.should have_content("Issue ##{@issue.id}")
+ page.should have_content("Issue ##{issue.id}")
end
describe "fill in" do
@@ -46,19 +49,18 @@ describe "Issues" do
describe "Search issue", js: true do
before do
['foobar', 'foobar2', 'gitlab'].each do |title|
- @issue = create(:issue,
- author: @user,
- assignee: @user,
- project: project,
- title: title)
- @issue.save
+ create(:issue,
+ author: @user,
+ assignee: @user,
+ project: project,
+ title: title)
end
end
it "should be able to search on different statuses" do
- @issue = Issue.first
- @issue.closed = true
- @issue.save
+ issue = Issue.first # with title 'foobar'
+ issue.closed = true
+ issue.save
visit project_issues_path(project)
click_link 'Closed'
@@ -81,8 +83,9 @@ describe "Issues" do
it "should return all results if term has been cleared" do
visit project_issues_path(project)
fill_in "issue_search", with: "foobar"
- # Because fill_in, with: "" triggers nothing we need to trigger a keyup event
- page.execute_script("$('.issue_search').val('').keyup();");
+ # Reset the search field and trigger loading the issues
+ fill_in "issue_search", with: ""
+ page.execute_script("$('#issue_search').keyup();");
page.should have_content 'foobar'
page.should have_content 'foobar2'
@@ -93,19 +96,21 @@ describe "Issues" do
describe "Filter issue" do
before do
['foobar', 'barbaz', 'gitlab'].each do |title|
- @issue = create(:issue,
- author: @user,
- assignee: @user,
- project: project,
- title: title)
+ create(:issue,
+ author: @user,
+ assignee: @user,
+ project: project,
+ title: title)
end
- @issue = Issue.first
- @issue.milestone = create(:milestone, project: project)
- @issue.assignee = nil
- @issue.save
+ issue = Issue.first # with title 'foobar'
+ issue.milestone = create(:milestone, project: project)
+ issue.assignee = nil
+ issue.save
end
+ let(:issue) { Issue.first }
+
it "should allow filtering by issues with no specified milestone" do
visit project_issues_path(project, milestone_id: '0')
@@ -115,7 +120,7 @@ describe "Issues" do
end
it "should allow filtering by a specified milestone" do
- visit project_issues_path(project, milestone_id: @issue.milestone.id)
+ visit project_issues_path(project, milestone_id: issue.milestone.id)
page.should have_content 'foobar'
page.should_not have_content 'barbaz'
diff --git a/spec/roles/issue_commonality_spec.rb b/spec/roles/issue_commonality_spec.rb
index fc4114e3a77..11f278dea10 100644
--- a/spec/roles/issue_commonality_spec.rb
+++ b/spec/roles/issue_commonality_spec.rb
@@ -15,6 +15,7 @@ describe Issue, "IssueCommonality" do
it { should validate_presence_of(:author) }
it { should validate_presence_of(:title) }
it { should ensure_length_of(:title).is_at_least(0).is_at_most(255) }
+ it { should ensure_inclusion_of(:closed).in_array([true, false]) }
end
describe "Scope" do