Sha256: 45ce776b8261c4bfa00789b0b7a62c41ed1976c8637e658c39d4622b74e1c8d2

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'
require_relative 'support'
require 'pp'

describe Nagira do 
  
  set :environment, :test       #  This is potentially desctructive test, run only in  test mode
  include Rack::Test::Methods
  def app 
    @app ||= Nagira
  end

  before :all do 
    get "/_status/_list.json"
    @host = JSON.parse(last_response.body).first
  end

  let (:content_type) {  {'Content-Type' => 'application/json'} }
  let (:host) { @host }
  let (:input) { 
    {
      "status_code" => 0, 
      "plugin_output" => "Plugin said: Bla" 
    }
  }

  # --------------------------------------------
  # Tests
  #

  context "/_status" do
    it { pending "Not implemented" }
  end                           # ----------- "/_status" do

  context "/_status/:host_name" do
    let (:url) { "/_status/#{host}"}

    before (:each) do 
      put url, input.to_json, content_type
    end

    it_should_behave_like :put_status

    it "should fail with missing data" do
      input.keys.each do |key|
        (inp = input.dup).delete key
        put url, inp.to_json, content_type
        last_response.status.should eq 400
      end
    end

    context "/_host_status/:host_name" do
      it { pending "Not implemented" }
    end                         # ----------- "/_host_status/:host_name" 


  end                           #  ----------- /_status/:host

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nagira-0.3.3 spec/put/host_spec.rb
nagira-0.3.2 spec/put/host_spec.rb
nagira-0.3.1 spec/put/host_spec.rb
nagira-0.3.0 spec/put/host_spec.rb
nagira-0.2.12 spec/put/host_spec.rb