diaspora/features/step_definitions/comment_steps.rb
2016-08-12 12:55:06 +02:00

35 lines
1 KiB
Ruby

When /^I focus the comment field$/ do
focus_comment_box
end
Then /^the first comment field should be open/ do
find("#main_stream .stream_element .new_comment").should be_visible
end
Then /^the first comment field should be closed$/ do
page.should have_css(".stream_element .media")
page.should_not have_selector("#main_stream .stream_element .new_comment", match: :first)
end
When /^I make a show page comment "([^"]*)"$/ do |comment_text|
comment_on_show_page(comment_text)
end
Given /^"([^"]*)" has commented "([^"]*)" on "([^"]*)"$/ do |email, comment_text, post_text|
user = User.find_by(email: email)
post = StatusMessage.find_by(text: post_text)
user.comment!(post, comment_text)
end
Given /^"([^"]*)" has commented a lot on "([^"]*)"$/ do |email, post_text|
user = User.find_by(email: email)
post = StatusMessage.find_by(text: post_text)
time = Time.zone.now - 1.year
Timecop.freeze do
(1..10).each do |n|
Timecop.travel time += 1.day
user.comment!(post, "Comment #{n}")
end
end
Timecop.return
end