diff options
author | Rhenium <rhenium@rhe.jp> | 2013-08-20 22:02:52 +0900 |
---|---|---|
committer | Rhenium <rhenium@rhe.jp> | 2013-08-20 22:02:52 +0900 |
commit | f5024cda933f382516b277516c8c3ffdcc504b6e (patch) | |
tree | 5477799641b1b36acde8130877d8ded74adc5412 /spec | |
parent | 63501b243d377f1f71dcc4640b6b9b6c3ede9bc0 (diff) | |
download | aclog-f5024cda933f382516b277516c8c3ffdcc504b6e.tar.gz |
fix spec
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/tweets_helper_spec.rb | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/spec/helpers/tweets_helper_spec.rb b/spec/helpers/tweets_helper_spec.rb index d25b77c..00c1811 100644 --- a/spec/helpers/tweets_helper_spec.rb +++ b/spec/helpers/tweets_helper_spec.rb @@ -2,15 +2,15 @@ require "spec_helper" describe TweetsHelper do - describe "#user_limit" do - subject { helper.user_limit } + describe "#html_favoriters_limit" do + subject { helper.html_favoriters_limit } - context "when timeline and format is HTML" do + context "when timeline" do before { controller.request.format = :html } it { should eq Settings.tweets.users.count_default } end - context "when tweet and format is HTML" do + context "when tweet" do before do controller.request.format = :html params[:action] = "show" @@ -18,7 +18,7 @@ describe TweetsHelper do it { should eq Settings.tweets.users.count_lot } end - context "when tweet and format is HTML with full=true parameter" do + context "when tweet with full=true parameter" do before do controller.request.format = :html params[:action] = "show" @@ -26,37 +26,23 @@ describe TweetsHelper do end it { should be nil } end - - context "when JSON" do - before { controller.request.format = :json } - it { should be nil } - end - - context "when JSON with `limit` parameter" do - let(:limit) { "123" } - before do - controller.request.format = :json - params[:limit] = limit - end - it { should eq limit.to_i } - end end - describe "#user_truncated?" do + describe "#html_favoriters_truncated?" do let(:user) { FactoryGirl.create(:user) } - subject { helper.user_truncated?(tweet) } + subject { helper.html_favoriters_truncated?(tweet) } context "when full=true" do - before { helper.stub(:user_limit).and_return(nil) } + before { helper.stub(:html_favoriters_limit).and_return(nil) } let(:tweet) { FactoryGirl.create(:tweet, user: user, favorites_count: Settings.tweets.users.count_lot + 1, retweets_count: Settings.tweets.users.count_lot + 1) } it { should be false } end context "when _count equals count_default" do - before { helper.stub(:user_limit).and_return(Settings.tweets.users.count_default) } + before { helper.stub(:html_favoriters_limit).and_return(Settings.tweets.users.count_default) } let(:tweet) { FactoryGirl.create(:tweet, user: user, favorites_count: Settings.tweets.users.count_default, retweets_count: Settings.tweets.users.count_default) } it { should be false } end context "when _count is larger than count_default" do - before { helper.stub(:user_limit).and_return(Settings.tweets.users.count_default) } + before { helper.stub(:html_favoriters_limit).and_return(Settings.tweets.users.count_default) } let(:tweet) { FactoryGirl.create(:tweet, user: user, favorites_count: Settings.tweets.users.count_default, retweets_count: Settings.tweets.users.count_default + 1) } it { should be true } end |