Skip to content

Commit

Permalink
Fixed campaign view specs. No csv or xls export for individual items …
Browse files Browse the repository at this point in the history
…exists yet.
  • Loading branch information
steveyken committed Sep 25, 2012
1 parent 5d22faf commit 43811b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 5 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -387,23 +387,24 @@ def shown_on_landing_page?
def links_to_export(action=:index)
token = current_user.single_access_token
url_params = {:action => action}
url_params.merge!(:id => params[:id]) unless params[:id].blank?
url_params.merge!(:query => params[:query]) unless params[:query].blank?
url_params.merge!(:q => params[:q]) unless params[:q].blank?
url_params.merge!(:view => @view) unless @view.blank? # tasks

exports = %w(xls csv).map do |format|
link_to(format.upcase, url_params.merge(:format => format), :title => I18n.t(:"to_#{format}"))
link_to(format.upcase, url_params.merge(:format => format), :title => I18n.t(:"to_#{format}")) unless action.to_s == "show"
end

feeds = %w(rss atom).map do |format|
link_to(format.upcase, url_params.merge(:format => format, :authentication_credentials => token), :title => I18n.t(:"to_#{format}"))
end

links = %W(perm).map do |format|
link_to(format.upcase, url_params, :title => I18n.t(:"to_#{format}"))
end

(exports + feeds + links).join(' | ')
(exports + feeds + links).compact.join(' | ')
end

def template_fields(f, type)
Expand Down
7 changes: 3 additions & 4 deletions spec/views/campaigns/show.haml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
assign(:users, [ current_user ])
assign(:comment, Comment.new)
assign(:timeline, [ FactoryGirl.create(:comment, :commentable => @campaign) ])
view.stub!(:params).and_return({:id => 7})
end

it "should render campaign landing page" do
render
view.should render_template(:partial => "comments/_new")
view.should render_template(:partial => "shared/_timeline")
view.should render_template(:partial => "shared/_tasks")

# XXX: Not rendering due to paginate
#~ view.should render_template(:partial => "leads/_lead")
#~ view.should render_template(:partial => "opportunities/_opportunity")
view.should render_template(:partial => "leads/_leads")
view.should render_template(:partial => "opportunities/_opportunities")

rendered.should have_tag("div[id=edit_campaign]")
end
Expand Down

0 comments on commit 43811b2

Please sign in to comment.