Skip to content

Commit

Permalink
update gems. Problems to change to rspec 2? Necessary refactoring to …
Browse files Browse the repository at this point in the history
…adapt specs to rspec 2
  • Loading branch information
narcisobenigno committed Jun 23, 2012
1 parent 2ca9147 commit fd104a5
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 58 deletions.
26 changes: 21 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,44 @@ PATH
specs:
vraptor-scaffold (1.3.0)
activesupport (= 3.0.1)
rake (= 0.9.2)
rake
thor (= 0.14.6)

GEM
remote: http://rubygems.org/
specs:
ZenTest (4.4.0)
activesupport (3.0.1)
multi_json (1.0.3)
rake (0.9.2)
rspec (1.3.2)
coderay (1.0.6)
diff-lcs (1.1.3)
method_source (0.7.1)
multi_json (1.0.4)
pry (0.9.9.6)
coderay (~> 1.0.5)
method_source (~> 0.7.1)
slop (>= 2.4.4, < 3)
rake (0.9.2.2)
rspec (2.10.0)
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
rspec-mocks (~> 2.10.0)
rspec-core (2.10.1)
rspec-expectations (2.10.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.10.1)
simplecov (0.5.4)
multi_json (~> 1.0.3)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
slop (2.4.4)
thor (0.14.6)

PLATFORMS
ruby

DEPENDENCIES
ZenTest (= 4.4.0)
rspec (= 1.3.2)
pry
rspec
simplecov (= 0.5.4)
vraptor-scaffold!
5 changes: 2 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
require 'simplecov'
require 'pry'
SimpleCov.start

require 'spec'
require 'spec/autorun'
require File.dirname(__FILE__) + '/../lib/vraptor-scaffold'

def build_attributes
Expand All @@ -22,5 +21,5 @@ def mock_objectify_config_file
def exists_and_identical?(source, created)
c = File.open(created).read.gsub( /\r/m, "" )
c2 = File.open(source).read.gsub( /\r/m, "" )
c.should be == c2
c.should == c2
end
85 changes: 39 additions & 46 deletions spec/vraptor-scaffold/generators/plugin/plugin_generator_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
require 'spec_helper'

describe PluginGenerator do

Expand Down Expand Up @@ -29,102 +29,95 @@ def expected_for(name)
context "maven project" do

before :each do
FileUtils.chdir(@maven_projet)
@generator = PluginGenerator.new("vraptor-environment", ["-v=0.0.8"])
@generator.build
back
backup @maven_projet, 'pom.xml'
end

it "should inject dependency into pom.xml" do
it "should inject dependency into pom.xmlwith default" do

This comment has been minimized.

Copy link
@dmartinsid

dmartinsid Jun 25, 2012

Need a space after "pom.xml"

PluginGenerator.new("vraptor-environment", ["-v=0.0.8"]).build
back
source = expected_for "default_org_pom.xml"
destination = "#{@maven_projet}/pom.xml"
exists_and_identical?(source, destination)
end
end

context "maven project with plugin org" do

before :each do
FileUtils.chdir(@maven_projet)
@generator = PluginGenerator.new("vraptor-environment", ["-v=0.0.8", "-g=br.com.caelum.vraptor.plugin"])
@generator.build
it "injects dependency into pom.xml with provided org" do
PluginGenerator.new("vraptor-environment", ["-v=0.0.8", "-g=br.com.caelum.vraptor.plugin"]).build
back
end

it "should inject dependency into pom.xml" do
source = expected_for "pom.xml"
destination = "#{@maven_projet}/pom.xml"
exists_and_identical?(source, destination)
end

after :each do
rollback @maven_projet, 'pom.xml'
end
end

context "ant project" do

before :each do
FileUtils.chdir(@ant_projet)
@generator = PluginGenerator.new("vraptor-environment", ["-v=0.0.8"])
@generator.build
back
backup @ant_projet, 'ivy.xml'
end

it "should inject dependency into ivy.xml" do
it "should inject dependency into ivy.xml with default org" do
PluginGenerator.new("vraptor-environment", ["-v=0.0.8"]).build
back
source = expected_for "default_org_ivy.xml"
destination = "#{@ant_projet}/ivy.xml"
exists_and_identical?(source, destination)
end
end

context "ant project with plugin org" do

before :each do
FileUtils.chdir(@ant_projet)
@generator = PluginGenerator.new("vraptor-environment", ["-v=0.0.8", "-g=br.com.caelum.vraptor.plugin"])
@generator.build
it "injects dependency into ivy.xml with provided org" do
PluginGenerator.new("vraptor-environment", ["-v=0.0.8", "-g=br.com.caelum.vraptor.plugin"]).build
back
end

it "should inject dependency into ivy.xml" do
source = expected_for "ivy.xml"
destination = "#{@ant_projet}/ivy.xml"
exists_and_identical?(source, destination)
end

after :each do
rollback @ant_projet, 'ivy.xml'
end
end

context "gradle project" do

before :each do
FileUtils.chdir(@gradle_projet)
@generator = PluginGenerator.new("vraptor-environment", ["-v=0.0.8"])
@generator.build
back
backup @gradle_projet, 'build.gradle'
end

it "should inject dependency into build.gradle" do
it "injects dependency into build.gradle with default org" do
PluginGenerator.new("vraptor-environment", ["-v=0.0.8"]).build
back
source = expected_for "default_org_build.gradle"
destination = "#{@gradle_projet}/build.gradle"
exists_and_identical?(source, destination)
end
end

context "gradle project with plugin org" do

before :each do
FileUtils.chdir(@gradle_projet)
@generator = PluginGenerator.new("vraptor-environment", ["-v=0.0.8", "-g=br.com.caelum.vraptor.plugin"])
@generator.build
back
end

it "should inject dependency into build.gradle" do
PluginGenerator.new("vraptor-environment", ["-v=0.0.8", "-g=br.com.caelum.vraptor.plugin"]).build
back
source = expected_for "build.gradle"
destination = "#{@gradle_projet}/build.gradle"
exists_and_identical?(source, destination)
end

after :each do
rollback @gradle_projet, 'build.gradle'
end
end

def back
FileUtils.chdir("..")
FileUtils.chdir("..")
end

def backup dir_path, file_name
FileUtils.cp("#{dir_path}/#{file_name}", "#{dir_path}/#{file_name}.original")
FileUtils.chdir(dir_path)
end

def rollback dir_path, file_name
FileUtils.cp("#{dir_path}/#{file_name}.original", "#{dir_path}/#{file_name}")
end
end
4 changes: 2 additions & 2 deletions spec/vraptor-scaffold/http_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

it "should use 'http_proxy' env when it is present" do
http = VraptorScaffold::HttpRequest.http
http.should be_true http.proxy_class?
http.proxy_class?.should be_true
end
end

Expand All @@ -33,7 +33,7 @@

it "should not use proxy settings when no http_proxy env exists" do
http = VraptorScaffold::HttpRequest.http
http.should be_true !http.proxy_class?
http.proxy_class?.should be_false
end
end

Expand Down
5 changes: 3 additions & 2 deletions vraptor-scaffold.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ Gem::Specification.new do |s|

s.add_dependency('thor', '0.14.6')
s.add_dependency('activesupport', "3.0.1")
s.add_dependency('rake', '0.9.2')
s.add_dependency('rake')

s.add_development_dependency('rspec', '1.3.2')
s.add_development_dependency('rspec')
s.add_development_dependency('ZenTest', '4.4.0')
s.add_development_dependency('simplecov', '0.5.4')
s.add_development_dependency('pry')

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {spec}/*`.split("\n")
Expand Down

0 comments on commit fd104a5

Please sign in to comment.