Sha256: 2bc8b94194686a3e905f0419f0c348090cffca3748ad6d5f5dd99dbe4ddd7ef5

Contents?: true

Size: 1.59 KB

Versions: 2

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

describe Noumenon do
  before(:each) do
    Noumenon.config.dependencies_path = fixture_path("static_example_dependencies")
  end
  
  specify { Noumenon.should respond_to(:boot) }
  
  def app
    Noumenon.boot
  end
  
  describe "serving theme assets" do
    it "serves the asset specified at /themes/theme_name/example.txt if the file exists" do
      get '/themes/example/example.txt'

      last_response.status.should == 200
      last_response.body.should == fixture("static_example_dependencies/themes/example/assets/example.txt")
    end

    it "returns a status of 404 if the file does not exist" do
      get '/themes/example/not_found.png'

      last_response.status.should == 404
    end
  end

  describe "setting configuration" do
    before(:each) do
      Noumenon.config = nil
    end
    
    specify { Noumenon.should respond_to(:configure) }
    specify { Noumenon.should respond_to(:config) }
    specify { Noumenon.should respond_to(:config=) }

    it "sets config to the provided object on config=" do
      config = Noumenon::Configuration.new
      Noumenon.config = config
      Noumenon.config.should == config
    end

    it "returns a new config instance if no config was previously set" do
      Noumenon.config.should be_instance_of Noumenon::Configuration
    end

    it "yields the config instance if a block is provided" do
      yielded = false

      config = Noumenon::Configuration.new
      Noumenon.config = config
      Noumenon.configure do |c|
        c.should == config
        yielded = true
      end

      yielded.should be_true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
noumenon-0.0.2 spec/noumenon_spec.rb
noumenon-0.0.1 spec/noumenon_spec.rb