origin pull master
This commit is contained in:
5
spec/views/oqs/print/print.html.erb_spec.rb
Normal file
5
spec/views/oqs/print/print.html.erb_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "print/print.html.erb", type: :view do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
51
spec/views/print_settings/edit.html.erb_spec.rb
Normal file
51
spec/views/print_settings/edit.html.erb_spec.rb
Normal file
@@ -0,0 +1,51 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "print_settings/edit", type: :view do
|
||||
before(:each) do
|
||||
@print_setting = assign(:print_setting, PrintSetting.create!(
|
||||
:name, => "MyString",
|
||||
:unique_code, => "MyString",
|
||||
:template, => "MyString",
|
||||
:db_name, => "MyString",
|
||||
:db_type, => "MyString",
|
||||
:db_username, => "MyString",
|
||||
:db_password, => "MyString",
|
||||
:printer_name, => "MyString",
|
||||
:api_settings, => "MyString",
|
||||
:page_width => "",
|
||||
:page_height => "",
|
||||
:print_copies => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit print_setting form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", print_setting_path(@print_setting), "post" do
|
||||
|
||||
assert_select "input[name=?]", "print_setting[name,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[unique_code,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[template,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[db_name,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[db_type,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[db_username,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[db_password,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[printer_name,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[api_settings,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[page_width]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[page_height]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[print_copies]"
|
||||
end
|
||||
end
|
||||
end
|
||||
52
spec/views/print_settings/index.html.erb_spec.rb
Normal file
52
spec/views/print_settings/index.html.erb_spec.rb
Normal file
@@ -0,0 +1,52 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "print_settings/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:print_settings, [
|
||||
PrintSetting.create!(
|
||||
:name, => "Name,",
|
||||
:unique_code, => "Unique Code,",
|
||||
:template, => "Template,",
|
||||
:db_name, => "Db Name,",
|
||||
:db_type, => "Db Type,",
|
||||
:db_username, => "Db Username,",
|
||||
:db_password, => "Db Password,",
|
||||
:printer_name, => "Printer Name,",
|
||||
:api_settings, => "Api Settings,",
|
||||
:page_width => "",
|
||||
:page_height => "",
|
||||
:print_copies => 2
|
||||
),
|
||||
PrintSetting.create!(
|
||||
:name, => "Name,",
|
||||
:unique_code, => "Unique Code,",
|
||||
:template, => "Template,",
|
||||
:db_name, => "Db Name,",
|
||||
:db_type, => "Db Type,",
|
||||
:db_username, => "Db Username,",
|
||||
:db_password, => "Db Password,",
|
||||
:printer_name, => "Printer Name,",
|
||||
:api_settings, => "Api Settings,",
|
||||
:page_width => "",
|
||||
:page_height => "",
|
||||
:print_copies => 2
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of print_settings" do
|
||||
render
|
||||
assert_select "tr>td", :text => "Name,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Unique Code,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Template,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Db Name,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Db Type,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Db Username,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Db Password,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Printer Name,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Api Settings,".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "".to_s, :count => 2
|
||||
assert_select "tr>td", :text => "".to_s, :count => 2
|
||||
assert_select "tr>td", :text => 2.to_s, :count => 2
|
||||
end
|
||||
end
|
||||
51
spec/views/print_settings/new.html.erb_spec.rb
Normal file
51
spec/views/print_settings/new.html.erb_spec.rb
Normal file
@@ -0,0 +1,51 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "print_settings/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:print_setting, PrintSetting.new(
|
||||
:name, => "MyString",
|
||||
:unique_code, => "MyString",
|
||||
:template, => "MyString",
|
||||
:db_name, => "MyString",
|
||||
:db_type, => "MyString",
|
||||
:db_username, => "MyString",
|
||||
:db_password, => "MyString",
|
||||
:printer_name, => "MyString",
|
||||
:api_settings, => "MyString",
|
||||
:page_width => "",
|
||||
:page_height => "",
|
||||
:print_copies => 1
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new print_setting form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", print_settings_path, "post" do
|
||||
|
||||
assert_select "input[name=?]", "print_setting[name,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[unique_code,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[template,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[db_name,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[db_type,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[db_username,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[db_password,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[printer_name,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[api_settings,]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[page_width]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[page_height]"
|
||||
|
||||
assert_select "input[name=?]", "print_setting[print_copies]"
|
||||
end
|
||||
end
|
||||
end
|
||||
36
spec/views/print_settings/show.html.erb_spec.rb
Normal file
36
spec/views/print_settings/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "print_settings/show", type: :view do
|
||||
before(:each) do
|
||||
@print_setting = assign(:print_setting, PrintSetting.create!(
|
||||
:name, => "Name,",
|
||||
:unique_code, => "Unique Code,",
|
||||
:template, => "Template,",
|
||||
:db_name, => "Db Name,",
|
||||
:db_type, => "Db Type,",
|
||||
:db_username, => "Db Username,",
|
||||
:db_password, => "Db Password,",
|
||||
:printer_name, => "Printer Name,",
|
||||
:api_settings, => "Api Settings,",
|
||||
:page_width => "",
|
||||
:page_height => "",
|
||||
:print_copies => 2
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Name,/)
|
||||
expect(rendered).to match(/Unique Code,/)
|
||||
expect(rendered).to match(/Template,/)
|
||||
expect(rendered).to match(/Db Name,/)
|
||||
expect(rendered).to match(/Db Type,/)
|
||||
expect(rendered).to match(/Db Username,/)
|
||||
expect(rendered).to match(/Db Password,/)
|
||||
expect(rendered).to match(/Printer Name,/)
|
||||
expect(rendered).to match(/Api Settings,/)
|
||||
expect(rendered).to match(//)
|
||||
expect(rendered).to match(//)
|
||||
expect(rendered).to match(/2/)
|
||||
end
|
||||
end
|
||||
60
spec/views/transactions/sales/edit.html.erb_spec.rb
Normal file
60
spec/views/transactions/sales/edit.html.erb_spec.rb
Normal 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
|
||||
61
spec/views/transactions/sales/index.html.erb_spec.rb
Normal file
61
spec/views/transactions/sales/index.html.erb_spec.rb
Normal 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
|
||||
60
spec/views/transactions/sales/new.html.erb_spec.rb
Normal file
60
spec/views/transactions/sales/new.html.erb_spec.rb
Normal 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
|
||||
42
spec/views/transactions/sales/show.html.erb_spec.rb
Normal file
42
spec/views/transactions/sales/show.html.erb_spec.rb
Normal 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
|
||||
Reference in New Issue
Block a user