Sha256: 7ebbe63cfea57430f24cbe97308b7b1510885eb76f5ed482a04d54cbc8a89840

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

  describe "the show page" do

    before :each do
      @<%= singular_name %> = mock_record <%= class_name %>
    end

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

    context "in xml format" do
      before(:each) do
        mock(@<%= singular_name %>).to_xml { "Generated XML" }
        get :show, :id => @<%= singular_name %>.to_param, :format => "xml"
      end
      it { should route(:get, <%= singular_name %>_path(@<%= singular_name %>, :format => :xml)).to(:action => :show, :id => @<%= singular_name %>.to_param, :format => :xml) }
      it { should respond_with(:success) }
      it { should respond_with_content_type(:xml) }
      it { should assign_to(:<%= singular_name %>).with(@<%= singular_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/show.rb
iain-pizza-generators-0.1.4 rails_generators/pizza_scaffold/templates/tests/rspec/actions/show.rb