DC DG; correctly populate the stream jasmine fixture
This commit is contained in:
parent
5e28c8f6ec
commit
9d24b518f5
5 changed files with 19 additions and 12 deletions
2
Gemfile
2
Gemfile
|
|
@ -129,6 +129,8 @@ group :test do
|
||||||
gem 'cucumber-api-steps', '0.6', :require => false
|
gem 'cucumber-api-steps', '0.6', :require => false
|
||||||
gem 'database_cleaner', '0.7.0'
|
gem 'database_cleaner', '0.7.0'
|
||||||
gem 'diaspora-client', :git => 'git://github.com/diaspora/diaspora-client.git'
|
gem 'diaspora-client', :git => 'git://github.com/diaspora/diaspora-client.git'
|
||||||
|
|
||||||
|
gem 'timecop'
|
||||||
#"0.1.0", #:path => '~/workspace/diaspora-client'
|
#"0.1.0", #:path => '~/workspace/diaspora-client'
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_girl_rails'
|
||||||
gem 'fixture_builder', '0.3.1'
|
gem 'fixture_builder', '0.3.1'
|
||||||
|
|
|
||||||
|
|
@ -417,6 +417,7 @@ GEM
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
thor (0.14.6)
|
thor (0.14.6)
|
||||||
tilt (1.3.3)
|
tilt (1.3.3)
|
||||||
|
timecop (0.3.5)
|
||||||
treetop (1.4.10)
|
treetop (1.4.10)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
|
|
@ -530,6 +531,7 @@ DEPENDENCIES
|
||||||
sod!
|
sod!
|
||||||
sqlite3
|
sqlite3
|
||||||
thin (~> 1.3.1)
|
thin (~> 1.3.1)
|
||||||
|
timecop
|
||||||
twitter (= 2.0.2)
|
twitter (= 2.0.2)
|
||||||
typhoeus
|
typhoeus
|
||||||
vanna!
|
vanna!
|
||||||
|
|
|
||||||
|
|
@ -13,22 +13,25 @@ describe MultisController do
|
||||||
it 'generates the multi_stream_json fixture', :fixture => true do
|
it 'generates the multi_stream_json fixture', :fixture => true do
|
||||||
posts = []
|
posts = []
|
||||||
|
|
||||||
10.times do
|
|
||||||
posts << alice.post(:status_message, :text => "hella infos yo!", :to => alice.aspects.first.id)
|
|
||||||
posts << alice.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all')
|
|
||||||
posts << alice.post(:status_message, :text => "you're gonna love this.'", :to => alice.aspects.first.id)
|
|
||||||
alice.like(1, :target => posts.last)
|
|
||||||
end
|
|
||||||
|
|
||||||
time = Time.now
|
time = Time.now
|
||||||
posts.each do |p|
|
10.times do
|
||||||
time += 1.day
|
Timecop.travel time += 1.day do
|
||||||
p.stub(:created_at).and_return(time)
|
Timecop.travel time += 1.minute
|
||||||
|
posts << alice.post(:status_message, :text => "hella infos yo!", :to => alice.aspects.first.id)
|
||||||
|
Timecop.travel time += 1.minute
|
||||||
|
posts << alice.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all')
|
||||||
|
Timecop.travel time += 1.minute
|
||||||
|
posts << alice.post(:status_message, :text => "you're gonna love this.'", :to => alice.aspects.first.id)
|
||||||
|
Timecop.travel time += 1.minute
|
||||||
|
alice.like(1, :target => posts.last)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get :index, :format => :json
|
get :index, :format => :json
|
||||||
response.should be_success
|
response.should be_success
|
||||||
save_fixture(response.body, "multi_stream_json")
|
save_fixture(response.body, "multi_stream_json")
|
||||||
|
|
||||||
|
Timecop.return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ describe("app.views.Feedback", function(){
|
||||||
|
|
||||||
var posts = $.parseJSON(spec.readFixture("multi_stream_json"))["posts"];
|
var posts = $.parseJSON(spec.readFixture("multi_stream_json"))["posts"];
|
||||||
|
|
||||||
this.post = new app.models.Post(posts[2]);
|
this.post = new app.models.Post(posts[0]);
|
||||||
this.view = new app.views.Feedback({model: this.post});
|
this.view = new app.views.Feedback({model: this.post});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ describe("app.views.LikesInfo", function(){
|
||||||
window.current_user = app.user({id : -1, name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
|
window.current_user = app.user({id : -1, name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
|
||||||
|
|
||||||
var posts = $.parseJSON(spec.readFixture("multi_stream_json"))["posts"];
|
var posts = $.parseJSON(spec.readFixture("multi_stream_json"))["posts"];
|
||||||
this.post = new app.models.Post(posts[2]); // post with a like
|
this.post = new app.models.Post(posts[0]); // post with a like
|
||||||
this.view = new app.views.LikesInfo({model: this.post});
|
this.view = new app.views.LikesInfo({model: this.post});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue