Sha256: e2b240ec18208a288c9a1e0a7f68aca796d0c46de5d6a226e1272ab5a3b33369

Contents?: true

Size: 1.99 KB

Versions: 1

Compression:

Stored size: 1.99 KB

Contents

require 'spec_helper'
require 'rack/test'
require 'heidi/web'

describe Heidi::Web do
  before :all do
    fake_me_a_heidi
  end

  before :each do
    Heidi::Web.stub(:project_path).and_return(@fake)
    @project = @heidi[:heidi_test]
    @project.name = "Heidi Test Project on the web"
  end

  after :all do
    FileUtils.remove_entry_secure @fake
  end

  include Rack::Test::Methods

  def app
    Heidi::Web
  end

  it "should show a homepage" do
    get '/'
    last_response.status.should == 200
    last_response.body.should =~ /Heidi/
  end

  it "should display the projects on the homepage" do
    get '/'
    last_response.status.should == 200
    last_response.body.should =~ /heidi_test/
  end

  it "should display a project creation form" do
    get '/projects/'
    last_response.status.should == 200
  end

  it "should display the project page" do
    get '/projects/heidi_test'
    last_response.status.should == 200
    last_response.body.should =~ /<h1>Heidi Test Project on the web<\/h1>/
  end

  it "should display the configuration page" do
    get '/projects/heidi_test/configure'
    last_response.status.should == 200
    last_response.body.should =~ /Configuration/
  end

  describe "Project internals" do
    before :each do
      @project.integrate
    end

    it "should display a build" do
      get "/projects/heidi_test/build/#{@project.builds.last.commit}"
      last_response.status.should == 200

      title = Regexp.new("<h2 class=[^>]+>build #{@project.builds.last.commit}</h2>", true)
      last_response.body.should =~ title
    end

    it "should display a commit" do
      get "/projects/heidi_test/commit/#{@project.commit}"
      last_response.status.should == 200
      last_response.body.should =~ Regexp.new("<h2>#{@project.commit}</h2>")

      author = @project.author.gsub("<", "&lt;")
      author.gsub!(">", "&gt;")
      check = Regexp.new("Author: #{author}")
      last_response.body.should =~ check
    end

    it "should be able to lock the project" do
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heidi-0.4.0 spec/heidi/web_spec.rb