Sha256: e9962b0ada2da01878a0238d1b9b79e1c79af73bb6fe37a5955969f0abc4f7b4
Contents?: true
Size: 1.58 KB
Versions: 17
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' describe Admin::EmailTemplatesController do context "as an admin" do before :each do @admin = create(:admin) sign_in @admin end describe "#index" do it 'opens' do get :index, :use_route => :effective_email_templates expect(response.status).to eq 200 end end describe "#new" do it 'opens' do get :new, :use_route => :effective_email_templates expect(response.status).to eq 200 end end describe "#create" do it 'creates an email template' do expect{ post :create, effective_email_template: attributes_for(:email_template), :use_route => :effective_email_templates }.to change(Effective::EmailTemplate,:count).by(1) end end context "member actions" do before :each do @email_template = create(:email_template) end describe "#edit" do it 'opens' do get :edit, :id => @email_template.id, :use_route => :effective_email_templates expect(response.status).to eq 200 end end describe "#update" do it 'updates an email template' do attributes = @email_template.attributes old_from = @email_template.from new_from = "gfssljewr@dsfa.com" attributes["from"] = new_from expect{ patch :update, id: @email_template.id, effective_email_template: attributes, :use_route => :effective_email_templates @email_template.reload }.to change(@email_template,:from) end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems