Sha256: 48b4f91b2970e055b9322625e2c0466bf76fbfd1a39ff01bf4d123d241f352aa

Contents?: true

Size: 732 Bytes

Versions: 3

Compression:

Stored size: 732 Bytes

Contents

require 'rails_helper'

RSpec.describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do
  <%= model.factory_girl_let_definitions %>
  before(:each) do
    @<%= ns_file_name %> = assign(:<%= ns_file_name %>, <%= model.factory_girl_create %>)
  end

  it "renders the edit <%= ns_file_name %> form" do
    render

    assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(@<%= ns_file_name %>), "post" do
<% model.columns_for(:form).each do |attribute| -%>
      <%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name -%>
      assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
<% end -%>
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
model_base_generators-0.2.2 lib/templates/rspec/scaffold/edit_spec.rb
model_base_generators-0.2.1 lib/templates/rspec/scaffold/edit_spec.rb
model_base_generators-0.2.0 lib/templates/rspec/scaffold/edit_spec.rb