engineyard 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,44 @@
1
+ require 'rspec/matchers'
2
+
3
+ RSpec::Matchers.define :have_command_like do |regex|
4
+ match do |command_list|
5
+ @found = command_list.find{|c| c =~ regex }
6
+ !!@found
7
+ end
8
+
9
+ failure_message_for_should do |command_list|
10
+ "Didn't find a command matching #{regex} in commands:\n\n" + command_list.join("\n\n")
11
+ end
12
+
13
+ failure_message_for_should_not do |command_list|
14
+ "Found unwanted command:\n\n#{@found}\n\n(matches regex #{regex})"
15
+ end
16
+ end
17
+
18
+ RSpec::Matchers.define :have_app_code do
19
+ match { |instance| instance.has_app_code? }
20
+
21
+ failure_message_for_should do |instance|
22
+ "Expected #has_app_code? to be true on instance: #{instance.inspect}"
23
+ end
24
+
25
+ failure_message_for_should_not do |instance|
26
+ "Expected #has_app_code? to be false on instance: #{instance.inspect}"
27
+ end
28
+ end
29
+
30
+ RSpec::Matchers.define :resolve_to do |expected|
31
+ match do |pair|
32
+ app, env = *pair
33
+ app.name == expected[:app_name] && env.name == expected[:environment_name]
34
+ end
35
+
36
+ failure_message_for_should do |pair|
37
+ app, env = *pair
38
+ "Expected: #{expected[:app_name]}, #{expected[:environment_name]}; Got: #{app.name}, #{env.name}"
39
+ end
40
+
41
+ failure_message_for_should_not do |pair|
42
+ "Expected to not match: #{expected[:app_name]}, #{expected[:environment_name]}"
43
+ end
44
+ end
@@ -1,29 +1,6 @@
1
- module Spec
2
- module Helpers
3
- module SharedIntegrationTestUtils
4
-
5
- def run_ey(command_options, ey_options={})
6
- if respond_to?(:extra_ey_options) # needed for ssh tests
7
- ey_options.merge!(extra_ey_options)
8
- end
9
-
10
- ey(command_to_run(command_options), ey_options)
11
- end
12
-
13
- def make_scenario(hash)
14
- # since nil will silently turn to empty string when interpolated,
15
- # and there's a lot of string matching involved in integration
16
- # testing, it would be nice to have early notification of typos.
17
- scenario = Hash.new { |h,k| raise "Tried to get key #{k.inspect}, but it's missing!" }
18
- scenario.merge!(hash)
19
- end
20
-
21
- end
22
- end
23
- end
1
+ require 'ostruct'
24
2
 
25
3
  shared_examples_for "it has an ambiguous git repo" do
26
- include Spec::Helpers::SharedIntegrationTestUtils
27
4
 
28
5
  define_git_repo('dup test') do
29
6
  system("git remote add dup git://github.com/engineyard/dup.git")
@@ -37,7 +14,7 @@ shared_examples_for "it has an ambiguous git repo" do
37
14
  end
38
15
 
39
16
  shared_examples_for "it requires an unambiguous git repo" do
40
- it_should_behave_like "it has an ambiguous git repo"
17
+ include_examples "it has an ambiguous git repo"
41
18
 
42
19
  it "lists disambiguating environments to choose from" do
43
20
  run_ey({}, {:expect_failure => true})
@@ -49,8 +26,8 @@ shared_examples_for "it requires an unambiguous git repo" do
49
26
  end
50
27
 
51
28
  shared_examples_for "it takes an environment name and an app name and an account name" do
52
- it_should_behave_like "it takes an app name"
53
- it_should_behave_like "it takes an environment name"
29
+ include_examples "it takes an app name"
30
+ include_examples "it takes an environment name"
54
31
 
55
32
  context "when multiple accounts with collaboration" do
56
33
  before :all do
@@ -77,7 +54,7 @@ shared_examples_for "it takes an environment name and an app name and an account
77
54
  end
78
55
 
79
56
  shared_examples_for "it takes an environment name and an account name" do
80
- it_should_behave_like "it takes an environment name"
57
+ include_examples "it takes an environment name"
81
58
 
82
59
  context "when multiple accounts with collaboration" do
83
60
  before :all do
@@ -119,8 +96,6 @@ shared_examples_for "it takes an environment name and an account name" do
119
96
  end
120
97
 
121
98
  shared_examples_for "it takes an environment name" do
122
- include Spec::Helpers::SharedIntegrationTestUtils
123
-
124
99
  it "operates on the current environment by default" do
125
100
  api_scenario "one app, one environment"
126
101
  run_ey({:environment => nil}, {:debug => true})
@@ -194,7 +169,6 @@ shared_examples_for "it takes an environment name" do
194
169
  end
195
170
 
196
171
  shared_examples_for "it takes an app name" do
197
- include Spec::Helpers::SharedIntegrationTestUtils
198
172
  before { @takes_app_name = true }
199
173
 
200
174
  it "allows you to specify a valid app" do
@@ -233,8 +207,6 @@ shared_examples_for "it takes an app name" do
233
207
  end
234
208
 
235
209
  shared_examples_for "it invokes engineyard-serverside" do
236
- include Spec::Helpers::SharedIntegrationTestUtils
237
-
238
210
  context "with arguments" do
239
211
  before(:all) do
240
212
  api_scenario "one app, one environment"
@@ -296,7 +268,7 @@ shared_examples_for "model collections" do
296
268
  it "returns nil when it can't find anything" do
297
269
  @collection.match_one("dev-and-production").should be_nil
298
270
  end
299
- end
271
+ end
300
272
 
301
273
  describe "#match_one!" do
302
274
  it "works when given an unambiguous substring" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 0
10
- version: 1.4.0
9
+ - 1
10
+ version: 1.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - EY Cloud Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-07 00:00:00 -07:00
18
+ date: 2011-10-18 00:00:00 -07:00
19
19
  default_executable: ey
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -105,12 +105,12 @@ dependencies:
105
105
  requirements:
106
106
  - - "="
107
107
  - !ruby/object:Gem::Version
108
- hash: 3
108
+ hash: 7
109
109
  segments:
110
110
  - 1
111
111
  - 5
112
- - 0
113
- version: 1.5.0
112
+ - 2
113
+ version: 1.5.2
114
114
  requirement: *id006
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: net-ssh
@@ -151,14 +151,13 @@ dependencies:
151
151
  version_requirements: &id009 !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
154
- - - "="
154
+ - - ~>
155
155
  - !ruby/object:Gem::Version
156
- hash: 27
156
+ hash: 3
157
157
  segments:
158
- - 1
159
- - 3
158
+ - 2
160
159
  - 0
161
- version: 1.3.0
160
+ version: "2.0"
162
161
  requirement: *id009
163
162
  - !ruby/object:Gem::Dependency
164
163
  name: rake
@@ -239,12 +238,12 @@ dependencies:
239
238
  requirements:
240
239
  - - ~>
241
240
  - !ruby/object:Gem::Version
242
- hash: 23
241
+ hash: 19
243
242
  segments:
244
243
  - 0
245
- - 1
246
- - 6
247
- version: 0.1.6
244
+ - 2
245
+ - 2
246
+ version: 0.2.2
248
247
  requirement: *id015
249
248
  - !ruby/object:Gem::Dependency
250
249
  name: open4
@@ -330,10 +329,11 @@ files:
330
329
  - spec/ey/whoami_spec.rb
331
330
  - spec/spec_helper.rb
332
331
  - spec/support/bundled_ey
332
+ - spec/support/fake_awsm.rb
333
333
  - spec/support/fake_awsm.ru
334
334
  - spec/support/fixture_recipes.tgz
335
- - spec/support/git_repo.rb
336
335
  - spec/support/helpers.rb
336
+ - spec/support/matchers.rb
337
337
  - spec/support/ruby_ext.rb
338
338
  - spec/support/scenarios.rb
339
339
  - spec/support/shared_behavior.rb
@@ -412,10 +412,11 @@ test_files:
412
412
  - spec/ey/whoami_spec.rb
413
413
  - spec/spec_helper.rb
414
414
  - spec/support/bundled_ey
415
+ - spec/support/fake_awsm.rb
415
416
  - spec/support/fake_awsm.ru
416
417
  - spec/support/fixture_recipes.tgz
417
- - spec/support/git_repo.rb
418
418
  - spec/support/helpers.rb
419
+ - spec/support/matchers.rb
419
420
  - spec/support/ruby_ext.rb
420
421
  - spec/support/scenarios.rb
421
422
  - spec/support/shared_behavior.rb
@@ -1,36 +0,0 @@
1
- module Spec
2
- module GitRepo
3
- module ClassMethods
4
-
5
- def define_git_repo(name, &setup)
6
- # EY's ivars don't get cleared between examples, so we can keep
7
- # a git repo around longer (and thus make our tests faster)
8
- FakeFS.without { EY.define_git_repo(name, &setup) }
9
- end
10
-
11
- def use_git_repo(repo_name)
12
- before(:all) do
13
- FakeFS.without do
14
- @_original_wd ||= []
15
- @_original_wd << Dir.getwd
16
- Dir.chdir(EY.git_repo_dir(repo_name))
17
- end
18
- end
19
-
20
- after(:all) do
21
- FakeFS.without { Dir.chdir(@_original_wd.pop) }
22
- end
23
- end
24
-
25
- end # ClassMethods
26
-
27
- def refresh_git_repo(name)
28
- EY.refresh_git_repo(name)
29
- end
30
-
31
- def self.included(other)
32
- other.extend ClassMethods
33
- end
34
-
35
- end
36
- end