Sha256: b13873662225cadae2ee6a8d2b7d844ebe38e5acb557f30d1215f6b5142a7a19

Contents?: true

Size: 1.02 KB

Versions: 32

Compression:

Stored size: 1.02 KB

Contents

require 'rails_helper'

<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
RSpec.describe "<%= ns_table_name %>/new", <%= type_metatag(:view) %> do
  before(:each) do
    assign(:<%= ns_file_name %>, <%= class_name %>.new(<%= '))' if output_attributes.empty? %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
      :<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
<% end -%>
<%= !output_attributes.empty? ? "    ))\n  end" : "  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 %>
      assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
<% end -%>
    end
  end
end

Version data entries

32 entries across 32 versions & 7 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/rspec-rails-3.5.2/lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.6.0.beta2 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.6.0.beta1 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.5.2 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.5.1 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.5.0 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.5.0.beta4 lib/generators/rspec/scaffold/templates/new_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rspec-rails-3.4.2/lib/generators/rspec/scaffold/templates/new_spec.rb
silmarails-0.2.2 test/dummy/lib/templates/rspec/scaffold/new_spec.rb
silmarails-0.2.1 test/dummy/lib/templates/rspec/scaffold/new_spec.rb
silmarails-0.2.0 test/dummy/lib/templates/rspec/scaffold/new_spec.rb
silmarails-0.1.1 test/dummy/lib/templates/rspec/scaffold/new_spec.rb
genesis_rails-0.1.1 test/dummy/lib/templates/rspec/scaffold/new_spec.rb
genesis_rails-0.1.0 test/dummy/lib/templates/rspec/scaffold/new_spec.rb
rspec-rails-3.5.0.beta3 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.5.0.beta2 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.5.0.beta1 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.4.2 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.4.1 lib/generators/rspec/scaffold/templates/new_spec.rb
rspec-rails-3.4.0 lib/generators/rspec/scaffold/templates/new_spec.rb