Sha256: 6a061b0342ded6159fe805c65d460aa6bd40bdcaa98bea07735c6215f78ccf35

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Squall::Whitelist do
  before(:each) do
    @whitelist = Squall::Whitelist.new
    @valid = {ip: "192.168.1.1"}
  end

  describe "#list" do
    use_vcr_cassette "whitelist/list"

    it "returns a user's whitelists" do
      whitelists = @whitelist.list(1)
      whitelists.should be_an(Array)
    end

    it "contains the whitelists data" do
      whitelists = @whitelist.list(1)
      whitelists.all? {|w| w.is_a?(Hash) }.should be_true
    end
  end

  describe "#show" do
    use_vcr_cassette "whitelist/show"

    it "returns a whitelist" do
      whitelist = @whitelist.show(1, 2)
      whitelist.should be_a(Hash)
    end
  end

  describe "#create" do
    use_vcr_cassette "whitelist/create"

    it "creates a whitelist for a user" do
      @whitelist.create(1, @valid)
      @whitelist.success.should be_true
    end
  end

  describe "#edit" do
    use_vcr_cassette "whitelist/edit"

    it "edits a whitelist" do
      @whitelist.edit(1, 1, description: "This is actually a different computer.")
      @whitelist.success.should be_true
    end
  end

  describe "#delete" do
    use_vcr_cassette "whitelist/delete"

    it "deletes a whitelist" do
      @whitelist.delete(1, 1)
      @whitelist.success.should be_true
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
squall-1.4.0 spec/squall/whitelist_spec.rb
squall-1.3.1 spec/squall/whitelist_spec.rb