Permalink
Browse files

Migrate the helpers into the spec class itself

  • Loading branch information...
1 parent e6ae382 commit 4636bda06b5fa42590e073a3d8c9ce8f8ac0eb45 @realityforge committed Dec 11, 2010
Showing with 41 additions and 43 deletions.
  1. +41 −0 spec/buildr/intellij_idea/buildr_iidea_spec.rb
  2. +0 −43 spec/spec_helper.rb
@@ -2,6 +2,47 @@
describe Buildr::IntellijIdea do
+ def invoke_generate_task
+ task('iidea:generate').invoke
+ end
+
+ def invoke_clean_task
+ task('iidea:clean').invoke
+ end
+
+ def root_project_filename(project)
+ project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.ipr")
+ end
+
+ def root_project_xml(project)
+ xml_document(root_project_filename(project))
+ end
+
+ def root_module_filename(project)
+ project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
+ end
+
+ def root_module_xml(project)
+ xml_document(root_module_filename(project))
+ end
+
+ def subproject_module_filename(project, sub_project_name)
+ project._("#{sub_project_name}/#{sub_project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
+ end
+
+ def subproject_module_xml(project, sub_project_name)
+ xml_document(subproject_module_filename(project, sub_project_name))
+ end
+
+ def xml_document(filename)
+ File.should be_exist(filename)
+ REXML::Document.new(File.read(filename))
+ end
+
+ def xpath_to_module
+ "/project/component[@name='ProjectModuleManager']/modules/module"
+ end
+
describe "iidea:clean" do
before do
write "foo.ipr"
View
@@ -33,46 +33,3 @@ def SandboxHook.included(spec_helpers)
end
require File.expand_path(File.dirname(__FILE__) + '/xpath_matchers.rb')
-
-module SpecHelpers
- def invoke_generate_task
- task('iidea:generate').invoke
- end
-
- def invoke_clean_task
- task('iidea:clean').invoke
- end
-
- def root_project_filename(project)
- project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.ipr")
- end
-
- def root_project_xml(project)
- xml_document(root_project_filename(project))
- end
-
- def root_module_filename(project)
- project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
- end
-
- def root_module_xml(project)
- xml_document(root_module_filename(project))
- end
-
- def subproject_module_filename(project, sub_project_name)
- project._("#{sub_project_name}/#{sub_project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
- end
-
- def subproject_module_xml(project, sub_project_name)
- xml_document(subproject_module_filename(project, sub_project_name))
- end
-
- def xml_document(filename)
- File.should be_exist(filename)
- REXML::Document.new(File.read(filename))
- end
-
- def xpath_to_module
- "/project/component[@name='ProjectModuleManager']/modules/module"
- end
-end

0 comments on commit 4636bda

Please sign in to comment.