Skip to content

Commit

Permalink
All tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
gaspard committed May 1, 2012
1 parent f8164ef commit 7e21aad
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
*.swp
*.gem
.rbenv-version
restart.txt
config/deploy_config.rb
config/database.yml
Expand Down Expand Up @@ -34,4 +35,4 @@ vendor/plugins/rubyless
vendor/plugins/versions
vendor/plugins/yamltest
vendor/plugins/zafu
send.sftp
send.sftp
3 changes: 2 additions & 1 deletion app/models/text_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class TextDocument < Document
class << self
# Return true if a new text document can be created with the content_type. Used by the superclass Document to choose the corret subclass when creating a new object.
def accept_content_type?(content_type)
(content_type =~ /^(text)/ && Zena::TYPE_TO_EXT[content_type.chomp] != ['rtf']) || (content_type =~ /x-javascript/)
(content_type =~ /^(text|image\/svg\+xml|x-javascript)/) &&
(Zena::TYPE_TO_EXT[content_type.chomp] != ['rtf'])
end

# Return true if the content_type can change independantly from the file
Expand Down
2 changes: 1 addition & 1 deletion bricks/grid/lib/bricks/grid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def make_table(opts)
module ZafuMethods
def r_grid
attr = @params[:attr]
raise parser_error("Missing 'attr' parameter") unless attr
return parser_error("Missing 'attr' parameter") unless attr
# Make sure it compiles
code = RubyLess.translate(node(Node).klass, attr)
msg = RubyLess.translate(self, "t('type to edit')")
Expand Down
1 change: 0 additions & 1 deletion lib/zena/use/display.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ def show_link(link, opt={})
return nil unless visitor.is_admin?
link_to_with_state(_('acls'), acls_path)
when 'jobs'
puts Bricks::CONFIG['worker'].inspect
return nil unless visitor.is_admin? && Bricks::CONFIG['worker']
link_to_with_state(_('jobs'), jobs_site_path(current_site[:id]))
when 'dev'
Expand Down
4 changes: 2 additions & 2 deletions test/functional/acls_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AclsControllerTest < Zena::Controller::TestCase

should 'respond missing' do
assert_difference('Acl.count', 0) do
post :create, :acl => { :query => 'assigned_project', :group_id => groups_id(:sky) }
post :create, :acl => { :query => '%q{assigned_project}', :group_id => groups_id(:sky) }
end

assert_response :missing
Expand All @@ -45,7 +45,7 @@ class AclsControllerTest < Zena::Controller::TestCase

should 'create acl' do
assert_difference('Acl.count', 1) do
post :create, :acl => { :query => 'assigned_project', :group_id => groups_id(:sky) }
post :create, :acl => { :query => '%q{assigned_project}', :group_id => groups_id(:sky) }
end
end
end # with admin rights
Expand Down
8 changes: 4 additions & 4 deletions test/functional/nodes_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class NodesControllerTest < Zena::Controller::TestCase
should 'succeed' do
post_subject
node = assigns(:node)
assert_redirected_to "/oo/blog#{node.zip}.html"
assert_redirected_to "/oo/blog#{node.zip}.html?new=true"
end

should 'set type and vclass' do
Expand Down Expand Up @@ -527,9 +527,9 @@ class NodesControllerTest < Zena::Controller::TestCase
{:action => 'create', :controller => 'nodes', :node => {:parent_id => nodes_zip(:zena), :title => 'hello'}, :mode => 'info'}
end

should 'redirect to node with mode' do
should 'redirect to node with mode with new' do
post_subject
assert_redirected_to "/oo/page#{assigns(:node).zip}_info.html"
assert_redirected_to "/oo/page#{assigns(:node).zip}_info.html?new=true"
end
end # with a redir param
end # creating a node
Expand Down Expand Up @@ -901,7 +901,7 @@ def test_crop_image
img = secure!(Node) { nodes(:bird_jpg) }
assert_not_equal pub_version_id, img.version.id
assert_not_equal pub_content_id, img.version.attachment.id
assert_equal 2010, img.size
assert_equal 2002, img.size
assert_equal 160, img.width
assert_equal 80, img.height
end
Expand Down
10 changes: 7 additions & 3 deletions test/integration/query_node/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ project:
sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.id = ? ORDER BY nodes.zip ASC}, @node.get_project_id]"
res: 'Clean Water project'

min:
src: "nodes where created_at.min = 2006 in site group by project_id"
sql: "%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND MIN(nodes.created_at) = 2006 GROUP BY nodes.project_id ORDER BY nodes.zip ASC}"
date_year:
src: "nodes where created_at = 2006 in site"
# sql: "%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} GROUP BY nodes.project_id HAVING MIN(nodes.created_at) = 2006 ORDER BY nodes.zip ASC}"
res: ""

min:
src: "nodes select created_at.min as mat in site group by project_id"
sql: "%Q{SELECT nodes.*,MIN(nodes.created_at) AS `mat` FROM nodes WHERE #{secure_scope('nodes')} GROUP BY nodes.project_id ORDER BY nodes.zip ASC}"

many_alternatives:
src: tagged in site or images in site or tags in site
sql: "%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND ((nodes.id = links.source_id AND links.relation_id = _ID(node_has_tags)) OR (nodes.kpath LIKE 'NDI%' AND links.id = 0) OR (nodes.kpath LIKE 'NPT%' AND links.id = 0)) GROUP BY nodes.id ORDER BY nodes.zip ASC}"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/zafu_compiler/forms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_btn:
<tr do='each'><td do='title'/></tr>
<tr do='add'><td><b><r:add_btn/></b></td></tr>
</table>"
res: "/<tr class='btn_add' id='list1_add'><td><b><a href='javascript:void(0)' onclick/"
res: "/<tr class='btn_add' id='list1_add'><td><b><a href='javascript:void\(0\)' onclick/"

form_put:
# default should be a put method
Expand Down
4 changes: 0 additions & 4 deletions test/integration/zafu_compiler/roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ grid_manual:
</table>
res: "/<th colspan='3'>Node.*<th colspan='3'>Original.*<th>exif</th><th>height</th><th>width</th>.*<td>image/jpeg</td><td>jpg</td>/"

grid:
src: "<r:images in='site' do='grid'/>"
res: "/<table class='grid'>.*<th class='role' colspan='3'>Node.*<th class='role' colspan='3'>Original.*<th>exif</th><th>height</th><th>width</th>.*<td>image/jpeg</td><td>jpg</td>/"

list_relations:
src: "<r:Contact do='relations' do='each' join=', ' do='name'/>"
res: "collaborator_for, favorite, favorite_for, home_for, hot_for, icon, reference, reference_for, set_tag"
Expand Down
3 changes: 1 addition & 2 deletions test/unit/zena/use/zazen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ def test_translate_ids

def test_table_asset
login(:tiger)
assert_match %r{<table.*<tr.*<th>title</th.*<tr.*value}m, zazen("This is a table test:\n\n|shopping_list|")
assert_match %r{<table.*<th>problem</th>.*<th>solution</th>.*<th>cost</th>.*<tr>.*<td>dead hard drive</td>}m, zazen("This is a table test:\n\n|problems|")
assert_match %r{<table data-a='node\[shopping_list\]'.*class='grid'}m, zazen("This is a table test:\n\n|shopping_list|")
end

# only works if recaptcha plugin is installed
Expand Down

0 comments on commit 7e21aad

Please sign in to comment.