Sha256: a87dfd673ed239bc09c26f0c5127464f7a6340ff9b07440b43cf759e6ebe0032

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require 'bundler/setup'
require 'rack/file'
require 'capybara/rspec'
require 'spec_helper'

Capybara.app = Rack::File.new ::Rails.root.to_s

include Rapidoc

describe "Index page" do

  before :all do
    reset_structure
    load_config
    @resources = get_resources
    generate_doc
  end

  before do
    visit '/rapidoc/index.html'
  end

  after :all do
    #remove_doc
  end

  context "when check global page" do
    it "contains an H1 with text 'Resources'" do
      page.should have_css 'h1', :text => 'Resources'
    end

    it "contains Title with text 'Project Name'" do
      page.should have_link('Project Name', '#')
    end
  end

  context "when check resources" do
    it "contains the correct number of resources" do
      page.find(".accordion").should have_content "albums"
      page.find(".accordion").should have_content "images"
      page.find(".accordion").should have_content "users"
    end

    it "contains the correct methods" do
      @resources.each do |resource|
        resource.actions_doc.each do |action|
          action.urls.each do |url|
            if action.has_controller_info
              page.should have_link( url, href: "actions/" + action.file + ".html" )
            else
              page.should have_text( url )
            end
          end
        end
      end
    end

    it "contains the correct description" do
      @resources.each do |resource|
        page.should have_text(resource.description)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapidoc-0.0.4 spec/features/index_spec.rb