Fix some forum_validations tests

This commit is contained in:
Zequez 2015-08-06 16:01:22 -03:00
parent 4f4c0b5097
commit c18145cb93
2 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,5 @@
- title 'Forum validation' - title 'Forum validation'
- unless @forum_validation.pm_sent? - unless @forum_validation.pm_sent?
= raw I18n.t('forum_validations.show.pm_not_sent') = raw I18n.t('forum_validations.show.pm_not_sent')
@ -14,7 +14,7 @@
%h2 Mods associated: %h2 Mods associated:
%ul.dash-list %ul.dash-list
%li - @forum_validation.author.mods.each do |mod|
- @forum_validation.author.mods.each do |mod| %li
= link_to mod.name, mod = link_to mod.name, mod
= link_to '[Edit]', [:edit, mod] if can?(:edit, mod) = link_to '[Edit]', [:edit, mod] if @forum_validation.validated?

View File

@ -1,9 +1,9 @@
describe 'forum_validations/show', type: :view do describe 'forum_validations/show', type: :view do
before :each do before :each do
@fv = create :forum_validation @fv = create :forum_validation
create :mod, authors: [@fv.author], name: 'Potato' @m1 = create :mod, authors: [@fv.author], name: 'Potato'
create :mod, authors: [@fv.author], name: 'Salad' @m2 = create :mod, authors: [@fv.author], name: 'Salad'
create :mod, authors: [@fv.author], name: 'Simulator' @m3 = create :mod, authors: [@fv.author], name: 'Simulator'
end end
it 'display the list of mods associated with the author' do it 'display the list of mods associated with the author' do
@ -19,6 +19,15 @@ describe 'forum_validations/show', type: :view do
render render
expect(rendered).to include I18n.t('forum_validations.show.not_validated') expect(rendered).to include I18n.t('forum_validations.show.not_validated')
end end
it 'should NOT display links to edit each the mods' do
@fv.validated = false
assign(:forum_validation, @fv)
render
expect(rendered).to_not have_link('', href: edit_mod_path(id: 'potato'))
expect(rendered).to_not have_link('', href: edit_mod_path(id: 'salad'))
expect(rendered).to_not have_link('', href: edit_mod_path(id: 'simulator'))
end
end end
context '#validated = true' do context '#validated = true' do