mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-31 05:05:18 +01:00
Pre-filling default tags makes these specs wrong and useless
This commit is contained in:
parent
26c94551cd
commit
bbf3e95b21
1 changed files with 0 additions and 37 deletions
|
|
@ -1,41 +1,4 @@
|
||||||
require File.dirname(__FILE__) + '/../spec_helper'
|
require File.dirname(__FILE__) + '/../spec_helper'
|
||||||
|
|
||||||
describe TodosController do
|
describe TodosController do
|
||||||
it "should add project's default tags to todos" do
|
|
||||||
p = mock_model(Project, :new_record_before_save? => false)
|
|
||||||
p.should_receive(:default_tags).twice.and_return('abcd,efgh')
|
|
||||||
todo = mock_model(Todo, :save => true, :update_state_from_project => nil,
|
|
||||||
:tags => mock(:tag_list, :reload => nil))
|
|
||||||
todo.stub!(:project_id=)
|
|
||||||
todo.should_receive(:tag_with).with('abcd,efgh')
|
|
||||||
projects = mock(:project_list, :find_or_create_by_name => p, :find => [p])
|
|
||||||
todos = mock(:todo_list, :build => todo)
|
|
||||||
|
|
||||||
user = mock_model(User, :todos => todos, :projects => projects, :prefs => {},
|
|
||||||
:contexts => mock(:context_list, :find => []))
|
|
||||||
controller.stub!(:current_user).and_return(user)
|
|
||||||
controller.stub!(:login_required).and_return(true)
|
|
||||||
controller.stub!(:set_time_zone).and_return(true)
|
|
||||||
controller.stub!(:mobile?).and_return(true)
|
|
||||||
get 'create', :project_name => "zzzz", :tag_list => '', :todo => {}
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should append project's default tags to todos" do
|
|
||||||
p = mock_model(Project, :new_record_before_save? => false)
|
|
||||||
p.should_receive(:default_tags).twice.and_return('abcd,efgh')
|
|
||||||
todo = mock_model(Todo, :save => true, :update_state_from_project => nil,
|
|
||||||
:tags => mock(:tag_list, :reload => nil))
|
|
||||||
todo.stub!(:project_id=)
|
|
||||||
todo.should_receive(:tag_with).with('111,222,abcd,efgh')
|
|
||||||
projects = mock(:project_list, :find_or_create_by_name => p, :find => [p])
|
|
||||||
todos = mock(:todo_list, :build => todo)
|
|
||||||
|
|
||||||
user = mock_model(User, :todos => todos, :projects => projects, :prefs => {},
|
|
||||||
:contexts => mock(:context_list, :find => []))
|
|
||||||
controller.stub!(:current_user).and_return(user)
|
|
||||||
controller.stub!(:login_required).and_return(true)
|
|
||||||
controller.stub!(:set_time_zone).and_return(true)
|
|
||||||
controller.stub!(:mobile?).and_return(true)
|
|
||||||
get 'create', :project_name => "zzzz", :tag_list => '111,222', :todo => {}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue