
У вас есть идея? И вы уверены что она стоящая? И эту идею можно воплотить в изобретение?
Теперь вы можете не только продать ее, но и неплохо заработать!
User
bundle install
). Исходник Gemfile:source :rubygems
gem "watir-webdriver", "~>0.6.1"
gem "rspec-core", "~> 2.0"
gem "rspec-expectations", "~> 2.0"
gem "rr", "~> 1.0"
gem "ci_reporter", "~> 1.7"
describe "FirstSite" do
before(:all) do
site! "first"
end
# returns true on success; otherwise false.
def login_as(data)
browser.rel_goto "/"
browser.title.should include 'example.com'
browser.text_field(:id => 'login').set data[:login]
browser.text_field(:id => 'password').set data[:password]
submit_button = browser.button(:id => 'submit')
submit_button.click
browser.url =~ %r{/welcome$}
end
def logout
browser.rel_goto "/"
browser.button(:id => 'logout').click
end
describe :login do
auth = fixture :auth
describe :successful do
after(:each) do
logout
end
auth.keys.select { |key| key.kind_of?(Symbol) }.each do |key|
next if key == :wrong
it "Logging in as #{key} should be OK" do
login_as(auth[key]).should be_true
end
end
end
describe :wrong do
it "Logging in with wrong credentials should fail" do
login_as(auth[:wrong]).should_not be_true
end
end
end
end