Sha256: c2d8970cc80849bea21042131d957789deca3021c436013030d24e76fd3de96c

Contents?: true

Size: 1.22 KB

Versions: 42

Compression:

Stored size: 1.22 KB

Contents

# generado con pg_rails

require 'rails_helper'

<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
RSpec.describe "<%= ruta_vistas %>/new", <%= type_metatag(:view) %> do
  PgEngine::ConfiguradorRSpec.helpers(self)
<% if mountable_engine? -%>
  helper <%= mountable_engine? %>::Engine.routes.url_helpers
<% end -%>

  let(:user) { create(:user, :developer) }

  before(:each) do
    sign_in user
    @<%= singular_name %> = assign(:<%= singular_name %>, build(:<%= nombre_tabla_completo_singular %>).decorate)
    @clase_modelo = assign(:clase_modelo, <%= nombre_clase_completo %>)
  end

  it "renders new <%= ns_file_name %> form" do
    render

    assert_select "form[action=?][method=?]", <%= index_helper %>_path, "post" do
<% for attribute in output_attributes -%>
      <%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
<% if Rails.version.to_f >= 5.1 -%>
      assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]"
<% else -%>
      assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
<% end -%>
<% end -%>
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
pg_rails-7.5.5 pg_scaffold/lib/generators/pg_rspec/scaffold/templates/new_spec.rb
pg_rails-7.5.4 pg_scaffold/lib/generators/pg_rspec/scaffold/templates/new_spec.rb