Add Thematic structure and Districts - Iss685 - 12 january 2016

This commit is contained in:
nachogomez
2016-01-13 12:11:33 +01:00
parent 51d9d186af
commit bcfe50b41e
2 changed files with 49 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ class Admin::TagsController < Admin::BaseController
respond_to :html, :js
def index
@tags = ActsAsTaggableOn::Tag.order(kind: :asc, featured: :desc).page(params[:page])
@tags = ActsAsTaggableOn::Tag.order(kind: :asc, id: :asc).page(params[:page])
@tag = ActsAsTaggableOn::Tag.new
end
@@ -43,7 +43,9 @@ class Admin::TagsController < Admin::BaseController
@tag = ActsAsTaggableOn::Tag.find(params[:id])
end
def search_tag
@tag = ActsAsTaggableOn::Tag.where("name = '#{@paramTag[:name]}' and
kind = '#{@paramTag[:kind]}'")
# @tag = ActsAsTaggableOn::Tag.where("name = '#{@paramTag[:name]}' and
# kind = '#{@paramTag[:kind]}'")
@tag = ActsAsTaggableOn::Tag.where("upper(name) = upper('#{@paramTag[:name]}')")
end
end

View File

@@ -17,7 +17,6 @@ feature 'Admin tags' do
scenario 'Create' do
visit admin_tags_path
expect(page).to_not have_content 'important issues'
within("form.new_tag") do
@@ -26,7 +25,6 @@ feature 'Admin tags' do
end
visit admin_tags_path
expect(page).to have_content 'important issues'
end
@@ -81,4 +79,48 @@ feature 'Admin tags' do
expect(page).to_not have_content tag2.name
end
scenario 'validate add new tags' do
visit admin_tags_path
expect(page).to_not have_content 'important issues'
within("form.new_tag") do
fill_in "tag_name", with: 'important issues'
click_button 'Create Topic'
end
visit admin_tags_path
within("form.new_tag") do
fill_in "tag_name", with: 'important issues'
click_button 'Create Topic'
end
expect(page).to have_content 'name of the topic already exists'
end
scenario 'validate uppercase name add new tags' do
visit admin_tags_path
expect(page).to_not have_content 'important issues'
within("form.new_tag") do
fill_in "tag_name", with: 'important issues'
click_button 'Create Topic'
end
visit admin_tags_path
within("form.new_tag") do
fill_in "tag_name", with: 'IMPORTANT ISSUES'
click_button 'Create Topic'
end
expect(page).to have_content 'name of the topic already exists'
end
scenario 'validate name new tags' do
visit admin_tags_path
within("form.new_tag") do
click_button 'Create Topic'
end
expect(page).to have_content 'The name of the topic is mandatory filling'
end
end