Sha256: 69ffd68faa98c4d86280c16c9937f67fdebaf699243c4a4d56f98100132c30bd

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

  describe "the new page" do

    before :each do
      @<%= singular_name %> = <%= class_name %>.new
      mock(<%= class_name %>).new { @<%= singular_name %> }
    end

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

    context "in xml format" do

      before :each do
        mock(@<%= singular_name %>).to_xml { "Generated XML" }
        get :new, :format => "xml"
      end

      it { should route(:get, new_<%= singular_name %>_path(:format => :xml)).to(:action => :new, :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/new.rb
iain-pizza-generators-0.1.4 rails_generators/pizza_scaffold/templates/tests/rspec/actions/new.rb