spec/controllers/flyboy/goals_controller_spec.rb in flyboy-1.0.7 vs spec/controllers/flyboy/goals_controller_spec.rb in flyboy-1.1.0

- old
+ new

@@ -36,22 +36,22 @@ end context "when sorting" do before do Flyboy::Goal.destroy_all - @goal1 = FactoryGirl.create(:flyboy_goal, title: "Abc", progress: 100, status: "open") - @goal2 = FactoryGirl.create(:flyboy_goal, title: "dEF", progress: 0, status: "closed") - @goal3 = FactoryGirl.create(:flyboy_goal, title: "xyz", progress: 35, status: "closed") + @goal1 = FactoryGirl.create(:flyboy_goal, name: "Abc", progress: 100, status: "open") + @goal2 = FactoryGirl.create(:flyboy_goal, name: "dEF", progress: 0, status: "closed") + @goal3 = FactoryGirl.create(:flyboy_goal, name: "xyz", progress: 35, status: "closed") end - it "sorting by title asc" do - get :index, sort: "title" + it "sorting by name asc" do + get :index, sort: "name" expect(assigns(:goals).to_a).to eq [@goal1, @goal2, @goal3] end - it "sorting by title desc" do - get :index, sort: "-title" + it "sorting by name desc" do + get :index, sort: "-name" expect(assigns(:goals).to_a).to eq [@goal3, @goal2, @goal1] end it "sorting by progress asc" do get :index, sort: "progress" @@ -82,23 +82,23 @@ Flyboy::Task.destroy_all @goal = FactoryGirl.create(:flyboy_goal) @task1 = FactoryGirl.create(:flyboy_task, - goal: @goal, title: "Abc", progress: 100, term: "21/12/2012", reminder: "21/12/2012") + taskable: @goal, name: "Abc", progress: 100, term: "21/12/2012", reminder: "21/12/2012") @task2 = FactoryGirl.create(:flyboy_task, - goal: @goal, title: "dEF", progress: 0, term: "23/12/2012", reminder: "23/12/2012") + taskable: @goal, name: "dEF", progress: 0, term: "23/12/2012", reminder: "23/12/2012") @task3 = FactoryGirl.create(:flyboy_task, - goal: @goal, title: "xyz", progress: 35, term: "22/12/2012", reminder: "22/12/2012") + taskable: @goal, name: "xyz", progress: 35, term: "22/12/2012", reminder: "22/12/2012") end - it "sorting by title asc" do - get :show, id: @goal, sort: "title" + it "sorting by name asc" do + get :show, id: @goal, sort: "name" expect(assigns(:tasks).to_a).to eq [@task1, @task2, @task3] end - it "sorting by title desc" do - get :show, id: @goal, sort: "-title" + it "sorting by name desc" do + get :show, id: @goal, sort: "-name" expect(assigns(:tasks).to_a).to eq [@task3, @task2, @task1] end it "sorting by progress asc" do get :show, id: @goal, sort: "progress"