This repository has been archived by the owner on Feb 1, 2018. It is now read-only.
/
bwoken_spec.rb
73 lines (62 loc) · 1.92 KB
/
bwoken_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
require 'fileutils'
require 'spec_helper'
require 'bwoken'
describe Bwoken do
describe '.app_name', :stub_proj_path do
it "returns the app's name without the .app prefix" do
stub_proj_path
Bwoken.app_name.should == 'FakeProject'
end
end
describe '.app_dir', :stub_proj_path do
it "returns the app's name with the .app suffix" do
stub_proj_path
Bwoken.app_dir.should == "#{proj_path}/build/FakeProject.app"
end
end
describe '.project_path' do
it 'returns the root directory of the project' do
Dir.should_receive(:pwd).and_return(:foo)
Bwoken.project_path.should == :foo
end
end
describe '.path_to_automation_template' do
it 'returns the location of the Automation template', :platform => :osx do
File.file?(Bwoken.path_to_automation_template).should be_true
end
end
describe '.build_path', :stub_proj_path do
context "when it doesn't yet exist" do
it 'creates the build directory' do
stub_proj_path
FileUtils.rm_r("#{proj_path}/build")
Bwoken.build_path
File.directory?("#{proj_path}/build").should be_true
end
end
it 'returns the build directory' do
stub_proj_path
Bwoken.build_path.should == "#{proj_path}/build"
end
end
describe '.workspace', :stub_proj_path do
it 'returns the workspace directory' do
stub_proj_path
Bwoken.workspace.should == "#{proj_path}/FakeProject.xcworkspace"
end
end
describe '.results_path', :stub_proj_path do
context "when it doesn't yet exist" do
it 'creates the results directory' do
stub_proj_path
FileUtils.rm_rf("#{proj_path}/automation")
Bwoken.results_path
File.directory?("#{proj_path}/automation/results").should be_true
end
end
it 'returns the results path' do
stub_proj_path
Bwoken.results_path.should == "#{proj_path}/automation/results"
end
end
end