Sha256: 99b2162f53cae6e4c728f10722a5f111e3d8a06a8148e0f4c85b818e18a8e619

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 KB

Contents

require 'rails_helper'

# To run, execute from Dradis main app folder:
#   bin/rspec [dradis-plugins path]/spec/lib/dradis/plugins/content_service/boards_spec.rb
describe Dradis::Plugins::ContentService::Boards do
  let(:plugin)  { Dradis::Plugins::Nessus }
  let(:project) { create(:project) }
  let(:service) do
    Dradis::Plugins::ContentService::Base.new(
      plugin: plugin,
      logger: Rails.logger,
      project: project
    )
  end

  describe 'Boards' do
    describe '#all_boards' do
      it 'returns all the project-level boards' do
        board = create(:board, project: project)
        node = create(:node, project: project)
        node_board = create(:board, node: node, project: project)

        boards = service.all_boards

        expect(boards).to include(board)
        expect(boards).to_not include(node_board)
      end
    end

    describe '#create_board' do
      it 'creates a board without a node' do
        service.create_board(name: 'NodelessBoard')

        expect(project.reload.boards.where(name: 'NodelessBoard')).to_not be_nil
      end

      it 'creates a board with a node' do
        node = create(:node, project: project)
        service.create_board(name: 'NodeBoard', node_id: node.id)

        expect(project.reload.boards.where(name: 'NodeBoard')).to_not be_nil
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
dradis-plugins-4.8.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-4.7.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-4.6.1 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-4.5.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-4.4.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-4.3.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-4.2.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-4.1.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-4.0.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.22.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.21.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.20.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.19.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.18.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.17.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.16.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.15.0 spec/lib/dradis/plugins/content_service/boards_spec.rb
dradis-plugins-3.14.0 spec/lib/dradis/plugins/content_service/boards_spec.rb