Sha256: 7b2188603ace4e2399b71c423545d13dd3868e03635d18744cd066e375c272f1

Contents?: true

Size: 1.61 KB

Versions: 2

Compression:

Stored size: 1.61 KB

Contents

#!/usr/bin/env rspec

require 'spec_helper'

require 'uri'
require 'noms/command/application'
require 'noms/command/window'

describe NOMS::Command::Application do

    before(:all) do
        # Start the DNC application web server on port 8787
        setup_fixture
        start_server
    end

    after(:all) do
        stop_server
        teardown_fixture
    end

    describe '.new' do

        context 'with no arguments' do

            before(:each) do
                @app = NOMS::Command::Application.new(
                                                   URI.parse('http://localhost:8787/dnc.json'),
                                                   [])
            end

        end

        it "should produce a usage message" do
            app = NOMS::Command::Application.new('http://localhost:8787/dnc.json',
                                                 ['dnc'])
            app.fetch!
            app.render!
            expect(app.display).to include 'Usage:'
        end

        it "should produce a list of DNC records" do
            app = NOMS::Command::Application.new('http://localhost:8787/dnc.json',
                                                 ['dnc', 'list'])
            app.fetch!
            app.render!
            expect(app.display.split("\n").length).to be > 9
        end

        it "should follow a redirect" do
            app = NOMS::Command::Application.new('http://localhost:8787/alt/dnc.json',
                                                 ['dnc', 'list'])
            app.fetch!
            app.render!
            expect(app.display.split("\n").length).to be > 9
        end

    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
noms-command-2.1.1 spec/04application_spec.rb
noms-command-0.5.0 spec/04application_spec.rb