Sha256: 6176e4c69c9c9024e03a96460f679dff6946af0d7b564c8d3d97a0c18165d343

Contents?: true

Size: 1.48 KB

Versions: 8

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

describe "CreditCardInfos" do
	before(:all) do
    cmd_str = 'rails g controller_scaffolding credit_card_infos index new create ' 
    cmd_str << ' --template-engine=haml --quiet --force --skip-assets --skip-test-framework --skip-helper' 
		puts "\n#{cmd_str}"
  	%x(#{cmd_str})
    # puts "\n\nRELOADING ROUTES FILE:\n\n"
    # puts  %x(cat config/routes.rb)
    Rails.application.reload_routes!
  end

  after(:all) do
  	cmd_str = 'rails d controller_scaffolding credit_card_infos index new create ' 
    cmd_str << ' --template-engine=haml --quiet --force --skip-assets --skip-test-framework --skip-helper' 
    puts "\n#{cmd_str}"
    %x(#{cmd_str})
  end

  describe "index" do
  	describe "basic functionality" do
  	  before(:each) do
	  	  FactoryGirl.create(:credit_card_info)
	  	end
	    it "displays the credit card we added" do
	    	visit credit_card_infos_path
	    	page.should have_content("John Adams")
	    end
  	end
  	describe "pagination" do
  		before(:each) do
	  	  (1..31).each { FactoryGirl.create(:credit_card_info) }
	  	end
  	  it "shows the correct page info message" do
  	  	visit credit_card_infos_path
  			page.should have_content("Displaying 1 - 15 of 31 credit card infos")
  			visit credit_card_infos_path(page: "2", per_page: "15")
  			page.should have_content("Displaying 16 - 30 of 31 credit card infos")
  			visit credit_card_infos_path(per_page: "100")
  			page.should have_content("Displaying all 31 credit card infos")
  		end
  	end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
controller_scaffolding-1.4.4 test/dummy/spec/requests/credit_card_infos_spec.rb
controller_scaffolding-1.4.3 test/dummy/spec/requests/credit_card_infos_spec.rb
controller_scaffolding-1.4.2 test/dummy/spec/requests/credit_card_infos_spec.rb
controller_scaffolding-1.4.1 test/dummy/spec/requests/credit_card_infos_spec.rb
controller_scaffolding-1.4.0 test/dummy/spec/requests/credit_card_infos_spec.rb
controller_scaffolding-1.3.0 test/dummy/spec/requests/credit_card_infos_spec.rb
controller_scaffolding-1.2.0 test/dummy/spec/requests/credit_card_infos_spec.rb
controller_scaffolding-1.1.1 test/dummy/spec/requests/credit_card_infos_spec.rb