authorized_rails_scaffolds 0.0.8 → 0.0.9

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.
@@ -18,9 +18,9 @@ references_attributes = t_helper.references_attributes
18
18
  -%>
19
19
  describe "<%= ns_table_name %>/show" do
20
20
  before(:each) do
21
- <%- AuthorizedRailsScaffolds.parent_models.each do |model| -%>
22
- @<%= model.underscore %> = assign(:<%= model.underscore %>, FactoryGirl.build_stubbed(:<%= model.underscore %>))
23
- <%- end -%>
21
+ <%- AuthorizedRailsScaffolds.parent_models.each do |model| -%>
22
+ @<%= model.underscore %> = FactoryGirl.build_stubbed(:<%= model.underscore %>)
23
+ <%- end -%>
24
24
  @<%= var_name %> = FactoryGirl.build_stubbed(:<%= var_name %><%= output_attributes.empty? ? ')' : ',' %>
25
25
  <% output_attributes.each_with_index do |attribute, attribute_index| -%>
26
26
  :<%= attribute.name %> => <%= t_helper.factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
@@ -28,60 +28,68 @@ describe "<%= ns_table_name %>/show" do
28
28
  <% if !output_attributes.empty? -%>
29
29
  )
30
30
  <% end -%>
31
- @ability = Object.new
32
- @ability.extend(CanCan::Ability)
33
- controller.stub(:current_ability) { @ability }
34
31
  end
35
32
 
36
- it "renders attributes in a <dl> as a <dt> and <dd> pair" do
37
- render
33
+ context do # Within default nesting
34
+ before(:each) do
35
+ <%- AuthorizedRailsScaffolds.parent_models.each do |model| -%>
36
+ assign(:<%= model.underscore %>, @<%= model.underscore %>)
37
+ <%- end -%>
38
+ @ability = Object.new
39
+ @ability.extend(CanCan::Ability)
40
+ controller.stub(:current_ability) { @ability }
41
+ end
42
+
43
+ it "renders attributes in a <dl> as a <dt> and <dd> pair" do
44
+ render
38
45
  <% unless webrat? -%>
39
- # Run the generator again with the --webrat flag if you want to use webrat matchers
46
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
40
47
  <% end -%>
41
48
  <% for attribute in output_attributes -%>
42
- <% if webrat? -%>
43
- rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>)
44
- rendered.should have_selector("dl>dd", :content => <%= t_helper.factory_attribute_string attribute.type, value_for(attribute) %>.to_s)
45
- <% else -%>
46
- assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>
47
- assert_select "dl>dd", :text => <%= t_helper.factory_attribute_string attribute.type, value_for(attribute) %>.to_s
49
+ <%- if webrat? -%>
50
+ rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>)
51
+ rendered.should have_selector("dl>dd", :content => <%= t_helper.factory_attribute_string attribute.type, value_for(attribute) %>.to_s)
52
+ <%- else -%>
53
+ assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>
54
+ assert_select "dl>dd", :text => <%= t_helper.factory_attribute_string attribute.type, value_for(attribute) %>.to_s
55
+ <%- end -%>
48
56
  <% end -%>
49
- <% end -%>
50
- end
51
-
52
- <% for attribute in references_attributes -%>
53
- context "with a <%= attribute.name %> reference" do
54
- before(:each) do
55
- @<%= var_name %>.<%= attribute.name %> = FactoryGirl.build_stubbed(:<%= attribute.name %>)
56
57
  end
57
- context 'without read <%= attribute.name.classify %> permissions' do
58
- it "should not a render link to <%= attribute.name %>" do
59
- render
58
+ <% for attribute in references_attributes -%>
59
+
60
+ context "with a <%= attribute.name %> reference" do
61
+ before(:each) do
62
+ @<%= var_name %>.<%= attribute.name %> = FactoryGirl.build_stubbed(:<%= attribute.name %>)
63
+ end
64
+ context 'without read <%= attribute.name.classify %> permissions' do
65
+ it "should not a render link to <%= attribute.name %>" do
66
+ render
60
67
  <% if webrat? -%>
61
- rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>, :count => 0)
62
- rendered.should have_selector("dl>dd>a[href]", :href => <%= t_helper.references_show_route attribute.name %>, :count => 0)
68
+ rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>, :count => 0)
69
+ rendered.should have_selector("dl>dd>a[href]", :href => <%= t_helper.references_show_route attribute.name %>, :count => 0)
63
70
  <% else -%>
64
- assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>, :count => 0
65
- assert_select "dl>dd>a[href=?]", <%= t_helper.references_show_route attribute.name %>, :count => 0
71
+ assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>, :count => 0
72
+ assert_select "dl>dd>a[href=?]", <%= t_helper.references_show_route attribute.name %>, :count => 0
66
73
  <% end -%>
74
+ end
67
75
  end
68
- end
69
- context 'with read <%= attribute.name.classify %> permissions' do
70
- before(:each) do
71
- @ability.can :read, <%= attribute.name.classify %>
72
- end
73
- it "renders a namespaced link to <%= attribute.name %>" do
74
- render
76
+ context 'with read <%= attribute.name.classify %> permissions' do
77
+ before(:each) do
78
+ @ability.can :read, <%= attribute.name.classify %>
79
+ end
80
+ it "renders a namespaced link to <%= attribute.name %>" do
81
+ render
75
82
  <% if webrat? -%>
76
- rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>)
77
- rendered.should have_selector("dl>dd>a[href]", :href => <%= t_helper.references_show_route attribute.name %>, :count => 1)
83
+ rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>)
84
+ rendered.should have_selector("dl>dd>a[href]", :href => <%= t_helper.references_show_route attribute.name %>, :count => 1)
78
85
  <% else -%>
79
- assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>
80
- assert_select "dl>dd>a[href=?]", <%= t_helper.references_show_route attribute.name %>, :count => 1
86
+ assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>
87
+ assert_select "dl>dd>a[href=?]", <%= t_helper.references_show_route attribute.name %>, :count => 1
81
88
  <% end -%>
89
+ end
82
90
  end
83
91
  end
92
+ <% end -%>
84
93
  end
85
94
 
86
- <% end -%>
87
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authorized_rails_scaffolds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-09 00:00:00.000000000Z
12
+ date: 2013-04-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70235954660960 !ruby/object:Gem::Requirement
16
+ requirement: &70305143799400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70235954660960
24
+ version_requirements: *70305143799400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70235954660460 !ruby/object:Gem::Requirement
27
+ requirement: &70305143798900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.3'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70235954660460
35
+ version_requirements: *70305143798900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70235954660080 !ruby/object:Gem::Requirement
38
+ requirement: &70305143798520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70235954660080
46
+ version_requirements: *70305143798520
47
47
  description: Creates scaffolds for Twitter Bootstrap with generated RSpec coverage
48
48
  email:
49
49
  - bemo56@hotmail.com