Sha256: e47782777518b99fff7f6cc8fd544af6cbcf42fbc3b027f3a6464fd2ba6ea609

Contents?: true

Size: 789 Bytes

Versions: 2

Compression:

Stored size: 789 Bytes

Contents

RSpec.describe Owners::CLI do
  describe "for" do
    subject { capture { command } }
    let(:command) { described_class.start(args) }
    let(:args) { ["for", "example/app/controllers/users_controller.rb"] }

    def capture
      stdout = $stdout
      $stdout = StringIO.new
      yield
      $stdout.string
    ensure
      $stdout = stdout
    end

    context "without a specified file" do
      it "parses owners correctly" do
        expect(subject).to eq("@org/auth\n@org/blog\n")
      end
    end

    context "with a specified file" do
      before { args << "--file" << "SOMETHING_ELSE" }

      it "overrides the default OWNERS filename" do
        begin
          expect(subject).to eq("")
        ensure
          Owners.file = nil
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
owners-0.0.3 spec/owners_cli_spec.rb
owners-0.0.2 spec/owners_cli_spec.rb