diff --git a/app/assets/javascripts/todo-app/templates/todo-items.hbs b/app/assets/javascripts/todo-app/templates/todo-items.hbs index 27f19776..c947a844 100644 --- a/app/assets/javascripts/todo-app/templates/todo-items.hbs +++ b/app/assets/javascripts/todo-app/templates/todo-items.hbs @@ -1,4 +1,4 @@ -

TODO List

+

{{current-user.email}} さんのTODO List

{{ember-libs/button text="Create" click=(action "build")}} {{ember-libs/button text="Delete Completed Items" disabled=hiddenOrHidingCompleted isDanger=true click=(action "deleteCompletedItems")}} diff --git a/app/views/todo_items/index.html.haml b/app/views/todo_items/index.html.haml index ee70fbae..683e34c8 100644 --- a/app/views/todo_items/index.html.haml +++ b/app/views/todo_items/index.html.haml @@ -1 +1,5 @@ #todo-app + +:javascript + TodoApp.register('session:current-user', Ember.Object.extend({ email: '#{current_user.email}' })); + TodoApp.inject('controller:todo-items', 'current-user', 'session:current-user'); diff --git a/spec/system/todo_items_spec.rb b/spec/system/todo_items_spec.rb index e1d2a0a1..3218c4b7 100644 --- a/spec/system/todo_items_spec.rb +++ b/spec/system/todo_items_spec.rb @@ -2,10 +2,16 @@ RSpec.describe 'Todo Items', type: :system do before do - @user = create(:user) + @user = create(:user, email: 'test-user@example.com') login_as(@user) end + it 'display user email' do + visit '/todo_items' + + expect(page).to have_content 'test-user@example.com' + end + it 'display registered todo items' do create_list(:todo_item, 10, user: @user)