Commit 153d6ef6fb093437f6e62b729570d8219297194a
Committed by
Rafael Manzo
1 parent
946d9a21
Exists in
colab
and in
4 other branches
ReadingGroup acceptance tests working.
Signed off by: Daniel Alves <danpaulalves@gmail.com>
Showing
6 changed files
with
8 additions
and
7 deletions
Show diff stats
app/controllers/reading_groups_controller.rb
| ... | ... | @@ -35,7 +35,7 @@ class ReadingGroupsController < ApplicationController |
| 35 | 35 | def edit; end |
| 36 | 36 | |
| 37 | 37 | def update |
| 38 | - if @reading_group.save(reading_group_params) | |
| 38 | + if @reading_group.update(reading_group_params) | |
| 39 | 39 | redirect_to(reading_group_path(@reading_group.id)) |
| 40 | 40 | else |
| 41 | 41 | render "edit" |
| ... | ... | @@ -74,7 +74,7 @@ class ReadingGroupsController < ApplicationController |
| 74 | 74 | format.json { render action: 'show', status: :created, location: @reading_group } |
| 75 | 75 | else |
| 76 | 76 | format.html { render action: 'new' } |
| 77 | - format.json { render json: @reading_group.errors, status: :unprocessable_entity } | |
| 77 | + format.json { render json: @reading_group.kalibro_errors, status: :unprocessable_entity } | |
| 78 | 78 | end |
| 79 | 79 | end |
| 80 | 80 | end | ... | ... |
app/models/reading_group.rb
features/reading_group/create.feature
| ... | ... | @@ -30,7 +30,7 @@ Scenario: reading group creation with already taken name |
| 30 | 30 | And I fill the Name field with "Group" |
| 31 | 31 | And I fill the Description field with "Same Group" |
| 32 | 32 | When I press the Save button |
| 33 | - Then I should see "Name There is already a ReadingGroup with name Group!" | |
| 33 | + Then I should see "Name has already been taken" | |
| 34 | 34 | |
| 35 | 35 | @kalibro_configuration_restart |
| 36 | 36 | Scenario: reading group creation with blank name | ... | ... |
features/reading_group/edit.feature
| ... | ... | @@ -60,7 +60,7 @@ Feature: Reading Group |
| 60 | 60 | And I am at the sample reading group edit page |
| 61 | 61 | And I fill the Name field with "A Reading" |
| 62 | 62 | When I press the Save button |
| 63 | - Then I should see "Name There is already a ReadingGroup with name A Reading!" | |
| 63 | + Then I should see "Name has already been taken" | |
| 64 | 64 | |
| 65 | 65 | @kalibro_configuration_restart |
| 66 | 66 | Scenario: Editing just the description | ... | ... |
features/step_definitions/reading_group_steps.rb
| ... | ... | @@ -55,7 +55,7 @@ Then(/^I should see the information of the sample reading$/) do |
| 55 | 55 | expect(page).to have_content(@reading.label) |
| 56 | 56 | expect(page).to have_content(@reading.grade) |
| 57 | 57 | pager = page.body |
| 58 | - color = @reading.color.downcase | |
| 58 | + color = @reading.color | |
| 59 | 59 | var = (pager =~ /#{color}/) |
| 60 | 60 | expect(var).to_not be_nil |
| 61 | 61 | end | ... | ... |
spec/controllers/reading_groups_controller_spec.rb
| ... | ... | @@ -211,7 +211,7 @@ describe ReadingGroupsController, :type => :controller do |
| 211 | 211 | context 'with valid fields' do |
| 212 | 212 | before :each do |
| 213 | 213 | subject.expects(:find_resource).with(ReadingGroup, @subject.id).returns(@subject) |
| 214 | - ReadingGroup.any_instance.expects(:save).with(@subject_params).returns(true) | |
| 214 | + ReadingGroup.any_instance.expects(:update).with(@subject_params).returns(true) | |
| 215 | 215 | end |
| 216 | 216 | |
| 217 | 217 | context 'rendering the show' do |
| ... | ... | @@ -236,7 +236,7 @@ describe ReadingGroupsController, :type => :controller do |
| 236 | 236 | context 'with an invalid field' do |
| 237 | 237 | before :each do |
| 238 | 238 | subject.expects(:find_resource).with(ReadingGroup, @subject.id).returns(@subject) |
| 239 | - ReadingGroup.any_instance.expects(:save).with(@subject_params).returns(false) | |
| 239 | + ReadingGroup.any_instance.expects(:update).with(@subject_params).returns(false) | |
| 240 | 240 | |
| 241 | 241 | post :update, :id => @subject.id, :reading_group => @subject_params |
| 242 | 242 | end | ... | ... |