Skip to content

Commit

Permalink
Refactoring a test into 3 tests created by an iterator; hopefully mak…
Browse files Browse the repository at this point in the history
…es intention and failures clearer
  • Loading branch information
carols10cents committed May 1, 2012
1 parent 31aeca5 commit dc51546
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions test/acceptance/update_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,16 @@
assert_match page.body, /#{update_text}/
end

it "stays on the same page after updating" do
log_in_as_some_user

visit "/updates"
fill_in "text", :with => "Teststring fuer die Ewigkeit ohne UTF-8 Charakter"
VCR.use_cassette('publish_to_hub') {click_button "Share"}

assert_match "/updates", page.current_url

visit "/replies"
fill_in "text", :with => "Bratwurst mit Pommes rot-weiss"
VCR.use_cassette('publish_to_hub') {click_button "Share"}

assert_match "/replies", page.current_url
["/updates", "/replies", "/"].each do |url|
it "stays on the #{url} page after making an update there" do
log_in_as_some_user

visit "/"
fill_in "text", :with => "Buy a test string. Your name in this string for only 1 Euro/character"
VCR.use_cassette('publish_to_hub') {click_button "Share"}
visit url
fill_in "text", :with => "Buy a test string. Your name in this string for only 1 Euro/character"
VCR.use_cassette('publish_to_hub') { click_button "Share" }

assert_match "/", page.current_url
assert_match url, page.current_url, "Ended up on #{page.current_url}, expected to be on #{url}"
end
end

it "shows one update" do
Expand Down

0 comments on commit dc51546

Please sign in to comment.