Sha256: d48adda91dcdca17fe2a3c2e506bfb97c222078226ed4306a8c1525b19539a03

Contents?: true

Size: 978 Bytes

Versions: 1

Compression:

Stored size: 978 Bytes

Contents

require_relative '../spec_helper.rb'

RSpec.configure do |config|
  config.before(:all){
    #set an example env variable
    ENV["MYDB"] = "sqlite://blog.db" 
  }
end

describe "allow enviroment variables as a connection option" do
  let(:conn_url) { "sqlite://blog.db" }
  context "with ENV[]" do
    context "with quotes" do
      it "returns the corrent connection url" do
        expect(Configuration::check_env_var("ENV[\"MYDB\"]")).to be == conn_url
      end
    end
    context "without quotes" do
      it "returns the corrent connection url" do
        expect(Configuration::check_env_var("ENV[MYDB]")).to be == conn_url
      end
    end
  end
  context "without ENV[]" do
    it "returns the corrent connection url" do
      expect(Configuration::check_env_var("MYDB")).to be == conn_url
    end
  end
  context "normal URL" do
    it "returns the corrent connection url" do
      expect(Configuration::check_env_var(conn_url)).to be == conn_url
    end
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
easycomments-1.0.5 spec/ec/ec_utils_spec.rb