Sha256: df9b5c90127327f9738483b42632559ffb0641df137790f2c92820702e86bbb9

Contents?: true

Size: 1.63 KB

Versions: 15

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'

describe "Reports", :type => :feature do
  stub_authorization!

  context "visiting the admin reports page" do
    it "should have the right content" do
      visit spree.admin_path
      click_link "Reports"
      click_link "Sales Total"

      expect(page).to have_content("Sales Totals")
      expect(page).to have_content("Item Total")
      expect(page).to have_content("Adjustment Total")
      expect(page).to have_content("Sales Total")
    end
  end

  context "searching the admin reports page" do
    before do
      order = create(:order)
      order.update_columns({:adjustment_total => 100})
      order.completed_at = Time.now
      order.save!

      order = create(:order)
      order.update_columns({:adjustment_total => 200})
      order.completed_at = Time.now
      order.save!

      #incomplete order
      order = create(:order)
      order.update_columns({:adjustment_total => 50})
      order.save!

      order = create(:order)
      order.update_columns({:adjustment_total => 200})
      order.completed_at = 3.years.ago
      order.created_at = 3.years.ago
      order.save!

      order = create(:order)
      order.update_columns({:adjustment_total => 200})
      order.completed_at = 3.years.from_now
      order.created_at = 3.years.from_now
      order.save!
    end

    it "should allow me to search for reports" do
      visit spree.admin_path
      click_link "Reports"
      click_link "Sales Total"

      fill_in "q_completed_at_gt", :with => 1.week.ago
      fill_in "q_completed_at_lt", :with => 1.week.from_now
      click_button "Search"

      expect(page).to have_content("$300.00")
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
solidus_backend-1.1.4 spec/features/admin/reports_spec.rb
solidus_backend-1.0.7 spec/features/admin/reports_spec.rb
spree_backend-3.0.10 spec/features/admin/reports_spec.rb
spree_backend-3.0.9 spec/features/admin/reports_spec.rb
solidus_backend-1.0.6 spec/features/admin/reports_spec.rb
spree_backend-3.0.8 spec/features/admin/reports_spec.rb
spree_backend-3.0.7 spec/features/admin/reports_spec.rb
solidus_backend-1.1.3 spec/features/admin/reports_spec.rb
solidus_backend-1.0.5 spec/features/admin/reports_spec.rb
spree_backend-3.0.6.1 spec/features/admin/reports_spec.rb
spree_backend-3.0.6 spec/features/admin/reports_spec.rb
solidus_backend-1.0.4 spec/features/admin/reports_spec.rb
solidus_backend-1.1.2 spec/features/admin/reports_spec.rb
solidus_backend-1.0.3 spec/features/admin/reports_spec.rb
solidus_backend-1.1.1 spec/features/admin/reports_spec.rb