Sha256: cc4937701fc5a93cd5ad3110f02267ffa2bce41480bc1bfa936cd601048ac00b

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe "Daigaku module" do

  describe "::config" do

    subject { Daigaku.config }

    [:config, :configure, :start].each do |method|
      it "responds to ::#{method}" do
        expect(Daigaku.singleton_methods).to include method
      end
    end

    it "returns Configuration of class Daigaku::Configuration" do
      expect(subject).to be_an_instance_of Daigaku::Configuration
    end

    it "returns a singleton setting" do
      expect(subject).to be Daigaku.config
    end
  end

  describe "::configure" do

    let(:configure) do
      proc do
        Daigaku.configure do |config|
          config.solutions_path = test_basepath
        end
      end
    end

    it "allows to configure the app" do
      expect { configure.call }.not_to raise_error
    end

    it "sets configutation properties" do
      configure.call
      expect(Daigaku.config.solutions_path).to eq test_basepath
    end

    it "allows to change the config during runtime" do
      Daigaku.configure do |config|
        config.solutions_path = courses_basepath
      end

      expect(Daigaku.config.solutions_path).to eq courses_basepath
    end
  end

  describe "::database" do
    it "returns a Diagaku::Database instance" do
      expect(Daigaku.database).to be_a Daigaku::Database
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
daigaku-0.0.2 spec/daigaku_spec.rb
daigaku-0.0.1 spec/daigaku_spec.rb