almost failing cuke
This commit is contained in:
parent
de757db48b
commit
4382d45e82
5 changed files with 68 additions and 0 deletions
|
|
@ -24,6 +24,11 @@ Feature: posting from the main page
|
|||
And I go to the aspects page
|
||||
Then I should see "I am eating a yogurt" within ".stream_element"
|
||||
|
||||
Scenario: posting a message appends it to the top of the stream
|
||||
Given I have a prexisting post
|
||||
And I post "hey there"
|
||||
Then I should see "hello there" as the first post in my stream
|
||||
|
||||
Scenario: post a text-only message to just one aspect
|
||||
When I select only "PostingTo" aspect
|
||||
And I expand the publisher
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ end
|
|||
|
||||
World(FactoryMethods)
|
||||
|
||||
Given /I have a prexisting post/ do
|
||||
Factory(:status_message, :author => @me.person, :public => true)
|
||||
end
|
||||
|
||||
Given %r{^I have a (.+)$} do |model_name|
|
||||
create_from_table(model_name, {}, 'user' => @me)
|
||||
end
|
||||
|
|
|
|||
18
features/step_definitions/message_steps.rb
Normal file
18
features/step_definitions/message_steps.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Then /^I should see the "(.*)" message$/ do |message|
|
||||
text = case message
|
||||
when "alice is excited"
|
||||
@alice ||= Factory(:user, :username => "Alice")
|
||||
I18n.translate('invitation_codes.excited', :name => @alice.name)
|
||||
when "welcome to diaspora"
|
||||
I18n.translate('users.getting_started.well_hello_there')
|
||||
when 'you are safe for work'
|
||||
I18n.translate('profiles.edit.you_are_safe_for_work')
|
||||
when 'you are nsfw'
|
||||
I18n.translate('profiles.edit.you_are_nsfw')
|
||||
when 'hello'
|
||||
"well hello there man"
|
||||
else
|
||||
raise "muriel, you don't have that message key, add one here"
|
||||
end
|
||||
page.should have_content(text)
|
||||
end
|
||||
|
|
@ -34,3 +34,15 @@ end
|
|||
When /^I click on the first block button/ do
|
||||
find(".block_user").click
|
||||
end
|
||||
|
||||
|
||||
|
||||
Then /^"I should see "([^"]*)" as the first post in my stream$/ do |text|
|
||||
first_post_text.should include(text)
|
||||
end
|
||||
|
||||
Given /^"I post "([^"]*)"$/ do |text|
|
||||
make_post(text)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
29
features/support/publishing_cuke_helpers.rb
Normal file
29
features/support/publishing_cuke_helpers.rb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
module PublishingCukeHelpers
|
||||
def make_post(text)
|
||||
click_publisher
|
||||
fill_in 'status_message_fake_text', :with => text
|
||||
click_button :submit
|
||||
end
|
||||
|
||||
def click_publisher
|
||||
page.execute_script('
|
||||
$("#publisher").removeClass("closed");
|
||||
$("#publisher").find("textarea").focus();
|
||||
')
|
||||
end
|
||||
|
||||
def first_post_text
|
||||
find('.stream_element:first .post-content').text()
|
||||
end
|
||||
|
||||
def find_post_by_text(text)
|
||||
find(".stream_element:contains('#{text}')")
|
||||
end
|
||||
|
||||
def assert_nsfw(text)
|
||||
post = find_post_by_text(text)
|
||||
post.find(".shield").should be_present
|
||||
end
|
||||
end
|
||||
|
||||
World(PublishingCukeHelpers)
|
||||
Loading…
Reference in a new issue