Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6fb359b

Browse files
Adding simple RSpec tests to check python serves up a file
Change-Id: I2f374e29427646c4e4da263a017a7cc8f77aa7b7
1 parent 00985b9 commit 6fb359b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

‎spec/fixtures/helloworld.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello simple world

‎spec/localhost/python_simplehttpserver_spec.rb‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,25 @@ def image
7373
describe port(8080) do
7474
it { should be_listening }
7575
end
76+
77+
context "when serving a test file" do
78+
before(:all) do
79+
Specinfra::Runner.send_file(File.join(File.dirname(__FILE__), '..', 'fixtures', 'helloworld.txt'), '/var/www/')
80+
end
81+
82+
describe file('/var/www/helloworld.txt') do
83+
it { should be_file }
84+
end
85+
86+
describe command('wget -O - http://localhost:8080/helloworld.txt') do
87+
its(:stdout) { should match /^hello simple world$/ }
88+
end
89+
90+
describe command('wget -O - http://localhost:8080/') do
91+
its(:stdout) { should match /Directory listing for \// }
92+
its(:stdout) { should match /<a href="helloworld\.txt">helloworld\.txt<\/a>/ }
93+
end
94+
end
7695
end
7796
end
7897
end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /