Permalink
Browse files

Parameterized scenario

 + Redeigned the story
 + Parameterized the steps
 + Redefined the expectations
  • Loading branch information...
1 parent 401b190 commit 3859999450ac2c70cbb679e21d9d8d48dd8dff55 @argent-smith committed Sep 13, 2011
Showing with 21 additions and 16 deletions.
  1. +7 −6 features/ping_the_server.feature
  2. +14 −10 features/step_definitions/sirup_steps.rb
View
13 features/ping_the_server.feature
@@ -1,12 +1,13 @@
Feature: Ping the server
- In order to check if SIP server is alive
As a server admin
+ In order to check if SIP server is alive
I want to see any kind of response from the server
Scenario: Try to register
- Given I've instantiated the SIP client
- And I've entered server's address
- And I've entered SIP login
- And I've entered SIP password
- When I send REGISTER message
+ Given I've started the SIP client
+ And I've started a Session in it
+ And I've entered server's address as "sip.rtelekom.net"
+ And I've entered SIP login as "sirup"
+ And I've entered SIP password as "1FDQDGYo"
+ When I send "REGISTER" message
Then I should get a result from server
View
24 features/step_definitions/sirup_steps.rb
@@ -1,24 +1,28 @@
-Given /^I've instantiated the SIP client$/ do
+Given /^I've started the SIP client$/ do
@client = Sirup::SIP::Client.new
end
-Given /^I've entered server's address$/ do
- @client.server = "sip.rtelekom.net"
+Given /^I've started a Session in it$/ do
+ @sess = @client.new_session
end
-Given /^I've entered SIP login$/ do
- @client.login = "sirup"
+Given /^I've entered server's address as "([^"]*)"$/ do |address|
+ @sess.server = address
end
-Given /^I've entered SIP password$/ do
- @client.password = "1FDQDGYo"
+Given /^I've entered SIP login as "([^"]*)"$/ do |login|
+ @sess.login = login
end
-When /^I send REGISTER message$/ do
- @client.send_message :register
+Given /^I've entered SIP password as "([^"]*)"$/ do |password|
+ @sess.password = password
+end
+
+When /^I send "([^"]*)" message$/ do |msg|
+ @sess.send_message msg.downcase.to_sym
end
Then /^I should get a result from server$/ do
- @client.response.code.should exist
+ @sess.response.code.should_not be_nil
end

0 comments on commit 3859999

Please sign in to comment.