Skip to content

Commit

Permalink
adding another set_url_matcher example
Browse files Browse the repository at this point in the history
  • Loading branch information
natritmeyer committed Apr 18, 2012
1 parent 8164b5a commit 47f16a5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Expand Up @@ -137,8 +137,22 @@ Then /^the account page is displayed$/ do
end
```

Another example that demonstrates why using regex instead of string
comparison for URL checking is when you want to be able to run your
tests across multiple environments.

The above example would
```ruby
class Login < SitePrism::Page
set_url "#{$test_environment}.example.com/login" #=> global var used for demonstration purposes only!!!
set_url_matcher /(?:dev|test|www)\.example\.com\/login/
end
```

The above example would work for `dev.example.com/login`,
`test.example.com/login` and `www.example.com/login`; now your tests
aren't limited to one environment but can verify that they are on the
correct page regardless of the environment the tests are being executed
against.


# This README.md file is a work in progress. It should be finished soon...
Expand Down

0 comments on commit 47f16a5

Please sign in to comment.