Sha256: 88763754989ca28b5624270ff63f15d0d5470d981215ac6a6f4a353dc73977c6

Contents?: true

Size: 753 Bytes

Versions: 8

Compression:

Stored size: 753 Bytes

Contents

require File.expand_path("helper", File.dirname(__FILE__))

test "settings is an empty hash by default" do
  assert Cuba.settings.kind_of?(Hash)
  assert Cuba.settings.empty?
end

test "is inheritable and allows overriding" do
  Cuba.settings[:foo] = "bar"

  class Admin < Cuba; end

  assert_equal "bar", Admin.settings[:foo]

  Admin.settings[:foo] = "baz"

  assert_equal "bar", Cuba.settings[:foo]
  assert_equal "baz", Admin.settings[:foo]
end

test do
  Cuba.settings[:hello] = "Hello World"

  Cuba.define do
    on default do
      res.write settings[:hello]
    end
  end

  _, _, resp = Cuba.call({ "PATH_INFO" => "/", "SCRIPT_NAME" => ""})

  body = []

  resp.each do |line|
    body << line
  end

  assert_equal ["Hello World"], body
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cuba-3.0.1.rc2 test/settings.rb
cuba-3.0.1.rc1 test/settings.rb
cuba-3.0.0 test/settings.rb
cuba-3.0.0.rc5 test/settings.rb
cuba-3.0.0.rc4 test/settings.rb
cuba-3.0.0.rc3 test/settings.rb
cuba-3.0.0.rc2 test/settings.rb
cuba-3.0.0.rc1 test/settings.rb