This file contains hidden or 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
<script> | |
$(function(){ | |
//Tooltip | |
$("a[data-toggle=tooltip], span[data-toggle=tooltip], .tip").tooltip(); | |
//Popover | |
$("a[data-toggle=popover], .info").popover().click(function(e) { | |
e.preventDefault() | |
}); | |
}); |
This file contains hidden or 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
describe 'GET#index' do | |
it "populates an array of messages" do | |
message = create(:message) | |
get :index | |
expect(assigns(:messages)).to match_array [message] | |
end | |
it "renders the :index view" do | |
get :index | |
response.should render_template :index |
This file contains hidden or 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
describe 'GET#show' do | |
it "assigns the requested message to @message" do | |
message = create(:message) | |
get :show, id: message | |
expect(assigns(:message)).to eq message | |
end | |
it "renders the :show template" do | |
message = create(:message) | |
get :show, id: message |
This file contains hidden or 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
describe 'GET#new' do | |
it "assigns a new Message to @message" do | |
get :new | |
expect(assigns(:message)).to be_a_new(Message) | |
end | |
it "renders the :new template" do | |
get :new | |
expect(response).to render_template :new | |
end |
This file contains hidden or 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
describe 'GET#edit' do | |
it "assigns the requested message to @message" do | |
message = create(:message) | |
get :edit, id: message | |
expect(assigns(:message)).to eq message | |
end | |
it "renders the :edit template" do | |
message = create(:message) | |
get :edit, id: message |
This file contains hidden or 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
describe "POST#create" do | |
context "with valid attributes" do | |
it "saves the new message in the database" do | |
expect{ | |
post :create, message: attributes_for(:message) | |
}.to change(Message, :count).by(1) | |
end | |
it "redirects to the home page" do |
This file contains hidden or 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
describe 'PUT#update' do | |
before :each do | |
@message = create(:message, name: "Aaron Sumner", | |
email: "[email protected]") | |
end | |
it "locates the requested @message" do | |
put :update, id: @message, message: attributes_for(:message) | |
expect(assigns(:message)).to eq(@message) | |
end |
This file contains hidden or 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
describe 'DELETEdestroy' do | |
before :each do | |
@message = create(:message) | |
end | |
it "deletes the message" do | |
expect{ | |
delete :destroy, id: @message | |
}.to change(Message,:count).by(-1) | |
end |
This file contains hidden or 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
describe "PUT flag_as_inappropriate" do | |
before :each do | |
@message = create(:message) | |
end | |
it "marks the message as inappropriate" do | |
put :flag_as_inappropriate, id: @message | |
@message.reload.is_inappropriate?.should be_true | |
expect(@message.reload.is_inappropriate?).to be_true | |
end |
This file contains hidden or 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
describe 'GET#show' do | |
it "renders the :show template for the appointment" do | |
contact = create(:contact) | |
appointment = create(:appointment, contact: contact) | |
get :show, id: appointment, contact_id: contact.id | |
expect(response).to render_template :show | |
end | |
end |