Skip to content

Commit 19a159d

Browse files
committed
fix test case.
1 parent 73a08a3 commit 19a159d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

spec/helpers/topics_helper_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,14 @@
167167
it "should result when logined user did not favorite topic" do
168168
allow(user).to receive(:favorite_topic_ids).and_return([])
169169
allow(helper).to receive(:current_user).and_return(user)
170-
expect(helper.topic_favorite_tag(topic)).to eq(%(<a class="icon small_bookmark" data-id="#{topic.id}" href="#" onclick="return Topics.favorite(this);" rel="twipsy" title="收藏"></a>))
170+
res = helper.topic_favorite_tag(topic)
171+
expect(res).to eq(%(<a class="icon small_bookmark" title="收藏" rel="twipsy" onclick="return Topics.favorite(this);" data-id="#{topic.id}" href="#"></a>))
171172
end
172173

173174
it "should result when logined user favorited topic" do
174175
allow(user).to receive(:favorite_topic_ids).and_return([topic.id])
175176
allow(helper).to receive(:current_user).and_return(user)
176-
expect(helper.topic_favorite_tag(topic)).to eq(%(<a class="icon small_bookmarked" data-id="#{topic.id}" href="#" onclick="return Topics.favorite(this);" rel="twipsy" title="取消收藏"></a>))
177+
expect(helper.topic_favorite_tag(topic)).to eq(%(<a class="icon small_bookmarked" title="取消收藏" rel="twipsy" onclick="return Topics.favorite(this);" data-id="#{topic.id}" href="#"></a>))
177178
end
178179

179180
it "should result blank when unlogin user" do

spec/helpers/users_helper_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
context "url without protocal" do
3838
before { user.update_attribute(:website, 'example.com') }
3939

40-
it { is_expected.to eq(link_to("http://" + user.website, "http://" + user.website, :class => "url", :target => "_blank", :rel => "nofollow")) }
40+
it { is_expected.to eq(link_to("http://" + user.website, "http://" + user.website, :target => "_blank", :class => "url", :rel => "nofollow")) }
4141
end
4242
end
4343
end

0 commit comments

Comments
 (0)