Sha256: ef6bdfd52a6799a2fb3271ee3717cf976849fe8276f677250c9bf29ad9e61433

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe ReaderActivationsController do
  dataset :messages
  
  before do
    controller.stub!(:request).and_return(request)
    Page.current_site = sites(:test) if defined? Site
    request.env["HTTP_REFERER"] = 'http://test.host/referer!'
  end

  describe "with a correct activation" do
    before do
      @newreader = readers(:inactive)
      put :update, :id => @newreader.id, :activation_code => @newreader.perishable_token
      @reader = Reader.find_by_name('Inactive')
    end

    it "should activate the reader" do
      @reader.activated?.should be_true
      @reader.activated_at.should be_close((Time.now).utc, 1.minute)
    end

    it "should show the show page" do
      response.should be_success
      response.should render_template("show")
    end
  end

  describe "with an incorrect activation" do
    before do
      @newreader = readers(:inactive)
      put :update, :id => @newreader.id, :activation_code => 'down perishcope'
    end
    
    it "should render the show page" do
      response.should be_success
      response.should render_template("show")
    end

    it "should not flash an error" do
      flash[:error].should be_nil
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-reader-extension-1.3.13 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-1.3.12 spec/controllers/reader_activations_controller_spec.rb
radiant-reader-extension-1.3.11 spec/controllers/reader_activations_controller_spec.rb