Sha256: 4be19a039f8cd9924c7fdb9df4b22abb7836ede1e51756a9d89029eb34e37a6c

Contents?: true

Size: 1.46 KB

Versions: 6

Compression:

Stored size: 1.46 KB

Contents

require "spec_helper"

# Here's we're testing the basics of the module itself,
# the variable that you can set, the actions you can take, etc.

describe "TheBigDB module" do
  it "has accessors for common used global variables" do
    TheBigDB.api_host = "foobar"
    TheBigDB.api_port = 1337
    TheBigDB.api_version = "1337"
    TheBigDB.api_key = "your-private-api-key"
    TheBigDB.raise_on_api_status_error = true
    TheBigDB.before_request_execution = (before_proc = ->(request){ nil })
    TheBigDB.after_request_execution = (after_proc = ->(request){ nil })

    TheBigDB.api_host.should == "foobar"
    TheBigDB.api_port.should == 1337
    TheBigDB.api_version.should == "1337"
    TheBigDB.api_key.should == "your-private-api-key"
    TheBigDB.raise_on_api_status_error.should == true
    TheBigDB.before_request_execution.should == before_proc
    TheBigDB.after_request_execution.should == after_proc

    # use_ssl modifies the port
    TheBigDB.use_ssl = true
    TheBigDB.use_ssl.should == true
  end

  it "has resettable default values" do
    default_host = TheBigDB.api_host.dup
    TheBigDB.api_host = "foobar"
    TheBigDB.reset_default_configuration
    TheBigDB.api_host.should == default_host
  end

  it "can set a configuration scope" do
    TheBigDB.api_host = "thebigdb_host_1"
    TheBigDB.with_configuration(api_host: "thebigdb_host_2") do
      TheBigDB.api_host.should == "thebigdb_host_2"
    end
    TheBigDB.api_host.should == "thebigdb_host_1"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
thebigdb-1.4.1 spec/thebigdb_spec.rb
thebigdb-1.4.0 spec/thebigdb_spec.rb
thebigdb-1.3.0 spec/thebigdb_spec.rb
thebigdb-1.2.3 spec/thebigdb_spec.rb
thebigdb-1.2.2 spec/thebigdb_spec.rb
thebigdb-1.2.1 spec/thebigdb_spec.rb