Sha256: 5a33c54d4dd54d6df29a66e2f23a0cb13e376a160af2035d5f99fea4fb95fe90

Contents?: true

Size: 1.48 KB

Versions: 7

Compression:

Stored size: 1.48 KB

Contents

require File.join(File.dirname(__FILE__), "../../spec_helper.rb")

describe Milksteak do
  it "should have milk_root settings" do
    Milksteak::Admin.milk_root.should_not be_nil
  end
  
  context "non-logged-in visitors" do
    it "should redirect to / from /ms-admin" do
      get "/ms-admin"
      last_response.status.should == 302
      get "/ms-admin/"
      last_response.status.should == 302
    end
  end

  context "logged-in users" do
    it "should successfuly render /ms-admin" do
      get "/ms-admin", {}, 'rack.session' => { :ms_user => "bryan-test-user-id" }
      last_response.status.should == 200
    end
  end

end

describe Milksteak::Cms do
  before :all do
    Milksteak::Cms.class_eval("@@pages").should == []
    Milksteak::Page.should_receive(:list).and_return ["./spec/fixtures/pages/sample_page.yml"]
    f = File.open(File.join(File.dirname(__FILE__), "../../fixtures/pages/sample_page.yml"), "r")
    File.should_receive(:new).with("/tmp/milk_site/pages/sample_page.yml", "r").and_return f
    @a = Milksteak::Cms.new(Sinatra::Application)
    @a.load_pages
  end

  it "should pull list of pages and process routes" do
    pages = Milksteak::Cms.class_eval("@@pages")
    pages.length.should == 1
    pages[0].data["route"].should == "/test-page"
  end

  pending "should find and route an existing page with an appropriate route" do
    page = @a.route("/test-page")
    pages.data["route"].should == "/test-page"
  end
  
  it "should not find a page for a non-existant route"
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
milksteak-0.0.11 spec/lib/milksteak/cms_spec.rb
milksteak-0.0.10 spec/lib/milksteak/cms_spec.rb
milksteak-0.0.9 spec/lib/milksteak/cms_spec.rb
milksteak-0.0.8 spec/lib/milksteak/cms_spec.rb
milksteak-0.0.7 spec/lib/milksteak/cms_spec.rb
milksteak-0.0.6 spec/lib/milksteak/cms_spec.rb
milksteak-0.0.4 spec/lib/milksteak/cms_spec.rb