Skip to content

Commit 571ba68

Browse files
committed
upgrading to rspec 3.0
1 parent 34d6ff8 commit 571ba68

9 files changed

+64
-63
lines changed

Rakefile

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
require 'bundler/setup'
2-
require 'rubygems/tasks'
3-
Gem::Tasks.new
4-
5-
require 'rspec/core/rake_task'
6-
RSpec::Core::RakeTask.new(:spec) do |c|
7-
c.rspec_opts = ['--color', '--format=doc']
8-
end
9-
10-
task :default => :build
2+
require 'rubygems/tasks'
3+
Gem::Tasks.new
4+
5+
require 'rspec/core/rake_task'
6+
RSpec::Core::RakeTask.new(:spec) do |c|
7+
c.rspec_opts = ['--color', '--format=doc']
8+
end
9+
10+
task :default => :build

spec/albacore_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
@got_it = obj
88
end
99
Albacore.publish :pubsub, true
10-
@got_it.should be_true
10+
expect(@got_it).to be true
1111
end
1212

1313
it 'knows if it\'s Windows it\'s running on' do
14-
(::Albacore.windows? === true || ::Albacore::windows? === false).should be_true
14+
expect(::Albacore.windows? === true || ::Albacore::windows? === false).to be true
1515
end
1616
it 'should not be nil' do
17-
::Albacore.windows?.should_not be_nil
17+
expect(::Albacore.windows?).to_not be nil
1818
end
1919
end
2020

spec/build_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
Albacore::Build::Config.new
99
end
1010
%w[file= sln= target target= logging logging= prop cores cores= tools_version tools_version=].each do |writer|
11-
it "should have property :#{writer}" do
12-
subject.respond_to?(:"#{writer}").should be_true
11+
it "should respond to :#{writer}" do
12+
expect(subject).to respond_to(:"#{writer}")
1313
end
1414
end
1515
it 'should not have any property' do
16-
subject.respond_to?(:something_nonexistent).should be_false
16+
expect(subject).to_not respond_to(:something_nonexistent)
1717
end
1818

1919
describe 'when setting properties' do
@@ -22,8 +22,8 @@
2222
subject.tools_version = '3.5'
2323
end
2424
it do
25-
subject.parameters.should include('/verbosity:minimal')
26-
subject.parameters.should include('/toolsversion:3.5')
25+
expect(subject.parameters).to include('/verbosity:minimal')
26+
expect(subject.parameters).to include('/toolsversion:3.5')
2727
end
2828
end
2929
end
@@ -51,13 +51,13 @@
5151
end
5252

5353
it do
54-
subject.executable.should eq('xbuild')
54+
expect(subject.executable).to eq('xbuild')
5555
end
5656
it do
57-
subject.parameters.should eq(%W|/verbosity:minimal #{path 'src/HelloWorld.sln'} /target:Clean;Build|)
57+
expect(subject.parameters).to eq(%W|/verbosity:minimal #{path 'src/HelloWorld.sln'} /target:Clean;Build|)
5858
end
5959
it do
60-
subject.is_mono_command?.should be_false
60+
expect(subject.is_mono_command?).to be false
6161
end
6262
end
6363

spec/dsl_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'albacore/dsl'
12
require 'spec_helper'
23

34
describe "what methods are included by default" do
@@ -9,7 +10,6 @@ class A ; include Albacore::DSL ; end
910

1011
class X
1112
include Albacore::DSL
12-
def initialize ; end
1313
end
1414

1515
#puts "X has methods: #{X.new.private_methods.inspect}"
@@ -21,7 +21,7 @@ def initialize ; end
2121
X.new
2222
end
2323
it do
24-
subject.respond_to?(method, true).should be_true
24+
expect(subject.method(method)).to_not be nil
2525
end
2626
end
2727
end
@@ -34,6 +34,6 @@ def initialize ; end
3434
end
3535
end
3636
it 'should be named "build"' do
37-
subject.name.should eq('build')
37+
expect(subject.name).to eq('build')
3838
end
3939
end

spec/fpm_app_spec_spec.rb

+15-15
Original file line numberDiff line numberDiff line change
@@ -54,51 +54,51 @@
5454
end
5555

5656
it 'should generate command source' do
57-
flags['-s'].should eq 'dir'
57+
expect(flags['-s']).to eq 'dir'
5858
end
5959

6060
it 'should generate command target' do
61-
flags['-t'].should eq 'rpm'
61+
expect(flags['-t']).to eq 'rpm'
6262
end
6363

6464
it 'should generate command name/title' do
65-
flags['--name'].should eq 'my.app'
65+
expect(flags['--name']).to eq 'my.app'
6666
end
6767

6868
it 'should generate command description' do
69-
flags['--description'].should eq 'my.app implements much wow'
69+
expect(flags['--description']).to eq 'my.app implements much wow'
7070
end
7171

7272
it 'should generate command url' do
73-
flags['--url'].should eq 'https://github.com/Albacore/albacore'
73+
expect(flags['--url']).to eq 'https://github.com/Albacore/albacore'
7474
end
7575

7676
it 'should generate command category' do
77-
flags['--category'].should eq 'webserver'
77+
expect(flags['--category']).to eq 'webserver'
7878
end
7979

8080
it 'should generate command version' do
81-
flags['--version'].should eq '5.6.7'
81+
expect(flags['--version']).to eq '5.6.7'
8282
end
8383

8484
it 'should generate command epoch' do
85-
flags['--epoch'].should eq 1
85+
expect(flags['--epoch']).to eq 1
8686
end
8787

8888
it 'should generate command license' do
89-
flags['--license'].should eq 'MIT'
89+
expect(flags['--license']).to eq 'MIT'
9090
end
9191

9292
it 'should generate command "look in this directory" flag' do
93-
flags['-C'].should eq '/a/b'
93+
expect(flags['-C']).to eq '/a/b'
9494
end
9595

9696
it 'should generate command depends' do
97-
flags['--depends'].should eq 'mono'
97+
expect(flags['--depends']).to eq 'mono'
9898
end
9999

100100
it 'should generate command rpm-digest' do
101-
flags['--rpm-digest'].should eq 'sha256'
101+
expect(flags['--rpm-digest']).to eq 'sha256'
102102
end
103103
end
104104

@@ -140,18 +140,18 @@
140140
end
141141

142142
it 'should not have a license' do
143-
spec.license.should be_nil
143+
expect(spec.license).to be nil
144144
end
145145

146146
it 'that license should never be a FPM parameter' do
147-
subject.generate_flags.has_key?('--license').should be_false
147+
expect(subject.generate_flags.has_key?('--license')).to be false
148148
end
149149
end
150150

151151
describe ::Albacore::FpmAppSpec::Config do
152152
%w|files= out= opts no_bundler|.each do |sym|
153153
it "should respond_to :#{sym}" do
154-
should respond_to :"#{sym}"
154+
expect(subject).to respond_to :"#{sym}"
155155
end
156156
end
157157
end

spec/nugets_pack_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def self.create id, curr, gen_symbols = true
156156
include_context 'path testing'
157157

158158
it "accepts .nuspec files" do
159-
NuspecTask.accept?('some.nuspec').should be_true
159+
expect(NuspecTask.accept?('some.nuspec')).to be true
160160
end
161161

162162
let (:cmd) do
@@ -174,10 +174,10 @@ def self.create id, curr, gen_symbols = true
174174
end
175175

176176
it "should run the correct executable" do
177-
subject.mono_command.should eq('NuGet.exe')
177+
expect(subject.mono_command).to eq 'NuGet.exe'
178178
end
179179
it "should give the correct parameters" do
180-
subject.mono_parameters.should eq(%W[Pack -OutputDirectory #{path 'spec/testdata/pkg'} ./spec/testdata/example.nuspec])
180+
expect(subject.mono_parameters).to eq %W[Pack -OutputDirectory #{path 'spec/testdata/pkg'} ./spec/testdata/example.nuspec]
181181
end
182182
end
183183

spec/projectlint_spec.rb

+16-16
Original file line numberDiff line numberDiff line change
@@ -28,43 +28,43 @@ def project_lint_on(name, path, ignores=nil)
2828
describe "when supplying a csproj file with files added but not present on the filesystem" do
2929
before(:all) { @f = project_lint_on(:first, File.join( 'added_but_not_on_filesystem', 'aproject.csproj')) }
3030

31-
it("should fail") { @f.failed.should be_true }
31+
it("should fail") { expect(@f.failed).to be true }
3232

33-
it("should report failure") { @f.failure_message.should include("-") }
33+
it("should report failure") { expect(@f.failure_message).to include "-" }
3434

35-
it("should report file.cs") { @f.failure_message.should include('File.cs') }
35+
it("should report file.cs") { expect(@f.failure_message).to include 'File.cs' }
3636

37-
it("should report Image.txt") { @f.failure_message.should include('Image.txt') }
37+
it("should report Image.txt") { expect(@f.failure_message).to include 'Image.txt' }
3838

39-
it("should report MyHeavy.heavy") { @f.failure_message.should include('MyHeavy.heavy') }
39+
it("should report MyHeavy.heavy") { expect(@f.failure_message).to include 'MyHeavy.heavy' }
4040

41-
it("should report Schema.xsd") { @f.failure_message.should include('Schema.xsd') }
41+
it("should report Schema.xsd") { expect(@f.failure_message).to include 'Schema.xsd' }
4242

43-
it("should report SubFolder/AnotherFile.cs") { @f.failure_message.should include('AnotherFile.cs') }
43+
it("should report SubFolder/AnotherFile.cs") { expect(@f.failure_message).to include 'AnotherFile.cs' }
4444

45-
it("should not report linked files") { @f.failure_message.should_not include('SomeFile.cs') }
45+
it("should not report linked files") { expect(@f.failure_message).to_not include 'SomeFile.cs' }
4646
end
4747

4848
describe "when supplying a correct csproj file with files added and present on the filesystem" do
4949

5050
before(:all) { @f = project_lint_on(:second, File.join( 'correct', 'aproject.csproj')) }
5151

5252
it("should not fail") {
53-
@f.failed.should be_false
53+
expect(@f.failed).to be false
5454
}
55-
it("no message") { @f.failure_message.should be_nil }
55+
it("no message") { expect(@f.failure_message).to be nil }
5656
end
5757

5858
describe "when supplying a csproj file with files not added but present on the filesystem" do
5959
before(:all) { @f = project_lint_on(:third, File.join( 'on_filesystem_but_not_added', 'aproject.csproj')) }
6060

61-
it("should fail") { @f.failed.should be_true }
61+
it("should fail") { expect(@f.failed).to be true }
6262

63-
it("should report failure") { @f.failure_message.should include("+") }
63+
it("should report failure") { expect(@f.failure_message).to include '+' }
6464

65-
it("should report file.cs") { @f.failure_message.should include('File.cs') }
65+
it("should report file.cs") { expect(@f.failure_message).to include 'File.cs' }
6666

67-
it("should report Image.txt") { @f.failure_message.should include('Image.txt') }
67+
it("should report Image.txt") { expect(@f.failure_message).to include 'Image.txt' }
6868
end
6969

7070

@@ -73,5 +73,5 @@ def project_lint_on(name, path, ignores=nil)
7373
@f = project_lint_on(:fourth, File.join('on_filesystem_but_not_added', 'aproject.csproj'), [/.*\.txt$/, /.*\.cs$/])
7474
}
7575

76-
it("should not fail") { @f.failed.should be_false }
77-
end
76+
it("should not fail") { expect(@f.failed).to be false }
77+
end

spec/shared_contexts.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ def self.has_value sym, e
1313

1414
def self.has_dep name, version
1515
it "has dependency on '#{name}'" do
16-
m.dependencies.has_key?(name).should be_true
16+
expect(m.dependencies.has_key?(name)).to be true
1717
end
1818
it "overrode dependency on '#{name}'" do
19-
m.dependencies[name].version.should eq version
19+
expect(m.dependencies[name].version).to eq version
2020
end
2121
end
2222

2323
def self.has_not_dep name
2424
it "does not have a dependency on #{name}" do
25-
m.dependencies.has_key?(name).should be_false
25+
expect(m.dependencies.has_key?(name)).to be false
2626
end
2727
end
2828

@@ -35,20 +35,20 @@ def self.has_file src, target, exclude = nil
3535
# puts "subject.files: #{subject.files}, index of: #{subject.files.find_index { |f| f.src == src }}"
3636
# puts "#{f.inspect}"
3737
# end
38-
file.should_not be_nil
38+
expect(file).to_not be nil
3939
end
4040

4141
it "has file[#{src}].target == '#{target}'" do
4242
file = subject.files.find { |f| f.src == src }
43-
file.target.should eq target
43+
expect(file.target).to eq target
4444
end
4545
end
4646

4747
def self.has_not_file src
4848
src = norm src
4949
it "has not file[#{src}]" do
5050
file = subject.files.find { |f| f.src == src }
51-
file.should be_nil
51+
expect(file).to be nil
5252
end
5353
end
5454

spec/spec_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
require 'albacore/albacore_module'
33

44
RSpec.configure do |config|
5+
config.raise_errors_for_deprecations! if ENV['RAISE_DEPRECATED']
56
config.before(:each) do
67
@logout = StringIO.new
78
@logout = STDOUT if ENV['TEST_DEBUG']

0 commit comments

Comments
 (0)