Sha256: ec6dbf2165a4d74c22eda84cee9b9a1fcf0bfae1d143f43e790eb4bf90ec66e2

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe StylesController, type: :controller do

  describe 'PUT #preview_template' do
    it 'should update the style#template_previewed_at to now' do
      Timecop.freeze
      style = build_stubbed(:style)
      Style.stub(:find).with(style.id.to_s) { style }
      style.should_receive(:update_attributes).
        with(template_previewed_at: Time.now)
      location = "http:://somewhereelse.com"
      put :preview_template, id: style.id, location: location
      response.should redirect_to(location)
    end
  end

  describe 'PUT #publish_template' do
    it 'should update the style#template_published_at to now' do
      Timecop.freeze
      style = build_stubbed(:style)
      Style.stub(:find).with(style.id.to_s) { style }
      style.should_receive(:update_attributes).
        with(template_published_at: Time.now)
      location = "http:://somewhereelse.com"
      put :publish_template, id: style.id, location: location
      response.should redirect_to(location)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chosen_template-1.0.0 spec/controllers/styles_controller_spec.rb
chosen_template-0.1.0 spec/controllers/styles_controller_spec.rb