Skip to content

Commit

Permalink
fixing cukes
Browse files Browse the repository at this point in the history
  • Loading branch information
xithan committed Feb 17, 2015
1 parent de2061b commit 9af7886
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 34 deletions.
1 change: 1 addition & 0 deletions card/lib/card.rb
Expand Up @@ -2,6 +2,7 @@

Object.send :remove_const, :Card if Object.send(:const_defined?, :Card)


class Card < ActiveRecord::Base
require_dependency 'card/active_record_ext'
require_dependency 'card/codename'
Expand Down
2 changes: 0 additions & 2 deletions card/lib/card/loader.rb
Expand Up @@ -84,8 +84,6 @@ def load_set_patterns_from_source
end

def load_formats
require 'pry'
binding.pry
#cheating on load issues now by putting all inherited-from formats in core mod.
mod_dirs.each do |mod|
load_dir "#{mod}/format/*.rb"
Expand Down
2 changes: 1 addition & 1 deletion card/lib/card/migration.rb
Expand Up @@ -29,7 +29,7 @@ def find_unused_name base_name
end

def paths mig_type=type
Card.paths["db/migrate#{schema_suffix type}"].to_a
Cardio.paths["db/migrate#{schema_suffix type}"].to_a
end

def schema_suffix mig_type=type
Expand Down
1 change: 0 additions & 1 deletion card/lib/card/set.rb
Expand Up @@ -241,7 +241,6 @@ class Card; module Set; module #{set_pattern.camelize}; #{anchor_modules}
# "base modules" are modules that are permanently included on the Card or Format class
# "nonbase modules" are included dynamically on singleton_classes
def process_base_modules
#binding.pry
process_base_module_list modules[:base], Card
modules[:base_format].each do |format_class, modules_list|
process_base_module_list modules_list, format_class
Expand Down
4 changes: 2 additions & 2 deletions card/mod/03_machines/lib/javascript/wagn_menu.js
Expand Up @@ -54,8 +54,8 @@ wagn.menu_template = [
}
]
},
{ "text":"%{follow_text}", "view":"options", "if":"show_follow", "sub":[
{ "link":"follow" },
{ "link":"follow_menu", "if":"show_follow", "sub":[
{ "link":"follow_submenu" },
{ "text":"advanced", "related":"following"}
]
},
Expand Down
25 changes: 19 additions & 6 deletions card/mod/05_email/set/all/follow.rb
Expand Up @@ -30,9 +30,15 @@


format :html do
view :follow, :tags=>[:unknown_ok, :no_wrap_comments], :denial=>:blank, :perms=>:none do |args|
view :follow_menu_link do |args|
wrap(args) do
render_follow_link args
render_follow_link( args.merge(:label=>'',:main_menu=>true) )
end
end

view :follow_submenu_link, :tags=>[:unknown_ok, :no_wrap_comments], :denial=>:blank, :perms=>:none do |args|
wrap(args) do
render_follow_link args.merge(:hover=>true)
end
end

Expand All @@ -51,20 +57,27 @@
when :off
path_options['card[content]']= '[[never]]'
html_options[:title] = "stop sending emails about changes to #{args[:label]}"
html_options[:hover_content] = "unfollow #{args[:label]}"
html_options[:text] = "following #{args[:label]}"
if args[:hover]
html_options[:hover_content] = "unfollow #{args[:label]}"
html_options[:text] = "following #{args[:label]}"
else
html_options[:text] = "unfollow #{args[:label]}"
end
when :on
path_options['card[content]']= '[[always]]'
html_options[:title] = "send emails about changes to #{args[:label]}"
html_options[:text] = "follow #{args[:label]}"
end
if args[:main_menu]
html_options[:text] = content_tag( :span, '', :class=>"ui-menu-icon ui-icon ui-icon-carat-1-w") + html_options[:text]
end
follow_rule_name = card.default_follow_set_card.follow_rule_name Auth.current.name
card_link follow_rule_name, html_options.merge(:path_opts=>path_options,:success=>{:view=>:follow})
end

def default_follow_link_args args
args[:toggle] = card.followed? ? :off : :on
args[:label] = card.follow_label
args[:toggle] ||= card.followed? ? :off : :on
args[:label] ||= card.follow_label
end

end
Expand Down
12 changes: 4 additions & 8 deletions card/mod/05_standard/set/all/rich_html/header.rb
Expand Up @@ -39,9 +39,9 @@
:edit => card.ok?(:update),
:account => card.account && card.ok?(:update),
:show_follow => Auth.signed_in? && !card.new_card?,
:follow_text => follow_or_unfollow,
:follow => render_follow,
:follow_link => render_follow_link,
:follow_text => follow_or_unfollow,
:follow_menu => render_follow_menu_link,
:follow_submenu => render_follow_submenu_link,
:creator => card.creator.name,
:updater => card.updater.name,
:delete => card.ok?(:delete) && link_to( 'delete', :action=>:delete,
Expand All @@ -59,11 +59,7 @@
end

def follow_or_unfollow
if (card.type_code == :set && card.all_members_followed?) || card.followed?
'follow'
else
'unfollow'
end
card.followed? ? 'unfollow' : 'follow'
end
end

8 changes: 4 additions & 4 deletions wagn/features/follow.feature
Expand Up @@ -18,10 +18,10 @@ Feature: Follow interface
When I go to the homepage
And I hover over the main menu
And In the main card menu I click "follow"
Then In the main card menu I should see "following|unfollow"
Then In the main card menu I should see "unfollow"
# assumes focus still on that link. otherwise "following"
# selenium behavior not totally consistent here.
And the card Home+*self+*follow+Joe User should contain "always"
And the card Home+*self+Joe User+*follow should contain "always"

Scenario: Unfollowing a Card
Given Joe User is watching "Home+*self"
Expand All @@ -31,13 +31,13 @@ Feature: Follow interface
#note: the link name turns from "follwing" to "unfollow" on mouseover and because we don't control the mouse's position
# this test randomly fails if we use the link name
Then In the main card menu I should see "follow"
And the card Home+*self+*follow+Joe User should not contain "always"
And the card Home+*self+Joe User+*follow should not contain "always"

Scenario: Following a Cardtype
When I go to card User
And I hover over the main menu
And In the main card menu I should see "follow all"
And In the main card menu I should not see "|"
#And In the main card menu I should not see "|"

Scenario: A Card whose Cardtype is Followed
Given Joe User is watching "User+*type"
Expand Down
8 changes: 1 addition & 7 deletions wagn/features/step_definitions/wagn_steps.rb
Expand Up @@ -103,12 +103,6 @@
end
end

When /^(.*) creates?\s*a?\s*([^\s]*) card "(.*)" with content$/ do |username, cardtype, cardname, content|
create_card(username, cardtype, cardname, content) do
fill_in("card[content]", :with=>content)
end
end

When /^(.*) creates?\s*([^\s]*) card "([^"]*)"$/ do |username, cardtype, cardname|
create_card(username,cardtype,cardname)
end
Expand Down Expand Up @@ -213,7 +207,7 @@ def signed_in_as username
end

When /^I hover over the main menu$/ do
page.execute_script "$('#main > .card-slot > .card-header > .card-menu-link').trigger('mouseenter')"
page.execute_script "$('#main > .card-slot > .panel-heading > .card-header > .card-menu-link').trigger('mouseenter')"
end

When /^I pick (.*)$/ do |menu_item|
Expand Down
2 changes: 1 addition & 1 deletion wagn/features/support/scopes.rb
Expand Up @@ -10,7 +10,7 @@ def scope_of section
'#main > .card-slot > .card-header'

when /main card menu/
'#main > .card-slot > .card-menu'
'#main > .card-slot > ul.card-menu'

else
raise "Can't find mapping from \"#{section}\" to a scope.\n" +
Expand Down
2 changes: 0 additions & 2 deletions wagn/lib/wagn/commands.rb
Expand Up @@ -81,8 +81,6 @@ def find_spec_file filename, base_dir
Rake::Task['wagn:update'].invoke
when 'cucumber'
require 'wagn'
require 'cardio'
require 'decko/engine'
feature_paths = Dir.glob("./mod/**/features")
require_args = "-r #{Wagn.gem_root}/features "
require_args += feature_paths.map { |path| "-r #{path}"}.join(' ')
Expand Down

0 comments on commit 9af7886

Please sign in to comment.