Now with passing Cucumber tests

This commit is contained in:
goobertron 2014-01-13 18:14:43 +00:00
parent a1ac848d62
commit 706b11b14d
4 changed files with 20 additions and 9 deletions

View file

@ -54,7 +54,7 @@
= t('nsfw')
= t('profiles.edit.nsfw_explanation')
%p{:class=>"checkbox_select"}
= check_box_tag 'profile[nsfw]', true, profile.nsfw
= check_box_tag 'profile[nsfw]', true, profile.nsfw?
= label_tag 'profile[nsfw]', t('profiles.edit.nsfw_check')
= t('profiles.edit.nsfw_explanation2')
%br

View file

@ -7,14 +7,15 @@ Scenario: Setting not safe for work
| pr0n king | tommy@pr0n.xxx |
And I sign in as "tommy@pr0n.xxx"
When I go to the edit profile page
And I should see the "you are safe for work" message
And I mark myself as not safe for work
And I submit the form
Then I should be on the edit profile page
And I should see the "you are nsfw" message
When I mark myself as safe for work
And the "profile[nsfw]" checkbox should be checked
When I go to the edit profile page
And I mark myself as safe for work
And I submit the form
Then I should see the "you are safe for work" message
Then I should be on the edit profile page
And the "profile[nsfw]" checkbox should not be checked
Scenario: Toggling nsfw state
#Nsfw users posts are marked nsfw

View file

@ -5,10 +5,6 @@ Then /^I should see the "(.*)" message$/ do |message|
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 'post not public'
I18n.translate('error_messages.post_not_public_or_not_exist')
else

View file

@ -5,3 +5,17 @@ end
And /^I mark myself as safe for work$/ do
uncheck('profile[nsfw]')
end
And /^the "profile[nsfw]" checkbox should be checked$/ do |label, selector|
with_scope(selector) do
field_checked = find_field(label)['checked']
field_checked.should be_true
end
end
And /^the "profile[nsfw]" checkbox should not be checked$/ do |label, selector|
with_scope(selector) do
field_checked = find_field(label)['checked']
field_checked.should be_false
end
end