Skip to content

Commit

Permalink
Modified specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Prakriti-nith committed Jul 22, 2018
1 parent 454c58b commit c3672e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
12 changes: 7 additions & 5 deletions spec/adapters/googlecharts/display_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,26 @@
data_spreadsheet, {width: 800}
)
}
let(:user_options) {{chart_class: 'Chartwrapper'}}
let(:data_table) {Daru::View::Table.new(data)}
let(:area_chart_options) {{
type: :area
}}
let(:column_chart_options) {{
type: :column
}}
let(:user_options) {{
let(:user_options_listener) {{
listeners: {
select: "alert('A table row was selected');"
}
}}
let(:data_table) {Daru::View::Table.new(data, {}, user_options)}
let(:data_table) {Daru::View::Table.new(data, {}, user_options_listener)}
let(:area_chart_chart) { Daru::View::Plot.
new(data_table.table, area_chart_options)}
let(:column_chart_chart) { Daru::View::Plot.new(
data_table.table,
column_chart_options,
user_options)
user_options_listener)
}
let(:area_chart_wrapper) {Daru::View::Plot.new(
data_table.table,
Expand All @@ -51,7 +53,7 @@
Daru::View::Plot.new(
data_spreadsheet,
{type: :area},
chart_class: 'ChartWrapper'
user_options
)
}
let (:table_spreadsheet_chartwrapper) {
Expand All @@ -62,7 +64,7 @@
)
}
let(:table_chart_wrapper) {Daru::View::Table.new(
data, {}, {chart_class: 'Chartwrapper'})
data, {}, user_options)
}

describe "#to_html" do
Expand Down
25 changes: 11 additions & 14 deletions spec/adapters/googlecharts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
['2013'],
]
end
let(:user_options) {{
let(:user_options_listener) {{
listeners: {
select: "alert('A table row was selected');"
}
Expand All @@ -54,15 +54,16 @@
Daru::View::Plot.new(
data_spreadsheet,
{type: :column, width: 800},
user_options
user_options_listener
)
}
let (:table_spreadsheet) {
Daru::View::Table.new(
data_spreadsheet, {width: 800}
)
}
let(:data_table) {Daru::View::Table.new(data, {}, user_options)}
let(:user_options) {{chart_class: 'Chartwrapper'}}
let(:data_table) {Daru::View::Table.new(data, {}, user_options_listener)}
let(:area_chart_options) {{
type: :area
}}
Expand All @@ -72,17 +73,17 @@
let(:area_chart_chart) {Daru::View::Plot.
new(data_table.table, area_chart_options)}
let(:column_chart_chart) {Daru::View::Plot.
new(data_table.table, column_chart_options, user_options)}
new(data_table.table, column_chart_options, user_options_listener)}
let(:area_chart_wrapper) {Daru::View::Plot.new(
data_table.table,
area_chart_options,
{chart_class: 'Chartwrapper'})
user_options)
}
let(:table_chart_wrapper) {Daru::View::Table.new(
data, {}, {chart_class: 'Chartwrapper'})
data, {}, user_options)
}
let(:table_wrapper_spreadsheet) {Daru::View::Table.new(
data_spreadsheet, {}, {chart_class: 'Chartwrapper'})
data_spreadsheet, {}, user_options)
}

describe "initialization Charts" do
Expand Down Expand Up @@ -111,9 +112,7 @@
# TODO: all other kinds of charts
it "sets correct user_options and data" do
expect(area_chart_chart.chart.user_options).to be_empty
expect(
area_chart_wrapper.chart.user_options
).to eq :chart_class=> 'Chartwrapper'
expect(area_chart_wrapper.chart.user_options).to eq user_options
expect(area_chart_chart.chart.data).to eq data_table.table
end
end
Expand Down Expand Up @@ -155,10 +154,8 @@
expect{Daru::View::Table.new(1234)}.to raise_error(ArgumentError)
end
it "sets correct user_options and data of the DataTable" do
expect(data_table.table.user_options).to eq user_options
expect(
table_wrapper_spreadsheet.table.user_options
).to eq :chart_class=> 'Chartwrapper'
expect(data_table.table.user_options).to eq user_options_listener
expect(table_wrapper_spreadsheet.table.user_options).to eq user_options
expect(data_table.table.data).to eq data
expect(table_wrapper_spreadsheet.table.data).to eq data_spreadsheet
end
Expand Down

0 comments on commit c3672e0

Please sign in to comment.