diff --git a/app/controllers/reading_groups_controller.rb b/app/controllers/reading_groups_controller.rb index e9826c4..57784e3 100644 --- a/app/controllers/reading_groups_controller.rb +++ b/app/controllers/reading_groups_controller.rb @@ -35,7 +35,7 @@ class ReadingGroupsController < ApplicationController def edit; end def update - if @reading_group.save(reading_group_params) + if @reading_group.update(reading_group_params) redirect_to(reading_group_path(@reading_group.id)) else render "edit" @@ -74,7 +74,7 @@ class ReadingGroupsController < ApplicationController format.json { render action: 'show', status: :created, location: @reading_group } else format.html { render action: 'new' } - format.json { render json: @reading_group.errors, status: :unprocessable_entity } + format.json { render json: @reading_group.kalibro_errors, status: :unprocessable_entity } end end end diff --git a/app/models/reading_group.rb b/app/models/reading_group.rb index c21cd9d..67288f8 100644 --- a/app/models/reading_group.rb +++ b/app/models/reading_group.rb @@ -1,2 +1,3 @@ class ReadingGroup < KalibroClient::Entities::Configurations::ReadingGroup + include KalibroRecord end diff --git a/features/reading_group/create.feature b/features/reading_group/create.feature index 926128b..bf67146 100644 --- a/features/reading_group/create.feature +++ b/features/reading_group/create.feature @@ -30,7 +30,7 @@ Scenario: reading group creation with already taken name And I fill the Name field with "Group" And I fill the Description field with "Same Group" When I press the Save button - Then I should see "Name There is already a ReadingGroup with name Group!" + Then I should see "Name has already been taken" @kalibro_configuration_restart Scenario: reading group creation with blank name diff --git a/features/reading_group/edit.feature b/features/reading_group/edit.feature index 19f08d2..9866595 100644 --- a/features/reading_group/edit.feature +++ b/features/reading_group/edit.feature @@ -60,7 +60,7 @@ Feature: Reading Group And I am at the sample reading group edit page And I fill the Name field with "A Reading" When I press the Save button - Then I should see "Name There is already a ReadingGroup with name A Reading!" + Then I should see "Name has already been taken" @kalibro_configuration_restart Scenario: Editing just the description diff --git a/features/step_definitions/reading_group_steps.rb b/features/step_definitions/reading_group_steps.rb index 5ef9f09..d3a60bf 100644 --- a/features/step_definitions/reading_group_steps.rb +++ b/features/step_definitions/reading_group_steps.rb @@ -55,7 +55,7 @@ Then(/^I should see the information of the sample reading$/) do expect(page).to have_content(@reading.label) expect(page).to have_content(@reading.grade) pager = page.body - color = @reading.color.downcase + color = @reading.color var = (pager =~ /#{color}/) expect(var).to_not be_nil end diff --git a/spec/controllers/reading_groups_controller_spec.rb b/spec/controllers/reading_groups_controller_spec.rb index a62160f..8047863 100644 --- a/spec/controllers/reading_groups_controller_spec.rb +++ b/spec/controllers/reading_groups_controller_spec.rb @@ -211,7 +211,7 @@ describe ReadingGroupsController, :type => :controller do context 'with valid fields' do before :each do subject.expects(:find_resource).with(ReadingGroup, @subject.id).returns(@subject) - ReadingGroup.any_instance.expects(:save).with(@subject_params).returns(true) + ReadingGroup.any_instance.expects(:update).with(@subject_params).returns(true) end context 'rendering the show' do @@ -236,7 +236,7 @@ describe ReadingGroupsController, :type => :controller do context 'with an invalid field' do before :each do subject.expects(:find_resource).with(ReadingGroup, @subject.id).returns(@subject) - ReadingGroup.any_instance.expects(:save).with(@subject_params).returns(false) + ReadingGroup.any_instance.expects(:update).with(@subject_params).returns(false) post :update, :id => @subject.id, :reading_group => @subject_params end -- libgit2 0.21.2