Skip to content

Commit

Permalink
Fix normal case in var names in spec tests
Browse files Browse the repository at this point in the history
Rubocop has raised this error, renaming, so that `_` is not added in
front of the digit.

See rubocop/rubocop#3516
  • Loading branch information
Rodion Iafarov committed Nov 9, 2020
1 parent da9d65d commit 233ca41
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 39 deletions.
34 changes: 17 additions & 17 deletions spec/unit/widgets/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ module Widgets
RSpec.describe Table do
let(:widget_controller) { instance_double('widget_controller') }
let(:filter) { FilterExtractor.new({ id: 'foo' }) }
let(:header_0) { 'header_0' }
let(:header_1) { 'header_1' }
let(:headers) { [header_0, header_1] }
let(:cell_0_0) { 'cell_0_0' }
let(:cell_1_0) { 'cell_1_0' }
let(:row_0) { [cell_0_0, '', '', ''] }
let(:row_1) { [cell_1_0, '', '', ''] }
let(:rows) { [row_0, row_1] }
let(:header0) { 'header0' }
let(:header1) { 'header1' }
let(:headers) { [header0, header1] }
let(:cell0) { 'cell0' }
let(:cell1) { 'cell1' }
let(:row0) { [cell0, '', '', ''] }
let(:row1) { [cell1, '', '', ''] }
let(:rows) { [row0, row1] }
let(:table_with_rows) do
double('Response', { body: [{ header: headers,
items: [
{ labels: row_0 },
{ labels: row_1, selected: true }
{ labels: row0 },
{ labels: row1, selected: true }
] }] })
end
subject { Table.new(widget_controller, filter) }
Expand Down Expand Up @@ -55,14 +55,14 @@ module Widgets
end
context 'when column is provided' do
it 'sends select action' do
expect(subject).to receive(:action).with({ action: 'select', value: cell_0_0, column: 0 })
expect(subject.select(value: cell_0_0, column: header_0)).to equal(subject)
expect(subject).to receive(:action).with({ action: 'select', value: cell0, column: 0 })
expect(subject.select(value: cell0, column: header0)).to equal(subject)
end
end
context 'when column is not provided' do
it 'sends select action' do
expect(subject).to receive(:action).with({ action: 'select', value: cell_0_0 })
expect(subject.select(value: cell_0_0)).to equal(subject)
expect(subject).to receive(:action).with({ action: 'select', value: cell0 })
expect(subject.select(value: cell0)).to equal(subject)
end
end
context 'when row is provided' do
Expand All @@ -73,14 +73,14 @@ module Widgets
end
context 'when value and row are provided' do
it 'sends select action using row' do
expect(subject).to receive(:action).with({ action: 'select', value: cell_0_0 })
expect(subject.select(value: cell_0_0, row: 0)).to equal(subject)
expect(subject).to receive(:action).with({ action: 'select', value: cell0 })
expect(subject.select(value: cell0, row: 0)).to equal(subject)
end
end
end

describe '#selected_items' do
let(:rows_selected) { [row_1] }
let(:rows_selected) { [row1] }
it 'lists selected items' do
allow(widget_controller).to receive(:find).and_return(table_with_rows)
expect(subject.selected_items).to eql(rows_selected)
Expand Down
8 changes: 4 additions & 4 deletions spec/widgets/button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Widgets

# Stubbed Requests
let(:press_existing_button) { stub_post.with(query_id_press) }
let(:press_non_existent_button) { stub_post_404.with(query_id_press) }
let(:press_non_existent_button) { stub_post404.with(query_id_press) }
let(:get_enabled_button) { stub_get_id.to_return(button_enabled) }
let(:get_disabled_button) { stub_get_id.to_return(disabled_widget) }

Expand Down Expand Up @@ -42,7 +42,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.button(id).debug_label }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand All @@ -65,7 +65,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.button(id).enabled? }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand All @@ -79,7 +79,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.button(id).fkey }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/widgets/checkbox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ module Widgets

# Stubbed Requests
let(:toggle_existing_checkbox) { stub_post.with(query_toggle) }
let(:toggle_non_existent_checkbox) { stub_post_404.with(query_toggle) }
let(:toggle_non_existent_checkbox) { stub_post404.with(query_toggle) }
let(:check_existing_checkbox) { stub_post.with(query_check) }
let(:check_non_existent_checkbox) { stub_post_404.with(query_check) }
let(:check_non_existent_checkbox) { stub_post404.with(query_check) }
let(:uncheck_existing_checkbox) { stub_post.with(query_uncheck) }
let(:uncheck_non_existent_checkbox) { stub_post_404.with(query_uncheck) }
let(:uncheck_non_existent_checkbox) { stub_post404.with(query_uncheck) }
let(:get_checked_checkbox) { stub_get_id.to_return(checked_checkbox) }
let(:get_unchecked_checkbox) { stub_get_id.to_return(unchecked_checkbox) }

Expand Down Expand Up @@ -89,7 +89,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.checkbox(id).checked? }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/widgets/combobox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Widgets

# Stubbed Requests
let(:select_item_in_existing_combobox) { stub_post.with(query_select) }
let(:select_item_in_non_existent_combobox) { stub_post_404.with(query_select) }
let(:select_item_in_non_existent_combobox) { stub_post404.with(query_select) }
let(:get_items) { stub_get_id.to_return(items_body) }

describe '#select' do
Expand Down Expand Up @@ -45,7 +45,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.combobox(id).items }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand All @@ -60,7 +60,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.combobox(id).value }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/widgets/label_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.label(id).text }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand All @@ -50,7 +50,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.label(id).heading? }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/widgets/radiobutton_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Widgets

# Stubbed Requests
let(:select_existing_radiobutton) { stub_post.with(query_select) }
let(:select_non_existent_radiobutton) { stub_post_404.with(query_select) }
let(:select_non_existent_radiobutton) { stub_post404.with(query_select) }
let(:get_selected_radiobutton) { stub_get_id.to_return(selected_radiobutton) }
let(:get_deselected_radiobutton) { stub_get_id.to_return(deselected_radiobutton) }

Expand Down Expand Up @@ -51,7 +51,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.radiobutton(id).selected? }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/widgets/richtext_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Widgets

# Stubbed Requests
let(:click_link_in_existing_richtext) { stub_post.with(query_select) }
let(:click_link_in_non_existing_richtext) { stub_post_404.with(query_select) }
let(:click_link_in_non_existing_richtext) { stub_post404.with(query_select) }
let(:get_text) { stub_get_id.to_return(text_from_label) }

describe '#click_link' do
Expand Down Expand Up @@ -43,7 +43,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.richtext(id).text }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/widgets/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Widgets
# Stubbed Requests
let(:get_header_table) { stub_get_id.to_return(table_header) }
let(:select_row_in_existing_table) { stub_post.with(query_select) }
let(:select_row_in_non_existent_table) { stub_post_404.with(query_select) }
let(:select_row_in_non_existent_table) { stub_post404.with(query_select) }
let(:request_query_value_column) { { value: 'test_row', column: 'header1' } }

describe '#select' do
Expand Down
4 changes: 2 additions & 2 deletions spec/widgets/textbox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Widgets

# Stubbed Requests
let(:set_text_existing_textbox) { stub_post.with(query_enter_text) }
let(:set_text_non_existent_textbox) { stub_post_404.with(query_enter_text) }
let(:set_text_non_existent_textbox) { stub_post404.with(query_enter_text) }
let(:get_value) { stub_get_id.to_return(text_from_textbox) }

describe '#set' do
Expand Down Expand Up @@ -42,7 +42,7 @@ module Widgets
end
context 'non-existent widget' do
it 'should raise WidgetNotFoundError' do
stub_get_id_404
stub_get_id404
expect { @app.textbox(id).value }.to raise_error(Error::WidgetNotFoundError)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/widgets/widgets_common_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
# Common Stubbed Requests
# POST Stubs
let(:stub_post) { stub_request(:post, widgets_url) }
let(:stub_post_404) { stub_post.to_return(status404) }
let(:stub_post404) { stub_post.to_return(status404) }

# GET Stubs
let(:stub_get) { stub_request(:get, widgets_url) }
let(:stub_get_id) { stub_get.with(query_id) }
let(:stub_get_id_404) { stub_get_id.to_return(status404) }
let(:stub_get_id404) { stub_get_id.to_return(status404) }
end

0 comments on commit 233ca41

Please sign in to comment.