Commit b3bc4dab82b6f79747fa754359691ff9bb9fd697
1 parent
345326aa
Exists in
colab
and in
4 other branches
Fixed pending specs
Showing
2 changed files
with
10 additions
and
20 deletions
Show diff stats
spec/controllers/projects_controller_spec.rb
| @@ -20,7 +20,7 @@ describe ProjectsController do | @@ -20,7 +20,7 @@ describe ProjectsController do | ||
| 20 | context 'with valid fields' do | 20 | context 'with valid fields' do |
| 21 | let(:project) { FactoryGirl.build(:project) } | 21 | let(:project) { FactoryGirl.build(:project) } |
| 22 | let(:subject_params) { Hash[FactoryGirl.attributes_for(:project).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers | 22 | let(:subject_params) { Hash[FactoryGirl.attributes_for(:project).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers |
| 23 | - | 23 | + |
| 24 | before :each do | 24 | before :each do |
| 25 | Project.any_instance.expects(:save).returns(true) | 25 | Project.any_instance.expects(:save).returns(true) |
| 26 | end | 26 | end |
| @@ -83,7 +83,7 @@ describe ProjectsController do | @@ -83,7 +83,7 @@ describe ProjectsController do | ||
| 83 | sign_in FactoryGirl.create(:user) | 83 | sign_in FactoryGirl.create(:user) |
| 84 | @ownership = FactoryGirl.build(:project_ownership) | 84 | @ownership = FactoryGirl.build(:project_ownership) |
| 85 | @ownerships = [] | 85 | @ownerships = [] |
| 86 | - | 86 | + |
| 87 | end | 87 | end |
| 88 | 88 | ||
| 89 | context 'when the user owns the project' do | 89 | context 'when the user owns the project' do |
| @@ -112,7 +112,7 @@ describe ProjectsController do | @@ -112,7 +112,7 @@ describe ProjectsController do | ||
| 112 | before :each do | 112 | before :each do |
| 113 | @ownerships.expects(:find_by_project_id).with("#{@subject.id}").returns(nil) | 113 | @ownerships.expects(:find_by_project_id).with("#{@subject.id}").returns(nil) |
| 114 | User.any_instance.expects(:project_ownerships).at_least_once.returns(@ownerships) | 114 | User.any_instance.expects(:project_ownerships).at_least_once.returns(@ownerships) |
| 115 | - | 115 | + |
| 116 | delete :destroy, :id => @subject.id | 116 | delete :destroy, :id => @subject.id |
| 117 | end | 117 | end |
| 118 | 118 | ||
| @@ -151,7 +151,7 @@ describe ProjectsController do | @@ -151,7 +151,7 @@ describe ProjectsController do | ||
| 151 | @ownerships = [] | 151 | @ownerships = [] |
| 152 | 152 | ||
| 153 | User.any_instance.expects(:project_ownerships).at_least_once.returns(@ownerships) | 153 | User.any_instance.expects(:project_ownerships).at_least_once.returns(@ownerships) |
| 154 | - | 154 | + |
| 155 | sign_in @user | 155 | sign_in @user |
| 156 | end | 156 | end |
| 157 | 157 | ||
| @@ -159,7 +159,7 @@ describe ProjectsController do | @@ -159,7 +159,7 @@ describe ProjectsController do | ||
| 159 | before :each do | 159 | before :each do |
| 160 | Project.expects(:find).with(@subject.id.to_s).returns(@subject) | 160 | Project.expects(:find).with(@subject.id.to_s).returns(@subject) |
| 161 | @ownerships.expects(:find_by_project_id).with("#{@subject.id}").returns(@ownership) | 161 | @ownerships.expects(:find_by_project_id).with("#{@subject.id}").returns(@ownership) |
| 162 | - | 162 | + |
| 163 | get :edit, :id => @subject.id | 163 | get :edit, :id => @subject.id |
| 164 | end | 164 | end |
| 165 | 165 | ||
| @@ -179,12 +179,7 @@ describe ProjectsController do | @@ -179,12 +179,7 @@ describe ProjectsController do | ||
| 179 | end | 179 | end |
| 180 | 180 | ||
| 181 | it { should redirect_to(projects_path) } | 181 | it { should redirect_to(projects_path) } |
| 182 | - | ||
| 183 | - it 'should set the flash' do | ||
| 184 | - pending("This ShouldaMatcher test is not compatible yet with Rails 4") do | ||
| 185 | - should set_the_flash[:notice].to("You shall not edit projects that aren't yours.") | ||
| 186 | - end | ||
| 187 | - end | 182 | + it { should set_the_flash[:notice].to("You're not allowed to do this operation") } |
| 188 | end | 183 | end |
| 189 | end | 184 | end |
| 190 | 185 |
spec/controllers/repositories_controller_spec.rb
| @@ -164,14 +164,9 @@ describe RepositoriesController do | @@ -164,14 +164,9 @@ describe RepositoriesController do | ||
| 164 | get :edit, id: repository.id, project_id: project.id.to_s | 164 | get :edit, id: repository.id, project_id: project.id.to_s |
| 165 | end | 165 | end |
| 166 | 166 | ||
| 167 | - it { should redirect_to(projects_url) } | ||
| 168 | - it { should respond_with(:redirect) } | ||
| 169 | - | ||
| 170 | - it 'should set the flash' do | ||
| 171 | - pending("This ShouldaMatcher test is not compatible yet with Rails 4") do | ||
| 172 | - should set_the_flash[:notice].to("You shall not edit repositories that aren't yours.") | ||
| 173 | - end | ||
| 174 | - end | 167 | + it { should redirect_to(projects_url) } |
| 168 | + it { should respond_with(:redirect) } | ||
| 169 | + it { should set_the_flash[:notice].to("You're not allowed to do this operation") } | ||
| 175 | end | 170 | end |
| 176 | end | 171 | end |
| 177 | 172 | ||
| @@ -187,7 +182,7 @@ describe RepositoriesController do | @@ -187,7 +182,7 @@ describe RepositoriesController do | ||
| 187 | describe 'update' do | 182 | describe 'update' do |
| 188 | let(:repository) { FactoryGirl.build(:repository) } | 183 | let(:repository) { FactoryGirl.build(:repository) } |
| 189 | let(:repository_params) { Hash[FactoryGirl.attributes_for(:repository).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers | 184 | let(:repository_params) { Hash[FactoryGirl.attributes_for(:repository).map { |k,v| [k.to_s, v.to_s] }] } #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers |
| 190 | - | 185 | + |
| 191 | context 'when the user is logged in' do | 186 | context 'when the user is logged in' do |
| 192 | before do | 187 | before do |
| 193 | sign_in FactoryGirl.create(:user) | 188 | sign_in FactoryGirl.create(:user) |