Commit 7750bb37d186eba4f307675096600cf23ee214aa

Authored by Junior Silva
1 parent debcfb2a

fix comment_classification plugin

lib/tasks/plugins_tests.rake
@@ -108,7 +108,7 @@ def run_test(name, files) @@ -108,7 +108,7 @@ def run_test(name, files)
108 files = Array(files) 108 files = Array(files)
109 plugin = filename2plugin(files.first) 109 plugin = filename2plugin(files.first)
110 if name == :cucumber || name == :selenium 110 if name == :cucumber || name == :selenium
111 - run_cucumber task2_profile(name, plugin), files 111 + run_cucumber task2profile(name, plugin), files
112 else 112 else
113 run_testrb files 113 run_testrb files
114 end 114 end
@@ -136,7 +136,11 @@ end @@ -136,7 +136,11 @@ end
136 136
137 def run_tests(name, plugins, run=:all) 137 def run_tests(name, plugins, run=:all)
138 plugins = Array(plugins) 138 plugins = Array(plugins)
  139 + if name == :cucumber || name == :selenium
  140 + glob = "plugins/{#{plugins.join(',')}}/#{task2folder(name)}/**/*.#{task2ext(name)}"
  141 + else
139 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}" 142 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}"
  143 + end
140 files = Dir.glob(glob) 144 files = Dir.glob(glob)
141 if files.empty? 145 if files.empty?
142 puts "I: no tests to run #{name}" 146 puts "I: no tests to run #{name}"
plugins/comment_classification/features/step_definitions/plugin_steps.rb
1 Given /^CommentClassificationPlugin is enabled$/ do 1 Given /^CommentClassificationPlugin is enabled$/ do
2 - step %{I am logged in as admin}  
3 - step %{I am on the environment control panel}  
4 - step %{I follow "Plugins"}  
5 - step %{I check "Comment Classification"}  
6 - step %{I press "Save changes"} 2 + steps %Q{
  3 + Given I am logged in as admin
  4 + Given I am on the environment control panel
  5 + Given I follow "Plugins"
  6 + Given I check "Comment Classification"
  7 + Given I press "Save changes"
  8 + }
  9 +
7 Environment.default.enabled_plugins.should include("CommentClassificationPlugin") 10 Environment.default.enabled_plugins.should include("CommentClassificationPlugin")
8 end 11 end
9 12
plugins/comment_classification/lib/comment_classification_plugin.rb
1 -require 'ext/environment'  
2 -require 'ext/comment'  
3 1
4 class CommentClassificationPlugin < Noosfero::Plugin 2 class CommentClassificationPlugin < Noosfero::Plugin
5 3
plugins/comment_classification/lib/ext/comment.rb
1 require_dependency 'comment' 1 require_dependency 'comment'
2 -require 'comment_classification_plugin.rb'  
3 -require 'comment_classification_plugin/label.rb'  
4 2
5 class Comment 3 class Comment
6 4