Skip to content

Instantly share code, notes, and snippets.

@kexline4710
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save kexline4710/9741710 to your computer and use it in GitHub Desktop.

Select an option

Save kexline4710/9741710 to your computer and use it in GitHub Desktop.

Revisions

  1. kexline4710 revised this gist Mar 24, 2014. 1 changed file with 20 additions and 14 deletions.
    34 changes: 20 additions & 14 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -2,29 +2,35 @@

    describe Select::SelectOrdersController do

    let(:user) { create(:user) }

    before do
    request.env['HTTPS'] = 'on'
    request.env['HTTP_REFERER'] = ':back'

    sign_in_user(user)
    end

    context "adjust an existing select order" do
    let (:select_event) { create(:select_event)}
    let (:select_order) { create(:select_order)}
    let (:current_item) { create(:select_order_item, quantity: 1, status: :current)}
    let(:select_event) { create(:select_event)}
    let(:select_order) { create(:select_order, select_event: select_event)}
    let(:current_item) { create(:select_order_item, quantity: 1, status: :current)}

    before do
    select_order.select_order_items << current_item
    select_order.save
    end

    describe "POST :provision", focus: true do

    def do_post
    post :create, select_order: {:select_order => {select_event_id: select_event.id}}
    end

    it "provisions an editable set of order items" do
    pending "since none of my controller methods are being executed when run via rspec :("

    #line_item_count_1 = select_order.select_order_items.count
    ##post :provision, id: select_order.id
    #post :create, select_order: {select_event_id: select_event.id}
    #line_item_count_2 = select_order.select_order_items.count
    #$stderr.puts line_item_count_1
    #$stderr.puts line_item_count_2
    #expect(line_item_count_2).to eq(line_item_count_1 * 2)
    expect( do_post ).to change(Select::SelectOrderItem, :count).by(1)
    end

    end
    end

    end
    end
  2. kexline4710 renamed this gist Mar 24, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. kexline4710 created this gist Mar 24, 2014.
    30 changes: 30 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    require 'spec_helper'

    describe Select::SelectOrdersController do

    context "adjust an existing select order" do
    let (:select_event) { create(:select_event)}
    let (:select_order) { create(:select_order)}
    let (:current_item) { create(:select_order_item, quantity: 1, status: :current)}

    before do
    select_order.select_order_items << current_item
    select_order.save
    end

    describe "POST :provision", focus: true do
    it "provisions an editable set of order items" do
    pending "since none of my controller methods are being executed when run via rspec :("

    #line_item_count_1 = select_order.select_order_items.count
    ##post :provision, id: select_order.id
    #post :create, select_order: {select_event_id: select_event.id}
    #line_item_count_2 = select_order.select_order_items.count
    #$stderr.puts line_item_count_1
    #$stderr.puts line_item_count_2
    #expect(line_item_count_2).to eq(line_item_count_1 * 2)
    end
    end
    end

    end