Sha256: 8263af0b94bda82990a3fb82daf8d2ce35773ea89c20fe670c469ebc98134504

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

require "spec_helper"

describe StyleGuide::StyleController do
  let(:temp_path) { Dir.mktmpdir }
  let(:partial_path) { File.join(temp_path, "monkey_hammer") }

  before do
    FileUtils.mkdir_p(partial_path)
    StyleGuide::Engine.config.style_guide.paths = "#{temp_path}/*"
  end

  describe "#index" do
    it "assigns sections" do
      get :index, use_route: :styles
      assigns(:sections).should be
      assigns(:sections).should have(1).section
      assigns(:sections).first.should be_a StyleGuide::Section
    end

    it "sets the current section to the first one" do
      get :index, use_route: :styles
      assigns(:current_section).should == assigns(:sections).first
      assigns(:current_section).title.should == "Monkey Hammer"
    end
  end

  describe "#show" do
    it "assigns sections" do
      get :show, id: "monkey_hammer", use_route: :styles
      assigns(:sections).should be
      assigns(:sections).should have(1).section
      assigns(:sections).first.should be_a StyleGuide::Section
    end

    it "assigns the section" do
      get :show, id: "monkey_hammer", use_route: :styles
      assigns(:current_section).should be_a StyleGuide::Section
      assigns(:current_section).title.should == "Monkey Hammer"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
style-guide-1.1.1 spec/controllers/style_guide/style_controller_spec.rb
style-guide-1.1.0 spec/controllers/style_guide/style_controller_spec.rb
style-guide-1.0.0 spec/controllers/style_guide/style_controller_spec.rb
style-guide-0.7.4 spec/controllers/style_guide/style_controller_spec.rb
style-guide-0.7.3 spec/controllers/style_guide/style_controller_spec.rb
style-guide-0.7.2 spec/controllers/style_guide/style_controller_spec.rb
style-guide-0.7.0 spec/controllers/style_guide/style_controller_spec.rb