tumbler 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/spec/updater_spec.rb DELETED
@@ -1,60 +0,0 @@
1
- require 'spec_helper'
2
- require 'fakeweb'
3
-
4
- describe Tumbler::Updater do
5
- before(:each) do
6
- @bin = File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'tumbler'))
7
- @target = temp_dir('tmp')
8
- Dir.chdir(@target) {`bundle exec ruby #{@bin} rails`}
9
- end
10
-
11
- after(:each) do
12
- FileUtils.rm_rf @target
13
- $".delete "tumbler/gemspec.rb" # we need to delete this so each gemspec can be generated fresh
14
- end
15
-
16
- it "should fetch the version number" do
17
- FakeWeb.allow_net_connect = false
18
- FakeWeb.register_uri(:get, "http://rubygems.org/api/v1/gems/rails.json", :body => '{ "name": "rails", "info": "Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates.", "version": "2.3.5", "version_downloads": 2451, "authors": "David Heinemeier Hansson", "downloads": 134451, "project_uri": "http://rubygems.org/gems/rails", "gem_uri": "http://rubygems.org/gems/rails-2.3.5.gem", "dependencies": { "runtime": [ { "name": "activesupport", "requirements": ">= 2.3.5" } ], "development": [ ] }}')
19
- File.unlink("#{@target}/rails/lib/rails/version.rb")
20
- Tumbler::Updater.new("#{@target}/rails", :name => 'rails').update
21
- File.read("#{@target}/rails/lib/rails/version.rb").should match(/2\.3\.5/)
22
- end
23
-
24
- it "should generate a CHANGELOG" do
25
- File.unlink("#{@target}/rails/CHANGELOG")
26
- Tumbler::Updater.new("#{@target}/rails", :name => 'rails').update
27
- File.exist?("#{@target}/rails/CHANGELOG").should be_true
28
- end
29
-
30
- it "should not append anything to the Rakefile as it already has the tumbler tasks in it" do
31
- rakefile = File.read("#{@target}/rails/Rakefile")
32
- Tumbler::Updater.new("#{@target}/rails", :name => 'rails').update
33
- File.read("#{@target}/rails/Rakefile").should == rakefile
34
- end
35
-
36
- it "should append the Tumbler tasks if they don't already exist" do
37
- File.open("#{@target}/rails/Rakefile", 'w') {|f| f.puts '# Some other rake file'}
38
- Tumbler::Updater.new("#{@target}/rails", :name => 'rails').update
39
- File.read("#{@target}/rails/Rakefile").scan(/require 'tumbler'\nTumbler\.use_rake_tasks/).size.should == 1
40
- end
41
-
42
- it "should not append anything to the gemspec if it already is using tumbler" do
43
- gemspec = File.read("#{@target}/rails/rails.gemspec")
44
- Tumbler::Updater.new("#{@target}/rails", :name => 'rails').update
45
- File.read("#{@target}/rails/rails.gemspec").should == gemspec
46
- end
47
-
48
- it "should append inject deps if its not there already" do
49
- File.open("#{@target}/rails/Rakefile", 'w') {|f| f.puts '# Some other gemspec file'}
50
- Tumbler::Updater.new("#{@target}/rails", :name => 'rails').update
51
- File.read("#{@target}/rails/rails.gemspec").scan(/Tumbler::Gemspec.inject_dependencies/).size.should == 1
52
- end
53
-
54
- it "should add a Tumbler config file if its not already there" do
55
- File.unlink("#{@target}/rails/Tumbler")
56
- Tumbler::Updater.new("#{@target}/rails", :name => 'rails').update
57
- File.exist?("#{@target}/rails/Tumbler").should be_true
58
- end
59
-
60
- end
data/spec/version_spec.rb DELETED
@@ -1,53 +0,0 @@
1
- require 'spec/spec_helper'
2
-
3
- describe 'Tumbler#version' do
4
- it "should read the current version" do
5
- create_app('test', :version => '0.1.2') { |app|
6
- app.version.to_s.should == '0.1.2'
7
- }
8
- end
9
-
10
- it "should bump the current version by minor" do
11
- create_app('test', :version => '0.1.2') { |app|
12
- Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
13
- app.bump_and_push(:minor)
14
- app.version.to_s.should == '0.2.0'
15
- app.tags.should include('0.2.0')
16
- }
17
- end
18
-
19
- it "should bump the current version by tiny" do
20
- create_app('test', :version => '0.1.2') { |app|
21
- Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
22
- app.bump_and_push(:tiny)
23
- app.version.to_s.should == '0.1.3'
24
- }
25
- end
26
-
27
- it "should bump the current version by major" do
28
- create_app('test', :version => '0.1.2') { |app|
29
- Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
30
- app.bump_and_push(:major)
31
- app.version.to_s.should == '1.0.0'
32
- }
33
- end
34
-
35
- it "should bump the current version by major" do
36
- create_app('test', :version => '0.1.2') { |app|
37
- Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
38
- app.bump_and_push(:major)
39
- app.version.to_s.should == '1.0.0'
40
- }
41
- end
42
-
43
- it "should not let you tag the same version twice" do
44
- create_app('test', :version => '0.1.2') { |app|
45
- Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
46
- app.bump_and_push(:major)
47
- app.version.to_s.should == '1.0.0'
48
- proc {app.tag_and_push(:major)}.should raise_error
49
-
50
- }
51
- end
52
-
53
- end