sales listing under transacitons

This commit is contained in:
Min Zeya Phyo
2017-05-29 18:55:34 +06:30
parent c7a4adc7cc
commit d7d29e4d16
26 changed files with 731 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
require 'rails_helper'
RSpec.describe "transactions/sales/edit", type: :view do
before(:each) do
@transactions_sale = assign(:transactions_sale, Transactions::Sale.create!(
:cashier => nil,
:cashier_name => "MyString",
:requested_by => "MyString",
:receipt_no => "MyString",
:customer => nil,
:payment_status => "MyString",
:sale_status => "MyString",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "MyString",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
))
end
it "renders the edit transactions_sale form" do
render
assert_select "form[action=?][method=?]", transactions_sale_path(@transactions_sale), "post" do
assert_select "input[name=?]", "transactions_sale[cashier_id]"
assert_select "input[name=?]", "transactions_sale[cashier_name]"
assert_select "input[name=?]", "transactions_sale[requested_by]"
assert_select "input[name=?]", "transactions_sale[receipt_no]"
assert_select "input[name=?]", "transactions_sale[customer_id]"
assert_select "input[name=?]", "transactions_sale[payment_status]"
assert_select "input[name=?]", "transactions_sale[sale_status]"
assert_select "input[name=?]", "transactions_sale[total_amount]"
assert_select "input[name=?]", "transactions_sale[total_discount]"
assert_select "input[name=?]", "transactions_sale[total_tax]"
assert_select "input[name=?]", "transactions_sale[tax_type]"
assert_select "input[name=?]", "transactions_sale[grand_total]"
assert_select "input[name=?]", "transactions_sale[rounding_adjustment]"
assert_select "input[name=?]", "transactions_sale[amount_received]"
assert_select "input[name=?]", "transactions_sale[amount_changed]"
end
end
end

View File

@@ -0,0 +1,61 @@
require 'rails_helper'
RSpec.describe "transactions/sales/index", type: :view do
before(:each) do
assign(:transactions_sales, [
Transactions::Sale.create!(
:cashier => nil,
:cashier_name => "Cashier Name",
:requested_by => "Requested By",
:receipt_no => "Receipt No",
:customer => nil,
:payment_status => "Payment Status",
:sale_status => "Sale Status",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "Tax Type",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
),
Transactions::Sale.create!(
:cashier => nil,
:cashier_name => "Cashier Name",
:requested_by => "Requested By",
:receipt_no => "Receipt No",
:customer => nil,
:payment_status => "Payment Status",
:sale_status => "Sale Status",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "Tax Type",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
)
])
end
it "renders a list of transactions/sales" do
render
assert_select "tr>td", :text => nil.to_s, :count => 2
assert_select "tr>td", :text => "Cashier Name".to_s, :count => 2
assert_select "tr>td", :text => "Requested By".to_s, :count => 2
assert_select "tr>td", :text => "Receipt No".to_s, :count => 2
assert_select "tr>td", :text => nil.to_s, :count => 2
assert_select "tr>td", :text => "Payment Status".to_s, :count => 2
assert_select "tr>td", :text => "Sale Status".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "Tax Type".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
assert_select "tr>td", :text => "9.99".to_s, :count => 2
end
end

View File

@@ -0,0 +1,60 @@
require 'rails_helper'
RSpec.describe "transactions/sales/new", type: :view do
before(:each) do
assign(:transactions_sale, Transactions::Sale.new(
:cashier => nil,
:cashier_name => "MyString",
:requested_by => "MyString",
:receipt_no => "MyString",
:customer => nil,
:payment_status => "MyString",
:sale_status => "MyString",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "MyString",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
))
end
it "renders new transactions_sale form" do
render
assert_select "form[action=?][method=?]", transactions_sales_path, "post" do
assert_select "input[name=?]", "transactions_sale[cashier_id]"
assert_select "input[name=?]", "transactions_sale[cashier_name]"
assert_select "input[name=?]", "transactions_sale[requested_by]"
assert_select "input[name=?]", "transactions_sale[receipt_no]"
assert_select "input[name=?]", "transactions_sale[customer_id]"
assert_select "input[name=?]", "transactions_sale[payment_status]"
assert_select "input[name=?]", "transactions_sale[sale_status]"
assert_select "input[name=?]", "transactions_sale[total_amount]"
assert_select "input[name=?]", "transactions_sale[total_discount]"
assert_select "input[name=?]", "transactions_sale[total_tax]"
assert_select "input[name=?]", "transactions_sale[tax_type]"
assert_select "input[name=?]", "transactions_sale[grand_total]"
assert_select "input[name=?]", "transactions_sale[rounding_adjustment]"
assert_select "input[name=?]", "transactions_sale[amount_received]"
assert_select "input[name=?]", "transactions_sale[amount_changed]"
end
end
end

View File

@@ -0,0 +1,42 @@
require 'rails_helper'
RSpec.describe "transactions/sales/show", type: :view do
before(:each) do
@transactions_sale = assign(:transactions_sale, Transactions::Sale.create!(
:cashier => nil,
:cashier_name => "Cashier Name",
:requested_by => "Requested By",
:receipt_no => "Receipt No",
:customer => nil,
:payment_status => "Payment Status",
:sale_status => "Sale Status",
:total_amount => "9.99",
:total_discount => "9.99",
:total_tax => "9.99",
:tax_type => "Tax Type",
:grand_total => "9.99",
:rounding_adjustment => "9.99",
:amount_received => "9.99",
:amount_changed => "9.99"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(//)
expect(rendered).to match(/Cashier Name/)
expect(rendered).to match(/Requested By/)
expect(rendered).to match(/Receipt No/)
expect(rendered).to match(//)
expect(rendered).to match(/Payment Status/)
expect(rendered).to match(/Sale Status/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/Tax Type/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
expect(rendered).to match(/9.99/)
end
end