rspec_rails_scaffold_templates 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ab917e3778d83572e0494b9c38c73c39a3ccae3
4
- data.tar.gz: ff92ff555c659a2002f45431946734b9536f1704
3
+ metadata.gz: 574dccfbb1aa994597a59b926863f12c79cc50bf
4
+ data.tar.gz: 556bcf59ec0e2f1e422770eb570596641b91335a
5
5
  SHA512:
6
- metadata.gz: 6de2ecd958d26af84a1bb9c521c5034a6429b8d73cf93788039cb6504dd06ab789f2884978dba14705c9a42c1f933f5003c800d6700ef25f1c0000c9a3457801
7
- data.tar.gz: dc09e7fc53508e40148dbf6d25afb3d501dff9080634c28435c619cb2dfe527c8b3950ecb8ef240cf1f6fbd4bdffa3c0c3fc8db981b416386ccdd916e35c993c
6
+ metadata.gz: 8f65db632c50e3248d3eb4555ab5968921e49e928a0046490301cf0545a3d27a78740b061c16fe922a8b489a2f41c23407e75522a6dd2374f91665e9741d2d9e
7
+ data.tar.gz: a06e96d81c18c2576d944071df4823b60756c3275a099799250be7174e86199d4069de57b709782514d4e60b1d47004765201cea4ff292c3edddf06025500f93
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -21,7 +21,7 @@ describe <%= controller_class_name %>Controller, type: :controller do
21
21
  <% attribute_name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name -%>
22
22
  <% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_girl -%>
23
23
  <% factory_girl = true -%>
24
- let(:valid_attributes) {FactoryGirl.build(:<%=file_name%>).attributes.slice *%w[<%= attribute_name %>]}
24
+ let(:valid_attributes) {FactoryGirl.attributes_for(:<%=file_name%>).slice *%w[<%= attribute_name %>].map(&:to_sym)}
25
25
  <% else -%>
26
26
  <% factory_girl = false -%>
27
27
  let(:valid_attributes) do
@@ -14,48 +14,31 @@ describe "<%= ns_table_name %>/index", type: :view do
14
14
  # options[:fixture_replacement] == :factory_girl
15
15
  <% end -%>
16
16
  <% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_girl -%>
17
- <% size = 1 -%>
18
17
  @<%= ns_file_name %> = create(:<%= ns_file_name %>)
19
- <% if not defined? Wice::WiceGrid -%>
20
- assign(:<%= table_name %>, [@<%= ns_file_name %>, @<%= ns_file_name %>])
21
- <% size = 2 -%>
22
- <% end -%>
23
- <% else -%>
24
- <% size = 2 -%>
25
- <% if defined? Wice::WiceGrid -%>
26
- result_set = assign(:<%= table_name %>, [
27
- <% else -%>
28
- assign(:<%= table_name %>, [
29
- <% end -%>
30
- # if you got an exception here add gem 'rspec-activemodel-mocks' to your Gemfile
31
- <% [1,2].each_with_index do |id, model_index| -%>
32
- <%= class_name %>.create(<%= output_attributes.empty? ? (model_index == 1 ? ')' : '),') : '' %>
18
+ <% else # no factory_girl -%>
19
+ <%= class_name %>.create(<%= output_attributes.empty? ? ')' : '' %>
33
20
  <% output_attributes.each_with_index do |attribute, attribute_index| -%>
34
- <%= attribute.name %>: <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
21
+ <%= attribute.name %>: <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
35
22
  <% end -%>
36
23
  <% if !output_attributes.empty? -%>
37
- <%= model_index == 1 ? ')' : '),' %>
38
- <% end -%>
24
+ )
39
25
  <% end -%>
40
- ])
41
26
  <% end -%>
27
+ assign :<%= table_name %>, <%= class_name %>.all
42
28
  end
43
29
 
44
30
  it "renders a list of <%= table_name %>" do
45
- <% if defined? Wice::WiceGrid -%>
46
- assign :<%= table_name %>, [@<%= ns_file_name %>]
47
- <% end -%>
48
31
  render
49
32
 
50
33
  <% for attribute in output_attributes -%>
51
34
  <% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_girl -%>
52
35
  <% if attribute.reference? -%>
53
- assert_select 'tr>td', text: @<%= ns_file_name %>.<%= attribute.name %>.name, count: <%= size %>
36
+ assert_select 'tr>td', text: @<%= ns_file_name %>.<%= attribute.name %>.name, count: 1
54
37
  <% else -%>
55
- assert_select 'tr>td', text: @<%= ns_file_name %>.<%= attribute.name %>.to_s, count: <%= size %>
38
+ assert_select 'tr>td', text: @<%= ns_file_name %>.<%= attribute.name %>.to_s, count: 1
56
39
  <% end -%>
57
40
  <% else -%>
58
- assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: <%= size %>
41
+ assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: 1
59
42
  <% end -%>
60
43
  <% end -%>
61
44
  end
@@ -68,12 +51,12 @@ describe "<%= ns_table_name %>/index", type: :view do
68
51
  <% for attribute in output_attributes -%>
69
52
  <% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_girl -%>
70
53
  <% if attribute.reference? -%>
71
- assert_select 'tr>td', text: @<%= ns_file_name %>.<%= attribute.name %>.name, count: <%= size %>
54
+ assert_select 'tr>td', text: @<%= ns_file_name %>.<%= attribute.name %>.name, count: 1
72
55
  <% else -%>
73
- assert_select 'tr>td', text: @<%= ns_file_name %>.<%= attribute.name %>.to_s, count: <%= size %>
56
+ assert_select 'tr>td', text: @<%= ns_file_name %>.<%= attribute.name %>.to_s, count: 1
74
57
  <% end -%>
75
58
  <% else -%>
76
- assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: <%= size %>
59
+ assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: 1
77
60
  <% end -%>
78
61
  <% end -%>
79
62
  end
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: rspec_rails_scaffold_templates 1.2.0 ruby lib
5
+ # stub: rspec_rails_scaffold_templates 1.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "rspec_rails_scaffold_templates"
9
- s.version = "1.2.0"
9
+ s.version = "1.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_rails_scaffold_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff