require 'spec_helper'
require './features/step_definitions/testing_dsl'

describe "Ignored Groups" do
  # As a developer
  # I want to ignore certain groups
  # So that any gems I use in development, or for testing, are automatically approved for use

  let(:user) { LicenseFinder::TestingDSL::User.new }

  specify "are automatically approved" do
    user.create_ruby_app
    user.create_gem 'dev_gem', license: 'GPL'
    user.depend_on_local_gem 'dev_gem', groups: ['dev']
    user.execute_command 'license_finder ignored_group add dev'

    user.run_license_finder
    expect(user).to_not be_seeing 'dev_gem'
  end

  specify "appear in the CLI" do
    user.create_empty_project
    user.execute_command 'license_finder ignored_group add dev'
    expect(user).to be_seeing 'dev'
    user.execute_command 'license_finder ignored_group list'
    expect(user).to be_seeing 'dev'

    user.execute_command 'license_finder ignored_group remove dev'
    user.execute_command 'license_finder ignored_group list'
    expect(user).to_not be_seeing 'dev'
  end
end

Convert ignored groups integration test to RSpec
Convert ignored groups integration test to RSpec
