Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix tests broken by models.rb refactoring

  • Loading branch information...
commit f48fe8702a5d3ff91300cbe79f0e0ae12ea71e48 1 parent c63ace7
Ryan Bigg authored
4 spec/by_star/by_day_spec.rb
View
@@ -6,7 +6,7 @@ def posts_count(*args)
end
it "should be able to find a post for today" do
- posts_count.should eql(5)
+ posts_count.should eql(4)
end
it "should be able to find a post by a given date in last year" do
@@ -32,7 +32,7 @@ def posts_count(*args)
describe "yesterday" do
it "should show the post for yesterday" do
- Post.yesterday.map(&:text).should include("Yesterday")
+ Post.yesterday.map(&:text).should include("Yesterday's post")
end
it "should be able to use an alternative field" do
14 spec/by_star/by_direction_spec.rb
View
@@ -5,23 +5,23 @@ def posts_count(*args)
end
it "should show the correct number of posts in the past" do
- posts_count.should == 9
+ posts_count.should == 5
end
it "is aliased as before_now" do
- Post.before_now.count.should == 9
+ Post.before_now.count.should == 5
end
it "should find for a given time" do
- posts_count(Time.zone.now - 2.days).should eql(1)
+ posts_count(Time.zone.now - 2.days).should eql(2)
end
it "should find for a given date" do
- posts_count(Date.today - 2).should eql(1)
+ posts_count(Date.today - 2).should eql(2)
end
it "should find for a given string" do
- posts_count("next tuesday").should eql(11)
+ posts_count("next tuesday").should eql(8)
end
it "raises an exception when Chronic can't parse" do
@@ -44,7 +44,7 @@ def posts_count(*args)
end
it "should find for a given date" do
- posts_count(Date.today - 2).should eql(23)
+ posts_count(Date.today - 2).should eql(19)
end
it "should find for a given string" do
@@ -62,7 +62,7 @@ def posts_count(*args)
context "previous" do
it "can find the previous post" do
- current_post.previous.text.should == "Last year"
+ current_post.previous.text.should == "Yesterday's post"
end
it "takes the field option" do
8 spec/by_star/by_fortnight_spec.rb
View
@@ -11,12 +11,12 @@ def posts_count(*args)
end
it "should be able to find posts in the current fortnight" do
- posts_count.should eql(8)
+ posts_count.should eql(6)
end
it "should be able to find posts in the 1st fortnight of the current year" do
- posts_count(0).should eql(8)
- posts_count("0").should eql(8)
+ posts_count(0).should eql(6)
+ posts_count("0").should eql(6)
# There was previously a situation where incorrect time zone math
# caused the 'post 1' post to NOT appear, so count would be 7, rather than 8.
# So this line simply regression tests that problem.
@@ -24,7 +24,7 @@ def posts_count(*args)
end
it "should be able to find posts for a fortnight ago" do
- posts_count(2.weeks.ago).should eql(3)
+ posts_count(2.weeks.ago).should eql(2)
end
it "should be able to find posts for a given fortnight in a year" do
4 spec/by_star/by_month_spec.rb
View
@@ -10,14 +10,14 @@ def posts_count(time=Time.zone.now, options={})
end
it "should be able to find posts for the current month" do
- posts_count.should eql(8)
+ posts_count.should eql(6)
end
it "should be able to find a single post for January" do
# If it is January we'll have all the "current" posts in there.
# This makes the count 10.
# I'm sure you can guess what happens when it's not January.
- posts_count("January").should eql(8)
+ posts_count("January").should eql(6)
end
it "should be able to find two posts for the 2nd month" do
12 spec/by_star/by_week_spec.rb
View
@@ -9,11 +9,11 @@ def find_posts(*args)
end
it "should be able to find posts in the current week" do
- posts_count.should eql(8)
+ posts_count.should eql(5)
end
it "should be able to find posts in the 1st week" do
- posts_count(0).should eql(8)
+ posts_count(0).should eql(6)
end
it "should be able to find posts in the 1st week of last year" do
@@ -21,11 +21,7 @@ def find_posts(*args)
end
it "should not find any posts from a week ago" do
- posts_count(1.week.ago).should eql(0)
- end
-
- it "should be able to find posts by a given date" do
- posts_count(1.week.ago.to_date).should eql(0)
+ posts_count(1.week.ago).should eql(1)
end
it "should be able to use an alternative field" do
@@ -33,7 +29,7 @@ def find_posts(*args)
end
it "should find posts at the start of the year" do
- posts_count(0).should eql(8)
+ posts_count(0).should eql(6)
end
it "should find posts at the end of the year" do
2  spec/by_star/by_weekend_spec.rb
View
@@ -3,7 +3,7 @@
describe 'by weekend' do
it "should be able to find the posts on the weekend of the 1st of January" do
- Post.by_weekend.count.should eql(10)
+ Post.by_weekend.count.should eql(6)
end
it "should be able to use an alternative field" do
8 spec/by_star/by_year_spec.rb
View
@@ -10,7 +10,7 @@ def find_posts(*args)
Post.by_year(args.first, options)
end
- let(:this_years_posts) { 20 }
+ let(:this_years_posts) { 18 }
it "should be able to find all the posts in the current year" do
posts_count.should eql(this_years_posts)
@@ -21,16 +21,16 @@ def find_posts(*args)
end
it "should be able to find a single post from last year" do
- posts_count(Time.zone.now.year-1).should eql(4)
+ posts_count(Time.zone.now.year-1).should eql(3)
end
it "knows what last year's posts were" do
- find_posts(Time.zone.now.year-1).map(&:text).should =~ ["Last year", "End of last year", "Yesterday", "Yesterday's post"]
+ find_posts(Time.zone.now.year-1).map(&:text).should =~ ["A week ago", "This time, last year", "Yesterday's post"]
end
it "can find posts given a 2-digit year" do
# Should be good for at least a couple of years.
- posts_count(Time.zone.now.year-2001).should eql(4)
+ posts_count(Time.zone.now.year-2001).should eql(3)
end
it "should be able to use an alternative field (string)" do
Please sign in to comment.
Something went wrong with that request. Please try again.