Commit b3bc4dab82b6f79747fa754359691ff9bb9fd697

Authored by Rafael Manzo
1 parent 345326aa

Fixed pending specs

spec/controllers/projects_controller_spec.rb
... ... @@ -20,7 +20,7 @@ describe ProjectsController do
20 20 context 'with valid fields' do
21 21 let(:project) { FactoryGirl.build(:project) }
22 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 24 before :each do
25 25 Project.any_instance.expects(:save).returns(true)
26 26 end
... ... @@ -83,7 +83,7 @@ describe ProjectsController do
83 83 sign_in FactoryGirl.create(:user)
84 84 @ownership = FactoryGirl.build(:project_ownership)
85 85 @ownerships = []
86   -
  86 +
87 87 end
88 88  
89 89 context 'when the user owns the project' do
... ... @@ -112,7 +112,7 @@ describe ProjectsController do
112 112 before :each do
113 113 @ownerships.expects(:find_by_project_id).with("#{@subject.id}").returns(nil)
114 114 User.any_instance.expects(:project_ownerships).at_least_once.returns(@ownerships)
115   -
  115 +
116 116 delete :destroy, :id => @subject.id
117 117 end
118 118  
... ... @@ -151,7 +151,7 @@ describe ProjectsController do
151 151 @ownerships = []
152 152  
153 153 User.any_instance.expects(:project_ownerships).at_least_once.returns(@ownerships)
154   -
  154 +
155 155 sign_in @user
156 156 end
157 157  
... ... @@ -159,7 +159,7 @@ describe ProjectsController do
159 159 before :each do
160 160 Project.expects(:find).with(@subject.id.to_s).returns(@subject)
161 161 @ownerships.expects(:find_by_project_id).with("#{@subject.id}").returns(@ownership)
162   -
  162 +
163 163 get :edit, :id => @subject.id
164 164 end
165 165  
... ... @@ -179,12 +179,7 @@ describe ProjectsController do
179 179 end
180 180  
181 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 183 end
189 184 end
190 185  
... ...
spec/controllers/repositories_controller_spec.rb
... ... @@ -164,14 +164,9 @@ describe RepositoriesController do
164 164 get :edit, id: repository.id, project_id: project.id.to_s
165 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 170 end
176 171 end
177 172  
... ... @@ -187,7 +182,7 @@ describe RepositoriesController do
187 182 describe 'update' do
188 183 let(:repository) { FactoryGirl.build(:repository) }
189 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 186 context 'when the user is logged in' do
192 187 before do
193 188 sign_in FactoryGirl.create(:user)
... ...