cuesmash 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,87 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cuesmash::Cucumber do
4
+
5
+ before(:each) do
6
+ Cuesmash::Cucumber.any_instance.stub(:puts)
7
+ end
8
+
9
+ describe "when running the tests" do
10
+
11
+ before(:each) do
12
+ wait = double
13
+ @value = double
14
+ wait.stub(:value){@value}
15
+ wait.stub(:join)
16
+ Open3.stub(:popen3).and_yield(nil, nil, nil, wait)
17
+
18
+ @cucumber = Cuesmash::Cucumber.new(nil, nil)
19
+ @cucumber.stub(:command)
20
+ end
21
+
22
+ it "should complete if all is well" do
23
+ @value.stub(:exitstatus){0}
24
+ @cucumber.should_receive(:completed)
25
+ @cucumber.test
26
+ end
27
+ end
28
+
29
+ describe "when generating the command" do
30
+
31
+ it "should add the ios version" do
32
+ @cucumber = Cuesmash::Cucumber.new("7.0", nil)
33
+ @cucumber.stub(:tag_arguments)
34
+
35
+ @cucumber.instance_eval{command}.should match(/DEVICE_TARGET='iPhone Retina \(4-inch\) - Simulator - iOS 7.0'/)
36
+ end
37
+
38
+ it "should not add the ios version if missing" do
39
+ @cucumber = Cuesmash::Cucumber.new(nil, nil)
40
+ @cucumber.stub(:tag_arguments)
41
+
42
+ @cucumber.instance_eval{command}.should_not match(/DEVICE_TARGET/)
43
+ end
44
+
45
+ it "should add the format" do
46
+ @cucumber = Cuesmash::Cucumber.new(nil, nil)
47
+ @cucumber.format = "test-format"
48
+
49
+ @cucumber.instance_eval{command}.should match(/--format test-format/)
50
+ end
51
+
52
+ it "should not add the format if missing" do
53
+ @cucumber = Cuesmash::Cucumber.new(nil, nil)
54
+
55
+ @cucumber.instance_eval{command}.should_not match(/--format/)
56
+ end
57
+
58
+ it "should add the output" do
59
+ @cucumber = Cuesmash::Cucumber.new(nil, nil)
60
+ @cucumber.output = "test-output"
61
+
62
+ @cucumber.instance_eval{command}.should match(/--out test-output/)
63
+ end
64
+
65
+ it "should not add the output if missing" do
66
+ @cucumber = Cuesmash::Cucumber.new(nil, nil)
67
+
68
+ @cucumber.instance_eval{command}.should_not match(/--out/)
69
+ end
70
+
71
+ it "should add the tags" do
72
+ @cucumber = Cuesmash::Cucumber.new(nil, ["tag1", "tag2"])
73
+ @cucumber.instance_eval{command}.should match(/--tags tag1 --tags tag2/)
74
+ end
75
+
76
+ it "should not add tags if missing" do
77
+ @cucumber = Cuesmash::Cucumber.new(nil, nil)
78
+ @cucumber.instance_eval{command}.should_not match(/--tags/)
79
+ end
80
+
81
+ it "should add the color flag" do
82
+ @cucumber = Cuesmash::Cucumber.new(nil, nil)
83
+ @cucumber.instance_eval{command}.should match(/-c/)
84
+ end
85
+
86
+ end
87
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cuesmash::IosApp do
4
+ describe "when creating a new instance" do
5
+ before(:all) do
6
+ Dir.stub(:mktmpdir) { "/tmp" }
7
+ @iosapp = Cuesmash::IosApp.new(file_name: "MyApp")
8
+ end
9
+
10
+ it "should have an app_dir instance" do
11
+ @iosapp.app_dir.should match("/tmp/Build/Products/Debug-iphonesimulator/")
12
+ end
13
+
14
+ it "should have an app_path instance" do
15
+ @iosapp.app_path.should match("/tmp/Build/Products/Debug-iphonesimulator/MyApp.app")
16
+ end
17
+
18
+ it "should have a tmp_dir instance" do
19
+ @iosapp.tmp_dir.should match("/tmp")
20
+ end
21
+
22
+ it "should have an app_name instance" do
23
+ @iosapp.app_name.should match("MyApp.app")
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cuesmash::Plist do
4
+
5
+ describe "when executed" do
6
+
7
+ before(:each) do
8
+ @plist = Cuesmash::Plist.new("scheme", "/tmp")
9
+ @plist.stub(:update)
10
+ @plist.stub(:clear)
11
+ @plist.stub(:completed)
12
+ @plist.stub(:started)
13
+ end
14
+
15
+ it "should update" do
16
+ @plist.should_receive(:update)
17
+ @plist.execute
18
+ end
19
+
20
+ it "should clear" do
21
+ @plist.should_receive(:clear)
22
+ @plist.execute
23
+ end
24
+ end
25
+
26
+ describe "when clearing" do
27
+
28
+ before(:each) do
29
+ @plist = Cuesmash::Plist.new("scheme", "/tmp")
30
+ @plist.stub(:update)
31
+ @plist.stub(:completed)
32
+ @plist.stub(:started)
33
+ end
34
+
35
+ it "should delete the simulator plist" do
36
+ @plist.stub(:simulator_plist_path){"plist_path"}
37
+ FileUtils.should_receive(:rm).with("plist_path", anything)
38
+ @plist.execute
39
+ end
40
+ end
41
+
42
+ describe "when updating" do
43
+
44
+ before(:each) do
45
+ @cfplist = double(CFPropertyList::List)
46
+ @cfplist.stub(:value)
47
+ @cfplist.stub(:value=)
48
+ @cfplist.stub(:save)
49
+ CFPropertyList::List.stub(:new){@cfplist}
50
+ CFPropertyList.stub(:native_types){@cfplist}
51
+ CFPropertyList.stub(:guess)
52
+
53
+ @plist = Cuesmash::Plist.new("scheme", "app_path")
54
+ @plist.stub(:clear)
55
+ @plist.stub(:completed)
56
+ @plist.stub(:started)
57
+ @plist.stub(:app_path){"app_path"}
58
+ end
59
+
60
+ it "should set the server ip and port" do
61
+ @plist.stub(:server_ip){"server_ip"}
62
+ stub_const("Cuesmash::PORT", 123)
63
+
64
+ @cfplist.should_receive(:[]=).with("url_preference", "server_ip")
65
+ @cfplist.should_receive(:[]=).with("port_preference", 123)
66
+
67
+ @plist.execute
68
+ end
69
+
70
+ it "should write the app server plist" do
71
+ @cfplist.should_receive(:save).with("app_path/server_config.plist", anything)
72
+ @cfplist.stub(:[]=)
73
+
74
+ @plist.execute
75
+ end
76
+
77
+ end
78
+ end
@@ -0,0 +1 @@
1
+ require "cuesmash"
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cuesmash
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Fish
8
+ - Jarod McBride
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-09-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.3'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.3'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: guard-rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: pry
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: CFPropertyList
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: thor
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ description: A gift for Juan
113
+ email:
114
+ - fish@ustwo.co.uk
115
+ - jarod@ustwo.com
116
+ executables:
117
+ - cuesmash
118
+ extensions: []
119
+ extra_rdoc_files: []
120
+ files:
121
+ - ".cuesmash.yml"
122
+ - ".gitignore"
123
+ - ".travis.yml"
124
+ - Gemfile
125
+ - Gemfile.lock
126
+ - Guardfile
127
+ - LICENSE
128
+ - LICENSE.txt
129
+ - README.md
130
+ - Rakefile
131
+ - bin/cuesmash
132
+ - cuesmash.gemspec
133
+ - lib/cuesmash.rb
134
+ - lib/cuesmash/appium_server.rb
135
+ - lib/cuesmash/appium_text.rb
136
+ - lib/cuesmash/command.rb
137
+ - lib/cuesmash/compiler.rb
138
+ - lib/cuesmash/cucumber.rb
139
+ - lib/cuesmash/iosapp.rb
140
+ - lib/cuesmash/plist.rb
141
+ - lib/cuesmash/setup.rb
142
+ - lib/cuesmash/start.rb
143
+ - spec/appium_text_spec.rb
144
+ - spec/command_spec.rb
145
+ - spec/compiler_spec.rb
146
+ - spec/cucumber_spec.rb
147
+ - spec/iosapp_spec.rb
148
+ - spec/plist_spec.rb
149
+ - spec/spec_helper.rb
150
+ homepage: ''
151
+ licenses:
152
+ - MIT
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 2.0.0
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.2.2
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Compile an app, point the app at sinatra, run cucumber with appium
174
+ test_files:
175
+ - spec/appium_text_spec.rb
176
+ - spec/command_spec.rb
177
+ - spec/compiler_spec.rb
178
+ - spec/cucumber_spec.rb
179
+ - spec/iosapp_spec.rb
180
+ - spec/plist_spec.rb
181
+ - spec/spec_helper.rb