Commit 4b2ba6cc authored by Coung Ngo's avatar Coung Ngo

Add rspec for _button.html.haml

Added tests to test new logic in _button.html.haml
parent c74f9110
# frozen_string_literal: true
require 'spec_helper'
describe 'projects/issues/import_csv/_button' do
include Devise::Test::ControllerHelpers
context 'when the user is not an admin' do
before do
render
end
it 'shows a dropdown button to import CSV' do
expect(rendered).to have_text('Import CSV')
end
it 'does not show a button to import from Jira' do
expect(rendered).not_to have_text('Import from Jira')
end
end
context 'when the user is an admin' do
before do
allow(view).to receive(:can?).and_return(true)
allow(view).to receive(:project_import_jira_path).and_return('import/jira')
render
end
it 'shows a dropdown button to import CSV' do
expect(rendered).to have_text('Import CSV')
end
it 'shows a button to import from Jira' do
expect(rendered).to have_text('Import from Jira')
end
end
end
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