Sha256: 426c760429e741df45559aeb259b23c84976950d0cb35e875974e75a1f651e3c

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

  describe "the index page" do

    before :each do
      @<%= singular_name %> = mock_record <%= class_name %>
      @<%= plural_name %> = [@<%= singular_name %>].paginate
      mock(<%= class_name %>).paginate(:page => "100") { @<%= plural_name %> }
    end

    context "in html format" do
      before(:each) { get :index, :page => "100" }
      it { should route(:get, <%= plural_name %>_path).to(:action => :index) }
      it { should respond_with(:success) }
      it { should render_template(:index) }
      it { should_not set_the_flash }
      it { should assign_to(:<%= plural_name %>).with(@<%= plural_name %>) }
      it { should have_link_to(new_<%= singular_name %>_path) }
      it { should have_link_to(edit_<%= singular_name %>_path(@<%= singular_name %>)) }
      it { should have_link_to(<%= singular_name %>_path(@<%= singular_name %>)) }
    end

    context "in xml format" do
      before(:each) do
        mock(@<%= plural_name %>).to_xml { "Generated XML" }
        get :index, :page => "100", :format => "xml"
      end
      it { should route(:get, <%= plural_name %>_path(:format => :xml)).to(:action => :index, :format => :xml) }
      it { should respond_with(:success) }
      it { should respond_with_content_type(:xml) }
      it { should assign_to(:<%= plural_name %>).with(@<%= plural_name %>) }
      specify { response.should have_text("Generated XML") }
    end

  end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iain-pizza-generators-0.1.3 rails_generators/pizza_scaffold/templates/tests/rspec/actions/index.rb
iain-pizza-generators-0.1.4 rails_generators/pizza_scaffold/templates/tests/rspec/actions/index.rb