Commit 34401f4b authored by Felipe Artur's avatar Felipe Artur

Fix specs

parent 5af902eb
......@@ -15,7 +15,7 @@ class Projects::BoardsController < Projects::ApplicationController
def show
@board = project.boards.find(params[:id])
respond_with_boards
respond_with_board
end
private
......
......@@ -41,7 +41,7 @@ module Boards
end
def set_parent
params[:project_id] = parent.id
params[:project_id] = @parent.id
end
def set_state
......
......@@ -23,7 +23,7 @@ FactoryGirl.define do
id = evaluator.parent.id
evaluator.parent.is_a?(Group) ? board.group_id = id : evaluator.project_id = id
else
board.project = create(:empty_project)
board.project = create(:project, :empty_repo)
end
end
......
......@@ -10,30 +10,6 @@ describe 'issue boards', :js do
login_as(user)
end
context 'validations' do
context 'when group is present' do
it 'does not validate project presence' do
group = create(:group)
board = described_class.new(group: group)
expect(board).not_to validate_presence_of(:project)
expect(board).to validate_presence_of(:group)
end
end
context 'when project is present' do
it 'does not validate group presence' do
project = create(:project)
board = described_class.new(project: project)
expect(board).to validate_presence_of(:project)
expect(board).not_to validate_presence_of(:group)
end
end
end
context 'issue board focus mode' do
it 'shows the button when the feature is enabled' do
stub_licensed_features(issue_board_focus_mode: true)
......
......@@ -8,10 +8,15 @@
"properties" : {
"id": { "type": "integer" },
"iid": { "type": "integer" },
"project_id": { "type": ["integer", "null"] },
"title": { "type": "string" },
"confidential": { "type": "boolean" },
"due_date": { "type": ["date", "null"] },
"relative_position": { "type": "integer" },
"project": {
"id": { "type": "integer" },
"path": { "type": "string" }
},
"labels": {
"type": "array",
"items": {
......
require 'spec_helper'
describe Board do
context 'validations' do
context 'when group is present' do
subject { described_class.new(group: create(:group)) }
it { is_expected.not_to validate_presence_of(:project) }
it { is_expected.to validate_presence_of(:group) }
end
context 'when project is present' do
subject { described_class.new(project: create(:project)) }
it { is_expected.to validate_presence_of(:project) }
it { is_expected.not_to validate_presence_of(:group) }
end
end
describe 'milestone' do
subject(:board) { build(:board) }
......
......@@ -8,7 +8,7 @@ describe Boards::Issues::CreateService do
let(:label) { create(:label, project: project, name: 'in-progress') }
let!(:list) { create(:list, board: board, label: label, position: 0) }
subject(:service) { described_class.new(project, user, board_id: board.id, list_id: list.id, title: 'New issue') }
subject(:service) { described_class.new(board.parent, project, user, board_id: board.id, list_id: list.id, title: 'New issue') }
before do
project.team << [user, :developer]
......
......@@ -65,7 +65,7 @@ describe Boards::CreateService, services: true do
describe '#execute' do
it_behaves_like 'boards create service' do
let(:parent) { create(:empty_project) }
let(:parent) { create(:project, :empty_repo) }
end
it_behaves_like 'boards create service' do
......
......@@ -4,8 +4,8 @@ describe Boards::Issues::ListService, services: true do
describe '#execute' do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:empty_project, namespace: group) }
let(:project1) { create(:empty_project, namespace: group) }
let(:project) { create(:project, :empty_repo, namespace: group) }
let(:project1) { create(:project, :empty_repo, namespace: group) }
let(:board) { create(:board, group: group) }
let(:m1) { create(:milestone, group: group) }
......@@ -26,7 +26,7 @@ describe Boards::Issues::ListService, services: true do
let!(:opened_issue1) { create(:labeled_issue, project: project, milestone: m1, title: 'Issue 1', labels: [bug]) }
let!(:opened_issue2) { create(:labeled_issue, project: project, milestone: m2, title: 'Issue 2', labels: [p2]) }
let!(:reopened_issue1) { create(:issue, :reopened, project: project, title: 'Issue 3' ) }
let!(:reopened_issue1) { create(:issue, state: 'opened', project: project, title: 'Issue 3', closed_at: Time.now ) }
let!(:list1_issue1) { create(:labeled_issue, project: project, milestone: m1, labels: [p2, development]) }
let!(:list1_issue2) { create(:labeled_issue, project: project, milestone: m2, labels: [development]) }
......
......@@ -74,7 +74,7 @@ describe Boards::Issues::MoveService, services: true do
issue.reload
expect(issue.labels).to contain_exactly(bug, testing)
expect(issue).to be_reopened
expect(issue.state).to eq("opened")
end
end
......
......@@ -23,7 +23,7 @@ describe Boards::ListService do
end
it_behaves_like 'boards list service' do
let(:parent) { create(:empty_project) }
let(:parent) { create(:project, :empty_repo) }
end
it_behaves_like 'boards list service' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment