Skip to content

Commit

Permalink
handle "_" for trashed cards
Browse files Browse the repository at this point in the history
  • Loading branch information
xithan committed Jan 10, 2017
1 parent f41e481 commit 8f823be
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions card/lib/card/format/nest/fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def fetch_nested_card cardish, opts={}
case cardish
when Card then cardish
when Symbol, Integer then Card.fetch cardish
when "_", "_self" then card.context_card
else
opts[:nest_name] = cardish.to_s
Card.fetch cardish, new: nest_new_args(opts)
Expand Down
20 changes: 17 additions & 3 deletions card/mod/account/spec/set/right/account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,23 @@
end

describe "#send_change_notice" do
it "send multipart email" do
skip
# pending
subject(:mail) do
Card[:follower_notification_email].format.render_mail(
context: Card.fetch("A", look_in_trash: true),
to: "joe@user.com",
follower: Card["Joe User"],
followed_set: Card[:all],
follow_option: Card[:always]
)
end

it "works for deleted card" do
delete "A"
expect(mail.subject).to eq 'Joe User deleted "A"'
end

it "sends multipart email" do
expect(mail.content_type).to include("multipart/alternative")
end

context "denied access" do
Expand Down
6 changes: 3 additions & 3 deletions card/spec/lib/card/format/render_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

let(:cache_key) do
"a-Card::Format::HtmlFormat-normal-home_view:content;"\
"nest_name:A;nest_syntax:A;view:contentcontent:show"
"nest_name:A;nest_syntax:A|content;view:contentcontent:show"
end

subject { Card::Cache[Card::View] }

it "can be changed with nest option" do
is_expected.to receive(:fetch).with cache_key
render_content "{{A}}"
render_content "{{A|content}}"
is_expected.not_to receive(:fetch)
render_content "{{A|content;cache:never}}"
render_content "{{A|cache:never}}"
end
end
end

0 comments on commit 8f823be

Please sign in to comment.