httpotemkin 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 680e6b1ecaeb762c4d4ec9ad4e704d07e57d11f8
4
- data.tar.gz: bd9941065a464eff2cfe82259f76bcba7bd647cc
3
+ metadata.gz: a92d5f3c3c07552abf6abbff208200395c89cdef
4
+ data.tar.gz: 519d81c4e618655ddc91f7971d7d80fb3258e81a
5
5
  SHA512:
6
- metadata.gz: 654de56651be4fdd59502f828c9404cd266cf47046f9a6c0a7712f6a58d1a0ba79b484787240b193254597e6602a1845ffca5134d12d237e39b490840ea4cab6
7
- data.tar.gz: 88bbd23cf90c764c0505d39af88096b88cd987584067c6a83cb8775d1587913f97fdcef79b1579cfca9022d2203bd80b65a23e7223f1a46ab161565321ffcbe4
6
+ metadata.gz: a7d91419dbf36b3a55f64dbc0968e14e496c0256fb3ae5b7ed4e1d8afce34ac0ff08f1b686ea239efe70a35e1a46c316dc7f82bbdb045dd8a049f27cf6ddcaf8
7
+ data.tar.gz: b130318a0db1552d3cab9946ef5cb46a7b78f7238bea060e35f2cc623b974940446805eff8dc8a86ccb65c1d151ef5d37e9ef00ab5746d5d91afe36faa3d9f00
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Change log of httpotemkin
2
+
3
+ ## Version 0.0.2
4
+
5
+ * Support running servers and clients separate from executing the test. This
6
+ allows to share the same container instances between tests, where the state
7
+ of the container doesn't change between tests.
8
+
9
+ ## Version 0.0.1
10
+
11
+ * Initial release
data/bin/httpotemkin CHANGED
@@ -9,7 +9,9 @@ containers.add_server("obs")
9
9
 
10
10
  cmd = ARGV[0]
11
11
 
12
- if cmd == "status"
12
+ if cmd == "version"
13
+ puts Httpotemkin::VERSION
14
+ elsif cmd == "status"
13
15
  containers.print_status
14
16
  elsif cmd == "up"
15
17
  puts "Starting server containers"
data/httpotemkin.gemspec CHANGED
@@ -1,6 +1,8 @@
1
+ require File.expand_path("../lib/version", __FILE__)
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = 'httpotemkin'
3
- s.version = '0.0.1'
5
+ s.version = Httpotemkin::VERSION
4
6
  s.license = 'MIT'
5
7
  s.platform = Gem::Platform::RUBY
6
8
  s.authors = ['Cornelius Schumacher']
data/lib/httpotemkin.rb CHANGED
@@ -3,3 +3,4 @@ require "terminal-table"
3
3
  require_relative "containers"
4
4
  require_relative "test"
5
5
  require_relative "client"
6
+ require_relative "version"
data/lib/test.rb CHANGED
@@ -19,5 +19,19 @@ module Httpotemkin
19
19
  @containers.down
20
20
  end
21
21
  end
22
+
23
+ def up
24
+ @containers.up
25
+ end
26
+
27
+ def down
28
+ @containers.stop_client
29
+ @containers.down
30
+ end
31
+
32
+ def start_client
33
+ @containers.start_client
34
+ Client.new(@containers)
35
+ end
22
36
  end
23
37
  end
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Httpotemkin
2
+ VERSION = "0.0.2"
3
+ end
@@ -23,6 +23,12 @@ Commands:
23
23
  end
24
24
  end
25
25
 
26
+ describe "version" do
27
+ it "shows version" do
28
+ expect(run_command(args: ["version"])).to exit_with_success("#{Httpotemkin::VERSION}\n")
29
+ end
30
+ end
31
+
26
32
  describe "status" do
27
33
  it "shows status" do
28
34
  with_stubbed_binary("bin/status/docker") do
@@ -1,20 +1,53 @@
1
1
  require_relative "spec_helper"
2
2
 
3
3
  describe "hello world" do
4
- it "answers" do
5
- out = double
6
- allow(out).to receive(:puts)
4
+ context "server started in test" do
5
+ it "answers" do
6
+ out = double
7
+ allow(out).to receive(:puts)
7
8
 
8
- test = Httpotemkin::Test.new(out: out)
9
- test.add_server("server")
9
+ test = Httpotemkin::Test.new(out: out)
10
+ test.add_server("server")
10
11
 
11
- test.run do |client|
12
+ test.run do |client|
13
+ sleep 2
14
+ client.execute(["curl", "server/hello"])
15
+
16
+ expect(client.exit_code).to eq(0)
17
+ expect(client.out).to eq("world\n")
18
+ expect(client.err.empty?).to be(true)
19
+ end
20
+ end
21
+ end
22
+
23
+ context "server started before test" do
24
+ before(:all) do
25
+ out = StringIO.new
26
+ @test = Httpotemkin::Test.new(out: out)
27
+ @test.add_server("server")
28
+ @test.up
29
+ @client = @test.start_client
12
30
  sleep 2
13
- client.execute(["curl", "server/hello"])
31
+ end
32
+
33
+ it "answers once" do
34
+ @client.execute(["curl", "server/hello"])
35
+
36
+ expect(@client.exit_code).to eq(0)
37
+ expect(@client.out).to eq("world\n")
38
+ expect(@client.err.empty?).to be(true)
39
+ end
40
+
41
+ it "answers twice" do
42
+ @client.execute(["curl", "server/hello"])
43
+
44
+ expect(@client.exit_code).to eq(0)
45
+ expect(@client.out).to eq("world\n")
46
+ expect(@client.err.empty?).to be(true)
47
+ end
14
48
 
15
- expect(client.exit_code).to eq(0)
16
- expect(client.out).to eq("world\n")
17
- expect(client.err.empty?).to be(true)
49
+ after(:all) do
50
+ @test.down
18
51
  end
19
52
  end
20
53
  end
data/yes_ship_it.conf ADDED
@@ -0,0 +1,3 @@
1
+ # Experimental release automation. See https://github.com/cornelius/yes_ship_it.
2
+ include:
3
+ ruby_gem
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpotemkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cornelius Schumacher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -76,6 +76,7 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
+ - CHANGELOG.md
79
80
  - CONTRIBUTING.md
80
81
  - Gemfile
81
82
  - MIT-LICENSE
@@ -107,6 +108,7 @@ files:
107
108
  - lib/containers.rb
108
109
  - lib/httpotemkin.rb
109
110
  - lib/test.rb
111
+ - lib/version.rb
110
112
  - logs/.gitignore
111
113
  - spec/integration/bin/client/docker
112
114
  - spec/integration/bin/down/docker
@@ -121,6 +123,7 @@ files:
121
123
  - spec/system/data/test.tar.gz
122
124
  - spec/system/hello_world_spec.rb
123
125
  - spec/system/spec_helper.rb
126
+ - yes_ship_it.conf
124
127
  homepage: https://github.com/cornelius/httpotemkin
125
128
  licenses:
126
129
  - MIT
@@ -141,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
144
  version: 1.3.6
142
145
  requirements: []
143
146
  rubyforge_project: httpotemkin
144
- rubygems_version: 2.2.2
147
+ rubygems_version: 2.4.5.1
145
148
  signing_key:
146
149
  specification_version: 4
147
150
  summary: Mock HTTP services for system tests
148
151
  test_files: []
149
- has_rdoc: