diff options
author | Phil Hughes <me@iamphill.com> | 2017-04-28 14:11:30 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-04-28 14:11:30 +0300 |
commit | 7fd3a5883e5a6135873f2e6def9dabf2ab82f361 (patch) | |
tree | c926285f51fa10f26daa886f475c13630ffecab8 /spec/views | |
parent | 064739431a837ea644851f3f3d01f5da6ee05951 (diff) |
Changed spec to a view spec
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/commit/show.html.haml_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/views/projects/commit/show.html.haml_spec.rb b/spec/views/projects/commit/show.html.haml_spec.rb new file mode 100644 index 00000000000..abbdc65ea71 --- /dev/null +++ b/spec/views/projects/commit/show.html.haml_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +describe 'projects/commit/show.html.haml', :view do + let(:user) { create(:user) } + let(:project) { create(:project, :repository) } + + before do + assign(:project, project) + assign(:repository, project.repository) + assign(:commit, project.commit) + assign(:noteable, project.commit) + assign(:notes, []) + assign(:diffs, project.commit.diffs) + + allow(view).to receive(:current_user).and_return(user) + allow(view).to receive(:can?).and_return(false) + allow(view).to receive(:can_collaborate_with_project?).and_return(false) + allow(view).to receive(:current_ref).and_return(project.repository.root_ref) + allow(view).to receive(:diff_btn).and_return('') + end + + context 'inline diff view' do + before do + allow(view).to receive(:diff_view).and_return(:inline) + + render + end + + it 'keeps container-limited' do + expect(rendered).not_to have_selector('.limit-container-width') + end + end + + context 'parallel diff view' do + before do + allow(view).to receive(:diff_view).and_return(:parallel) + + render + end + + it 'spans full width' do + expect(rendered).to have_selector('.limit-container-width') + end + end +end |