Commit 9f4717ef481fa3ca2fa4ef614384a943dd1c29ab

Authored by Junior Silva
2 parents 90f4f1c1 7750bb37

Merge branch 'cc-plugin' of https://gitlab.com/juniorsilva1001/noosfero into cc-plugin

lib/tasks/plugins_tests.rake
@@ -105,7 +105,7 @@ def run_test(name, files) @@ -105,7 +105,7 @@ def run_test(name, files)
105 files = Array(files) 105 files = Array(files)
106 plugin = filename2plugin(files.first) 106 plugin = filename2plugin(files.first)
107 if name == :cucumber || name == :selenium 107 if name == :cucumber || name == :selenium
108 - run_cucumber task2_profile(name, plugin), files 108 + run_cucumber task2profile(name, plugin), files
109 else 109 else
110 run_testrb files 110 run_testrb files
111 end 111 end
@@ -133,7 +133,11 @@ end @@ -133,7 +133,11 @@ end
133 133
134 def run_tests(name, plugins, run=:all) 134 def run_tests(name, plugins, run=:all)
135 plugins = Array(plugins) 135 plugins = Array(plugins)
  136 + if name == :cucumber || name == :selenium
  137 + glob = "plugins/{#{plugins.join(',')}}/#{task2folder(name)}/**/*.#{task2ext(name)}"
  138 + else
136 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}" 139 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}"
  140 + end
137 files = Dir.glob(glob) 141 files = Dir.glob(glob)
138 if files.empty? 142 if files.empty?
139 puts "I: no tests to run #{name}" 143 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