diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-21 18:36:23 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-21 18:36:23 +0000 |
commit | 06cf647c9b1936f55553b88f71c04cb593dfa7ae (patch) | |
tree | 80d3687060c55b5de76dc001b21e51e37913acd7 /spec | |
parent | 603a6abe5a5145f8bb010334c6a82103f40054ec (diff) | |
parent | a3331eee91fdd2170865c37641a88af2b47f9839 (diff) | |
download | gitlab-ce-06cf647c9b1936f55553b88f71c04cb593dfa7ae.tar.gz |
Merge branch 'fix/cycle-analytics-no-data' into 'master'
Adds a flag to reflect whether or not there is data in cycle analytics
See merge request !7622
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/cycle_analytics_controller_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/controllers/projects/cycle_analytics_controller_spec.rb b/spec/controllers/projects/cycle_analytics_controller_spec.rb new file mode 100644 index 00000000000..a971adf0539 --- /dev/null +++ b/spec/controllers/projects/cycle_analytics_controller_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +describe Projects::CycleAnalyticsController do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + sign_in(user) + project.team << [user, :master] + end + + describe 'cycle analytics not set up flag' do + context 'with no data' do + it 'is true' do + get(:show, + namespace_id: project.namespace.to_param, + project_id: project.to_param) + + expect(response).to be_success + expect(assigns(:cycle_analytics_no_data)).to eq(true) + end + end + + context 'with data' do + before do + issue = create(:issue, project: project, created_at: 4.days.ago) + milestone = create(:milestone, project: project, created_at: 5.days.ago) + issue.update(milestone: milestone) + + create_merge_request_closing_issue(issue) + end + + it 'is false' do + get(:show, + namespace_id: project.namespace.to_param, + project_id: project.to_param) + + expect(response).to be_success + expect(assigns(:cycle_analytics_no_data)).to eq(false) + end + end + end +end |