Sha256: 27c3678cbefcf5d3d157418baf2d91f91b2188388be917341e0e72b6d054592f

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 Bytes

Contents

require 'rails_helper'

<% output_attributes = model.columns.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
RSpec.describe "<%= ns_table_name %>/new", <%= type_metatag(:view) %> do
  <%= model.factory_girl_let_definitions %>
  before(:each) do
    assign(:<%= ns_file_name %>, <%= model.factory_girl_build %>)
  end

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

    assert_select "form[action=?][method=?]", <%= index_helper %>_path, "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/new_spec.rb
model_base_generators-0.2.1 lib/templates/rspec/scaffold/new_spec.rb
model_base_generators-0.2.0 lib/templates/rspec/scaffold/new_spec.rb