Skip to content

Instantly share code, notes, and snippets.

@annacruz
Created June 29, 2018 23:37
Show Gist options
  • Save annacruz/3dc60c1a263f6f962b6510d9cc0e0b4f to your computer and use it in GitHub Desktop.
Save annacruz/3dc60c1a263f6f962b6510d9cc0e0b4f to your computer and use it in GitHub Desktop.
context "valid attributes" do
before(:each) do
type = create(:type)
spok = create(:user, name: 'Spok')
kirk = create(:user, name: 'Commander Kirk')
task.type = type
do_action({name: "New Project name", status_id: status.id, type_id: type.id, watcher_ids: [spok.id]})
end
it { expect(assigns(:task)) }
it { expect(assigns(:watchers_changes)).to eq({added: [spok.id], removed: [kirk.id]})}
it { assigns(:task_changes).should == { "name" => [task.name, "New Project name"], "status_id" => [task.status.name, status.name],
"responsible_id" => ["None yet", "None yet"], "type_id" => [task.type.name, type.name], "estimate_id" => ["None yet", "None yet"] } }
it { should redirect_to(project_task_path(project,task)) }
it { should set_flash.to("Task was successfully updated.") }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment