remove unused steps
This commit is contained in:
parent
c69853e0cf
commit
d489dfc8e3
8 changed files with 2 additions and 193 deletions
|
|
@ -75,10 +75,6 @@ And /^I expand the publisher$/ do
|
|||
click_publisher
|
||||
end
|
||||
|
||||
When 'I click the aspects title' do
|
||||
find('.home_selector').click
|
||||
end
|
||||
|
||||
When /^I press the aspect dropdown$/ do
|
||||
find('.dropdown .button').click
|
||||
end
|
||||
|
|
@ -88,10 +84,6 @@ And /^I toggle the aspect "([^"]*)"$/ do |aspect_name|
|
|||
find(".dropdown li[data-aspect_id='#{aspect.id}']").click
|
||||
end
|
||||
|
||||
Then /^the publisher should be collapsed$/ do
|
||||
find("#publisher")["class"].should include("closed")
|
||||
end
|
||||
|
||||
Then /^the publisher should be expanded$/ do
|
||||
find("#publisher")["class"].should_not include("closed")
|
||||
end
|
||||
|
|
@ -147,10 +139,6 @@ When /^I click to delete the first uploaded photo$/ do
|
|||
find("#photodropzone .x", match: :first).click
|
||||
end
|
||||
|
||||
And /^I click "([^"]*)" button$/ do |arg1|
|
||||
page.execute_script('$(".button:contains('+arg1+')").click()')
|
||||
end
|
||||
|
||||
And /^I click on selector "([^"]*)"$/ do |selector|
|
||||
find(selector).click
|
||||
end
|
||||
|
|
@ -220,10 +208,6 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)"
|
|||
end
|
||||
end
|
||||
|
||||
Then /^I should see (\d+) posts$/ do |n_posts|
|
||||
has_css?("#main_stream .stream_element", :count => n_posts.to_i).should be_true
|
||||
end
|
||||
|
||||
Then /^I should see (\d+) contacts$/ do |n_posts|
|
||||
has_css?("#people_stream .stream_element", :count => n_posts.to_i).should be_true
|
||||
end
|
||||
|
|
@ -242,12 +226,6 @@ When /^I resize my window to 800x600$/ do
|
|||
JS
|
||||
end
|
||||
|
||||
Then /^I follow Edit Profile in the same window$/ do
|
||||
page.execute_script("$('a[href=\"#{edit_profile_path}\"]').removeAttr('target')")
|
||||
|
||||
step %(I follow "Edit Profile")
|
||||
end
|
||||
|
||||
Then 'I should see an image attached to the post' do
|
||||
step %{I should see a "img" within ".stream_element div.photo_attachments"}
|
||||
end
|
||||
|
|
@ -265,22 +243,10 @@ And /^I click close on all the popovers$/ do
|
|||
page.should_not have_selector(".popover .close")
|
||||
end
|
||||
|
||||
Then /^I should see first post deletion link$/ do
|
||||
page.should have_selector '.stream_element .delete', match: :first
|
||||
end
|
||||
|
||||
Then /^I should not see ajax loader on deletion link place$/ do
|
||||
page.should_not have_selector '.hide_loader'
|
||||
end
|
||||
|
||||
Then /^I should see a flash message indicating success$/ do
|
||||
flash_message_success?.should be_true
|
||||
end
|
||||
|
||||
Then /^I should see a flash message indicating failure$/ do
|
||||
flash_message_failure?.should be_true
|
||||
end
|
||||
|
||||
Then /^I should see a flash message containing "(.+)"$/ do |text|
|
||||
flash_message_containing? text
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
module FactoryMethods
|
||||
def create_from_table(model_name, table, extra = {})
|
||||
factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
|
||||
is_singular = model_name.to_s.singularize == model_name.to_s
|
||||
hashes = if is_singular
|
||||
if table.kind_of?(Hash)
|
||||
[table]
|
||||
else
|
||||
[table.rows_hash]
|
||||
end
|
||||
else
|
||||
table.hashes
|
||||
end
|
||||
klass = FactoryGirl.factories[factory_name].class_name.to_s.classify.constantize
|
||||
@they = hashes.map do |hash|
|
||||
hash = hash.merge(extra).inject({}) do |h,(k,v)|
|
||||
k = k.gsub(/\W+/,'_')
|
||||
v = v.split(/\s*,\s*/) if klass.serialized_attributes[k] == Array
|
||||
h.update(k.to_sym => v)
|
||||
end
|
||||
object = FactoryGirl.build(factory_name, hash)
|
||||
yield object if block_given?
|
||||
object.save!
|
||||
object
|
||||
end
|
||||
if is_singular
|
||||
@it = @they.last
|
||||
instance_variable_set("@#{factory_name}", @it)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
World(FactoryMethods)
|
||||
|
||||
Given %r{^I have a (.+)$} do |model_name|
|
||||
create_from_table(model_name, {}, 'user' => @me)
|
||||
end
|
||||
|
||||
Given %r{^I have the following (.+):$} do |child, table|
|
||||
step "that me has the following #{child}:", table
|
||||
end
|
||||
|
||||
Given %r{^the following (.+):$} do |model_name, table|
|
||||
create_from_table(model_name, table)
|
||||
end
|
||||
|
||||
Given %r{^that (.+) has the following (.+):$} do |parent, child, table|
|
||||
child= child.gsub(/\W+/,'_')
|
||||
parent = parent.gsub(/\W+/,'_').downcase.sub(/^_/, '')
|
||||
parent_instance = instance_variable_get("@#{parent}")
|
||||
parent_class = parent_instance.class
|
||||
if assoc = parent_class.reflect_on_association(child.to_sym) || parent_class.reflect_on_association(child.pluralize.to_sym)
|
||||
parent = (assoc.options[:as] || parent).to_s
|
||||
child = (assoc.options[:class_name] || child).to_s
|
||||
end
|
||||
if child.classify.constantize.method_defined?(parent.pluralize)
|
||||
create_from_table(child, table, parent.pluralize => [parent_instance])
|
||||
elsif child.classify.constantize.method_defined?(parent)
|
||||
create_from_table(child, table, parent => parent_instance)
|
||||
else
|
||||
create_from_table(child, table)
|
||||
if assoc.macro == :has_many
|
||||
parent_instance.send("#{assoc.name}=", @they)
|
||||
else
|
||||
parent_instance.send("#{assoc.name}=", @they.first)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
Then /^the post "([^"]*)" should be marked nsfw$/ do |text|
|
||||
assert_nsfw(text)
|
||||
end
|
||||
|
||||
Then /^the post should be collapsed$/ do
|
||||
first_post_collapsed?
|
||||
end
|
||||
|
|
@ -38,10 +34,6 @@ And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email|
|
|||
user.post(:reshare, :root_guid => root.guid, :public => true, :to => user.aspects)
|
||||
end
|
||||
|
||||
When /^The user deletes their first post$/ do
|
||||
@me.posts.first.destroy
|
||||
end
|
||||
|
||||
When /^I click on the first block button/ do
|
||||
find(".block_user", visible: false).click
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
module SectionLocator
|
||||
def within_parent(content, elements = ['*'], &block)
|
||||
expr = %(//*[(#{elements.join('|')})/descendant-or-self::*[contains(., "#{content}")]])
|
||||
within(expr, &block)
|
||||
end
|
||||
end
|
||||
|
||||
World(SectionLocator)
|
||||
|
||||
sections = %w(h1 h2 h3 h4 h5 h6 legend caption dt strong header)
|
||||
|
||||
When /^(.*) in the "([^\"]*)" section$/ do |action, title|
|
||||
within_parent(title, sections) do
|
||||
step action
|
||||
end
|
||||
end
|
||||
|
||||
When /^(.*) in the "([^\"]*)" section:$/ do |action, title, table|
|
||||
within_parent(title, sections) do
|
||||
step "#{action}:", table
|
||||
end
|
||||
end
|
||||
|
||||
When /^(.*) in the "([^\"]*)" row$/ do |action, title|
|
||||
within_parent(title, %w(th td)) do
|
||||
step action
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +1,8 @@
|
|||
|
||||
Given /^(?:I am signed in|I sign in)$/ do
|
||||
Given /^(?:I am signed in)$/ do
|
||||
automatic_login
|
||||
confirm_login
|
||||
end
|
||||
|
||||
When /^I try to sign in$/ do
|
||||
automatic_login
|
||||
end
|
||||
|
||||
When /^I try to sign in manually$/ do
|
||||
manual_login
|
||||
end
|
||||
|
|
@ -62,4 +57,4 @@ end
|
|||
|
||||
When /^I (?:log|sign) out manually$/ do
|
||||
manual_logout
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
Then /^I should see an image in the publisher$/ do
|
||||
photo_in_publisher.should be_present
|
||||
end
|
||||
|
||||
Then /^I like the post "([^"]*)"$/ do |post_text|
|
||||
like_post(post_text)
|
||||
end
|
||||
|
|
@ -17,9 +13,3 @@ end
|
|||
Then /^I should have (\d+) nsfw posts$/ do |num_posts|
|
||||
page.should have_css(".nsfw-shield", count: num_posts.to_i)
|
||||
end
|
||||
|
||||
When /^I click the show page link for "([^"]*)"$/ do |post_text|
|
||||
within(find_post_by_text(post_text)) do
|
||||
find("time").click
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
Given /^I have posts for each type of template$/ do
|
||||
generate_post_of_each_template(@me)
|
||||
end
|
||||
|
||||
Then /^I visit all of my posts$/ do
|
||||
lambda{ @templates_seen = visit_posts_and_collect_template_names(@me)}.should_not raise_error
|
||||
end
|
||||
|
||||
When /^I should have seen all of my posts displayed with the correct template$/ do
|
||||
pending
|
||||
@templates_seen.should =~ TemplatePicker.jsonified_templates
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
When /^I visit url ([^ ]+)$/ do |url|
|
||||
visit( url)
|
||||
end
|
||||
|
||||
Then /^I should find '([^']*)' in ([^ ]+)$/ do |pattern,file|
|
||||
found = %x!fgrep -o #{pattern} #{file}!
|
||||
assert_equal pattern, found.chomp, "Can't find pattern in #{file}"
|
||||
end
|
||||
|
||||
Then /^I should match '([^']*)' in ([^ ]+)$/ do |pattern,file|
|
||||
found = `egrep -o '#{pattern}' #{file}`
|
||||
assert_match /#{pattern}/, found.chomp, "Can't find #{pattern} in #{file}"
|
||||
end
|
||||
|
||||
When /^I retrieve ([^ ]+) into ([^ ]+)$/ do |url,file|
|
||||
system( "wget -q -O #{file} #{url}")
|
||||
end
|
||||
|
||||
Then /^a page\-asset should be ([^ ]+)$/ do |asset_path|
|
||||
page.has_content?(asset_path)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in a new issue