Created
October 23, 2014 10:05
-
-
Save thiagoramos23/bc0a34663939ed687221 to your computer and use it in GitHub Desktop.
Edit Residence Spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe Admin::ResidencesController do | |
let(:user) { build_stubbed(:user) } | |
let(:get_action) { get :edit, id: residence_101.id } | |
let(:residence_101) { build_stubbed(:residence, id: 1) } | |
context "#valid_user" do | |
let(:setup) { | |
allow(Residence).to receive(:find).with(residence_101.id.to_s) | |
.and_return(residence_101) | |
} | |
before { | |
sign_in user | |
setup | |
} | |
describe '#edit' do | |
before { | |
get_action | |
} | |
it_behaves_like "renderable action", :edit | |
it "assigns @residence to queried residence" do | |
expect(assigns(:residence)).to eq(residence_101) | |
end | |
end | |
end | |
include_context 'redirect to sign in' do | |
let(:before_action) { get_action } | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment