Sha256: b04249190f0510d2bc40a592025b29467856ebc10d7f1e4fa827626f90b105ec
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
# frozen_string_literal: true require File.expand_path('spec_helper', __dir__) module Danger describe Danger::DangerSpecPostfix do it 'is a plugin' do expect(described_class.new(nil)).to be_a Danger::Plugin end describe 'with Dangerfile' do subject do @spec_postfix.lint(options) @spec_postfix.status_report[:warnings] end let(:message) { 'Tests should have `_spec` postfix' } let(:scope) { %r{spec/} } let(:match) { %r{_spec.rb$} } let(:options) do { message: message, scope: scope, match: match } end before do @spec_postfix = testing_dangerfile.spec_postfix allow(@spec_postfix.git).to receive(:added_files).and_return([]) allow(@spec_postfix.git).to receive(:modified_files).and_return([file_path]) end context 'when match' do let(:file_path) { 'spec/some_test_spec.rb' } it { is_expected.to be_empty } end context 'when not match' do let(:file_path) { 'spec/some_test.rb' } it { is_expected.to eq(["#{message}: #{file_path}"]) } context 'with exception' do let(:options) do { message: message, scope: scope, match: match, exception: exception } end let(:file_path) { 'spec/spec_helper.rb' } let(:exception) { Regexp.union(%r{spec/factories}, %r{spec_helper.rb}) } it { is_expected.to be_empty } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
danger-spec_postfix-0.0.6 | spec/spec_postfix_spec.rb |
danger-spec_postfix-0.0.5 | spec/spec_postfix_spec.rb |