spec/controllers/account_controller_spec.rb in iugusdk-1.0.0.alpha.0 vs spec/controllers/account_controller_spec.rb in iugusdk-1.0.0.alpha.1
- old
+ new
@@ -45,17 +45,19 @@
it 'should start destruction job' do
@user.accounts.first.destroying?.should be_true
end
end
- context "when using right id" do
+ context "when using wrong id" do
before do
get :destroy, :id => 31241
end
it { response.should redirect_to account_settings_path }
+ it { flash.now[:notice].should == I18n.t("iugu.notices.account_not_found") }
+
end
context "when user is not the owner" do
before(:each) do
@account_user = @user.accounts.first.account_users.find_by_user_id(@user.id)
@@ -99,10 +101,12 @@
get :cancel_destruction, :id => 987213
end
it { response.should redirect_to account_settings_path }
+ it { flash.now[:notice].should == I18n.t("iugu.notices.account_not_found") }
+
end
end
context "select" do
login_as_user
@@ -119,9 +123,12 @@
before(:each) do
put :update, :id => @user.accounts.first.id, :account => { :name => "fudum" }
end
it { response.should redirect_to account_view_path(@user.accounts.first.id) }
+
+ it { flash.now[:notice].should == I18n.t("iugu.notices.account_updated") }
+
it 'should update account name' do
@user.accounts.first.name.should == "fudum"
end